backlight: Convert from struct class_device to struct device
Subsystems (4)
PATCH 1/1 backlight: Convert from struct class_device to struct device
Convert the backlight and LCD classes from struct class_device to struct device since class_device is scheduled for removal.
One nasty API break is the backlight power attribute has had to be renamed to bl_power and the LCD power attribute has had to be renamed to lcd_power since the original names clash with the core. I can't see a way around this.
[I've applied this patch to the backlight for-mm branch for testing but will work in any feedback]
drivers/acpi/video.c | 4 -
drivers/usb/misc/appledisplay.c | 4 - drivers/video/aty/aty128fb.c | 2 drivers/video/aty/atyfb_base.c | 2 drivers/video/aty/radeon_backlight.c | 4 - drivers/video/backlight/backlight.c | 125 ++++++++++++++--------------------- drivers/video/backlight/cr_bllcd.c | 2 drivers/video/backlight/lcd.c | 113 ++++++++++++++----------------- drivers/video/nvidia/nv_backlight.c | 2 drivers/video/riva/fbdev.c | 2 include/linux/backlight.h | 11 ++- include/linux/lcd.h | 14 ++- 12 files changed, 133 insertions(+), 152 deletions(-)
drivers/acpi/video.c +2 -2
@@ -278,7 +278,7 @@ static int acpi_video_get_brightness(struct backlight_device *bd) {unsigned long cur_level;struct acpi_video_device *vd = - (struct acpi_video_device *)class_get_devdata (&bd->class_dev); + (struct acpi_video_device *)bl_get_data (bd);acpi_video_device_lcd_get_level_current (vd, &cur_level);return (int ) cur_level; }
@@ -287,7 +287,7 @@ static int acpi_video_set_brightness(struct backlight_device *bd) {int request_level = bd->props.brightness;struct acpi_video_device *vd = - (struct acpi_video_device *)class_get_devdata (&bd->class_dev); + (struct acpi_video_device *)bl_get_data (bd);acpi_video_device_lcd_set_level (vd, request_level);return 0 ; }
drivers/usb/misc/appledisplay.c +2 -2
@@ -137,7 +137,7 @@ exit:static int appledisplay_bl_update_status (struct backlight_device *bd) { -struct appledisplay *pdata =class_get_devdata (&bd->class_dev); +struct appledisplay *pdata =bl_get_data (bd);int retval; pdata->msgdata[0 ] =0x10 ;
@@ -158,7 +158,7 @@ static int appledisplay_bl_update_status(struct backlight_device *bd)static int appledisplay_bl_get_brightness (struct backlight_device *bd) { -struct appledisplay *pdata =class_get_devdata (&bd->class_dev); +struct appledisplay *pdata =bl_get_data (bd);int retval; retval = usb_control_msg(
drivers/video/aty/aty128fb.c +1 -1
@@ -1733,7 +1733,7 @@ static int aty128_bl_get_level_brightness(struct aty128fb_par *par,static int aty128_bl_update_status (struct backlight_device *bd) { -struct aty128fb_par *par =class_get_devdata (&bd->class_dev); +struct aty128fb_par *par =bl_get_data (bd);unsigned int reg =aty_ld_le32 (LVDS_GEN_CNTL );int level;
drivers/video/aty/atyfb_base.c +1 -1
@@ -2141,7 +2141,7 @@ static int aty_bl_get_level_brightness(struct atyfb_par *par, int level)static int aty_bl_update_status (struct backlight_device *bd) { -struct atyfb_par *par =class_get_devdata (&bd->class_dev); +struct atyfb_par *par =bl_get_data (bd);unsigned int reg =aty_ld_lcd (LCD_MISC_CNTL , par);int level;
drivers/video/aty/radeon_backlight.c +2 -2
@@ -47,7 +47,7 @@ static int radeon_bl_get_level_brightness(struct radeon_bl_privdata *pdata,static int radeon_bl_update_status (struct backlight_device *bd) { -struct radeon_bl_privdata *pdata =class_get_devdata (&bd->class_dev); +struct radeon_bl_privdata *pdata =bl_get_data (bd);struct radeonfb_info *rinfo = pdata->rinfo;u32 lvds_gen_cntl, tmpPixclksCntl;int level;
@@ -206,7 +206,7 @@ void radeonfb_bl_exit(struct radeonfb_info *rinfo)if (bd) {struct radeon_bl_privdata *pdata; - pdata =class_get_devdata (&bd->class_dev); + pdata =bl_get_data (bd);backlight_device_unregister (bd);kfree (pdata); rinfo->info->bl_dev =NULL ;
drivers/video/backlight/backlight.c +53 -72
238 lines not on this page · raw message
drivers/video/backlight/cr_bllcd.c +1 -1
@@ -202,7 +202,7 @@ static int cr_backlight_probe(struct platform_device *pdev) } crp->cr_lcd_device =lcd_device_register ("cr-lcd" , - &pdev->dev, + &pdev->dev,NULL &cr_lcd_ops);if (IS_ERR (crp->cr_lcd_device)) {
drivers/video/backlight/lcd.c +51 -62
214 lines not on this page · raw message
drivers/video/nvidia/nv_backlight.c +1 -1
@@ -50,7 +50,7 @@ static int nvidia_bl_get_level_brightness(struct nvidia_par *par,static int nvidia_bl_update_status (struct backlight_device *bd) { -struct nvidia_par *par =class_get_devdata (&bd->class_dev); +struct nvidia_par *par =bl_get_data (bd);u32 tmp_pcrt, tmp_pmc, fpcontrol;int level;
drivers/video/riva/fbdev.c +1 -1
@@ -307,7 +307,7 @@ static int riva_bl_get_level_brightness(struct riva_par *par,static int riva_bl_update_status (struct backlight_device *bd) { -struct riva_par *par =class_get_devdata (&bd->class_dev); +struct riva_par *par =bl_get_data (bd);U032 tmp_pcrt, tmp_pmc;int level;
include/linux/backlight.h +8 -3
@@ -69,8 +69,8 @@ struct backlight_device {/* The framebuffer notifier block */ struct notifier_block fb_notif; -/* The class device structure */ -struct class_device class_dev; + +struct device dev; };static inline void backlight_update_status (struct backlight_device *bd)
@@ -85,6 +85,11 @@ extern struct backlight_device *backlight_device_register(const char *name, struct device *dev, void *devdata, struct backlight_ops *ops);extern void backlight_device_unregister (struct backlight_device *bd); -#define to_backlight_device (obj) container_of(obj, struct backlight_device, class_dev) +#define to_backlight_device (obj) container_of(obj, struct backlight_device, dev) + +static inline void *bl_get_data (struct backlight_device *bl_dev) +{ +return dev_get_drvdata (&bl_dev->dev); +}#endif
include/linux/lcd.h +10 -4
@@ -62,8 +62,8 @@ struct lcd_device {struct mutex update_lock;/* The framebuffer notifier block */ struct notifier_block fb_notif; -/* The class device structure */ -struct class_device class_dev; + +struct device dev; };static inline void lcd_set_power (struct lcd_device *ld,int power)
@@ -75,9 +75,15 @@ static inline void lcd_set_power(struct lcd_device *ld, int power) }extern struct lcd_device *lcd_device_register (const char *name, -void *devdata,struct lcd_ops *ops); +struct device *parent,void *devdata,struct lcd_ops *ops);extern void lcd_device_unregister (struct lcd_device *ld); -#define to_lcd_device (obj) container_of(obj, struct lcd_device, class_dev) +#define to_lcd_device (obj) container_of(obj, struct lcd_device, dev) + +static inline void *lcd_get_data (struct lcd_device *ld_dev) +{ +return dev_get_drvdata (&ld_dev->dev); +} +#endif
Quoted 8 lines · Richard Purdie
Convert the backlight and LCD classes from struct
class_deviceto struct device sinceclass_deviceis scheduled for removal.One nasty API break is the backlight power attribute has had to be renamed to
bl_powerand the LCD power attribute has had to be renamed tolcd_powersince the original names clash with the core. I can't see a way around this.
Quoted 4 lines
Signed-off-by Richard Purdie <[email protected]>[I've applied this patch to the backlight for-mm branch for testing but will work in any feedback]