Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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()

+20 -10
+1
drivers/video/backlight/apple_dwi_bl.c
··· 9 9 #include <linux/bitfield.h> 10 10 #include <linux/device.h> 11 11 #include <linux/io.h> 12 + #include <linux/mod_devicetable.h> 12 13 #include <linux/module.h> 13 14 #include <linux/platform_device.h> 14 15
+1
drivers/video/backlight/as3711_bl.c
··· 13 13 #include <linux/kernel.h> 14 14 #include <linux/mfd/as3711.h> 15 15 #include <linux/module.h> 16 + #include <linux/of.h> 16 17 #include <linux/platform_device.h> 17 18 #include <linux/regmap.h> 18 19 #include <linux/slab.h>
+1
drivers/video/backlight/backlight.c
··· 16 16 #include <linux/ctype.h> 17 17 #include <linux/err.h> 18 18 #include <linux/slab.h> 19 + #include <linux/of.h> 19 20 20 21 #ifdef CONFIG_PMAC_BACKLIGHT 21 22 #include <asm/backlight.h>
+1
drivers/video/backlight/da9052_bl.c
··· 9 9 10 10 #include <linux/backlight.h> 11 11 #include <linux/delay.h> 12 + #include <linux/mod_devicetable.h> 12 13 #include <linux/module.h> 13 14 #include <linux/platform_device.h> 14 15
+1
drivers/video/backlight/jornada720_bl.c
··· 7 7 8 8 #include <linux/backlight.h> 9 9 #include <linux/device.h> 10 + #include <linux/io.h> 10 11 #include <linux/kernel.h> 11 12 #include <linux/module.h> 12 13 #include <linux/platform_device.h>
+1
drivers/video/backlight/ktd2801-backlight.c
··· 6 6 #include <linux/backlight.h> 7 7 #include <linux/gpio/consumer.h> 8 8 #include <linux/leds-expresswire.h> 9 + #include <linux/mod_devicetable.h> 9 10 #include <linux/platform_device.h> 10 11 #include <linux/property.h> 11 12
+3 -2
drivers/video/backlight/led_bl.c
··· 9 9 #include <linux/backlight.h> 10 10 #include <linux/leds.h> 11 11 #include <linux/module.h> 12 + #include <linux/of.h> 12 13 #include <linux/platform_device.h> 13 14 14 15 struct led_bl_data { ··· 90 89 return -EINVAL; 91 90 } 92 91 93 - leds = devm_kzalloc(dev, sizeof(struct led_classdev *) * nb_leds, 92 + leds = devm_kcalloc(dev, nb_leds, sizeof(struct led_classdev *), 94 93 GFP_KERNEL); 95 94 if (!leds) 96 95 return -ENOMEM; ··· 138 137 unsigned int db; 139 138 u32 *levels = NULL; 140 139 141 - levels = devm_kzalloc(dev, sizeof(u32) * num_levels, 140 + levels = devm_kcalloc(dev, num_levels, sizeof(u32), 142 141 GFP_KERNEL); 143 142 if (!levels) 144 143 return -ENOMEM;
+1 -1
drivers/video/backlight/lp855x_bl.c
··· 22 22 #define LP855X_DEVICE_CTRL 0x01 23 23 #define LP855X_EEPROM_START 0xA0 24 24 #define LP855X_EEPROM_END 0xA7 25 - #define LP8556_EPROM_START 0xA0 25 + #define LP8556_EPROM_START 0x98 26 26 #define LP8556_EPROM_END 0xAF 27 27 28 28 /* LP8555/7 Registers */
+7 -7
drivers/video/backlight/mp3309c.c
··· 222 222 if (IS_ERR(chip->pwmd)) 223 223 return dev_err_probe(dev, PTR_ERR(chip->pwmd), "error getting pwm data\n"); 224 224 pdata->dimming_mode = DIMMING_PWM; 225 - pwm_apply_args(chip->pwmd); 226 225 } 227 226 228 227 /* ··· 352 353 chip->pdata = pdata; 353 354 354 355 /* Backlight properties */ 355 - memset(&props, 0, sizeof(struct backlight_properties)); 356 - props.brightness = pdata->default_brightness; 357 - props.max_brightness = pdata->max_brightness; 358 - props.scale = BACKLIGHT_SCALE_LINEAR; 359 - props.type = BACKLIGHT_RAW; 360 - props.power = BACKLIGHT_POWER_ON; 356 + props = (typeof(props)){ 357 + .brightness = pdata->default_brightness, 358 + .max_brightness = pdata->max_brightness, 359 + .scale = BACKLIGHT_SCALE_LINEAR, 360 + .type = BACKLIGHT_RAW, 361 + .power = BACKLIGHT_POWER_ON, 362 + }; 361 363 chip->bl = devm_backlight_device_register(dev, "mp3309c", dev, chip, 362 364 &mp3309c_bl_ops, &props); 363 365 if (IS_ERR(chip->bl))
+2
drivers/video/backlight/rave-sp-backlight.c
··· 9 9 10 10 #include <linux/backlight.h> 11 11 #include <linux/kernel.h> 12 + #include <linux/mod_devicetable.h> 12 13 #include <linux/module.h> 13 14 #include <linux/mfd/rave-sp.h> 15 + #include <linux/of.h> 14 16 #include <linux/platform_device.h> 15 17 16 18 #define RAVE_SP_BACKLIGHT_LCD_EN BIT(7)
+1
drivers/video/backlight/rt4831-backlight.c
··· 4 4 #include <linux/backlight.h> 5 5 #include <linux/bitops.h> 6 6 #include <linux/kernel.h> 7 + #include <linux/mod_devicetable.h> 7 8 #include <linux/module.h> 8 9 #include <linux/platform_device.h> 9 10 #include <linux/property.h>