Merge tag 'backlight-next-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones:
"This set is comprised of a couple of small but important fixes and a
number of clean-up and refactoring patches. The fixes correct an EPROM
address for the LP8556 and improve memory allocation safety in the LED
backlight driver.
The remainder of the set is made up of refactoring work to the mp3309c
driver and a series of patches to make a number of drivers more
self-contained by including their own dependencies.
Improvements & Fixes:
- Correct the EPROM start address for the LP8556 to align with the
device's datasheet.
- Use devm_kcalloc() in the LED backlight driver for safer array
allocation with overflow protection.
Cleanups & Refactoring
- Drop an unnecessary call to pwm_apply_args() in the mp3309c driver.
- Modernize struct initialization in the mp3309c driver by using a
compound literal instead of memset.
- Make numerous drivers self-contained by including necessary headers
directly rather than relying on transitive includes from the core
backlight header"
* tag 'backlight-next-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
backlight: rt4831: Include <linux/mod_devicetable.h>
backlight: rave-sp: Include <linux/of.h> and <linux/mod_devicetable.h>
backlight: led_bl: Include <linux/of.h>
backlight: ktd2801: Include <linux/mod_devicetable.h>
backlight: jornada720: Include <linux/io.h>
backlight: da9052_bl: Include <linux/mod_devicetable.h>
backlight: as3711_bl: Include <linux/of.h>
backlight: apple_dwi_bl: Include <linux/mod_devicetable.h>
backlight: Include <linux/of.h>
video: backlight: lp855x_bl: Set correct EPROM start for LP8556
backlight: led_bl: Use devm_kcalloc() for array space allocation
backlight: mp3309c: Initialize backlight properties without memset
backlight: mp3309c: Drop pwm_apply_args()
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mfd/as3711.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
#ifdef CONFIG_PMAC_BACKLIGHT
|
||||
#include <asm/backlight.h>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/leds-expresswire.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/property.h>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
struct led_bl_data {
|
||||
@@ -89,7 +90,7 @@ static int led_bl_get_leds(struct device *dev,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
leds = devm_kzalloc(dev, sizeof(struct led_classdev *) * nb_leds,
|
||||
leds = devm_kcalloc(dev, nb_leds, sizeof(struct led_classdev *),
|
||||
GFP_KERNEL);
|
||||
if (!leds)
|
||||
return -ENOMEM;
|
||||
@@ -137,7 +138,7 @@ static int led_bl_parse_levels(struct device *dev,
|
||||
unsigned int db;
|
||||
u32 *levels = NULL;
|
||||
|
||||
levels = devm_kzalloc(dev, sizeof(u32) * num_levels,
|
||||
levels = devm_kcalloc(dev, num_levels, sizeof(u32),
|
||||
GFP_KERNEL);
|
||||
if (!levels)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define LP855X_DEVICE_CTRL 0x01
|
||||
#define LP855X_EEPROM_START 0xA0
|
||||
#define LP855X_EEPROM_END 0xA7
|
||||
#define LP8556_EPROM_START 0xA0
|
||||
#define LP8556_EPROM_START 0x98
|
||||
#define LP8556_EPROM_END 0xAF
|
||||
|
||||
/* LP8555/7 Registers */
|
||||
|
||||
@@ -222,7 +222,6 @@ static int mp3309c_parse_fwnode(struct mp3309c_chip *chip,
|
||||
if (IS_ERR(chip->pwmd))
|
||||
return dev_err_probe(dev, PTR_ERR(chip->pwmd), "error getting pwm data\n");
|
||||
pdata->dimming_mode = DIMMING_PWM;
|
||||
pwm_apply_args(chip->pwmd);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -353,12 +352,13 @@ static int mp3309c_probe(struct i2c_client *client)
|
||||
chip->pdata = pdata;
|
||||
|
||||
/* Backlight properties */
|
||||
memset(&props, 0, sizeof(struct backlight_properties));
|
||||
props.brightness = pdata->default_brightness;
|
||||
props.max_brightness = pdata->max_brightness;
|
||||
props.scale = BACKLIGHT_SCALE_LINEAR;
|
||||
props.type = BACKLIGHT_RAW;
|
||||
props.power = BACKLIGHT_POWER_ON;
|
||||
props = (typeof(props)){
|
||||
.brightness = pdata->default_brightness,
|
||||
.max_brightness = pdata->max_brightness,
|
||||
.scale = BACKLIGHT_SCALE_LINEAR,
|
||||
.type = BACKLIGHT_RAW,
|
||||
.power = BACKLIGHT_POWER_ON,
|
||||
};
|
||||
chip->bl = devm_backlight_device_register(dev, "mp3309c", dev, chip,
|
||||
&mp3309c_bl_ops, &props);
|
||||
if (IS_ERR(chip->bl))
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mfd/rave-sp.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#define RAVE_SP_BACKLIGHT_LCD_EN BIT(7)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/property.h>
|
||||
|
||||
Reference in New Issue
Block a user