Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight

* 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight:
leds: cr_bllcd.c: build fix
backlight: Convert from struct class_device to struct device
backlight: Fix order of Kconfig entries

+149 -163
+2 -2
drivers/acpi/video.c
··· 284 284 { 285 285 unsigned long cur_level; 286 286 struct acpi_video_device *vd = 287 - (struct acpi_video_device *)class_get_devdata(&bd->class_dev); 287 + (struct acpi_video_device *)bl_get_data(bd); 288 288 acpi_video_device_lcd_get_level_current(vd, &cur_level); 289 289 return (int) cur_level; 290 290 } ··· 293 293 { 294 294 int request_level = bd->props.brightness; 295 295 struct acpi_video_device *vd = 296 - (struct acpi_video_device *)class_get_devdata(&bd->class_dev); 296 + (struct acpi_video_device *)bl_get_data(bd); 297 297 acpi_video_device_lcd_set_level(vd, request_level); 298 298 return 0; 299 299 }
+2 -2
drivers/usb/misc/appledisplay.c
··· 138 138 139 139 static int appledisplay_bl_update_status(struct backlight_device *bd) 140 140 { 141 - struct appledisplay *pdata = class_get_devdata(&bd->class_dev); 141 + struct appledisplay *pdata = bl_get_data(bd); 142 142 int retval; 143 143 144 144 pdata->msgdata[0] = 0x10; ··· 159 159 160 160 static int appledisplay_bl_get_brightness(struct backlight_device *bd) 161 161 { 162 - struct appledisplay *pdata = class_get_devdata(&bd->class_dev); 162 + struct appledisplay *pdata = bl_get_data(bd); 163 163 int retval; 164 164 165 165 retval = usb_control_msg(
+1 -1
drivers/video/aty/aty128fb.c
··· 1733 1733 1734 1734 static int aty128_bl_update_status(struct backlight_device *bd) 1735 1735 { 1736 - struct aty128fb_par *par = class_get_devdata(&bd->class_dev); 1736 + struct aty128fb_par *par = bl_get_data(bd); 1737 1737 unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); 1738 1738 int level; 1739 1739
+1 -1
drivers/video/aty/atyfb_base.c
··· 2141 2141 2142 2142 static int aty_bl_update_status(struct backlight_device *bd) 2143 2143 { 2144 - struct atyfb_par *par = class_get_devdata(&bd->class_dev); 2144 + struct atyfb_par *par = bl_get_data(bd); 2145 2145 unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par); 2146 2146 int level; 2147 2147
+2 -2
drivers/video/aty/radeon_backlight.c
··· 47 47 48 48 static int radeon_bl_update_status(struct backlight_device *bd) 49 49 { 50 - struct radeon_bl_privdata *pdata = class_get_devdata(&bd->class_dev); 50 + struct radeon_bl_privdata *pdata = bl_get_data(bd); 51 51 struct radeonfb_info *rinfo = pdata->rinfo; 52 52 u32 lvds_gen_cntl, tmpPixclksCntl; 53 53 int level; ··· 206 206 if (bd) { 207 207 struct radeon_bl_privdata *pdata; 208 208 209 - pdata = class_get_devdata(&bd->class_dev); 209 + pdata = bl_get_data(bd); 210 210 backlight_device_unregister(bd); 211 211 kfree(pdata); 212 212 rinfo->info->bl_dev = NULL;
+17 -11
drivers/video/backlight/Kconfig
··· 8 8 Enable this to be able to choose the drivers for controlling the 9 9 backlight and the LCD panel on some platforms, for example on PDAs. 10 10 11 - config BACKLIGHT_CLASS_DEVICE 12 - tristate "Lowlevel Backlight controls" 13 - depends on BACKLIGHT_LCD_SUPPORT 14 - default m 15 - help 16 - This framework adds support for low-level control of the LCD 17 - backlight. This includes support for brightness and power. 18 - 19 - To have support for your specific LCD panel you will have to 20 - select the proper drivers which depend on this option. 21 - 11 + # 12 + # LCD 13 + # 22 14 config LCD_CLASS_DEVICE 23 15 tristate "Lowlevel LCD controls" 24 16 depends on BACKLIGHT_LCD_SUPPORT ··· 20 28 Some framebuffer devices connect to platform-specific LCD modules 21 29 in order to have a platform-specific way to control the flat panel 22 30 (contrast and applying power to the LCD (not to the backlight!)). 31 + 32 + To have support for your specific LCD panel you will have to 33 + select the proper drivers which depend on this option. 34 + 35 + # 36 + # Backlight 37 + # 38 + config BACKLIGHT_CLASS_DEVICE 39 + tristate "Lowlevel Backlight controls" 40 + depends on BACKLIGHT_LCD_SUPPORT 41 + default m 42 + help 43 + This framework adds support for low-level control of the LCD 44 + backlight. This includes support for brightness and power. 23 45 24 46 To have support for your specific LCD panel you will have to 25 47 select the proper drivers which depend on this option.
+53 -72
drivers/video/backlight/backlight.c
··· 69 69 } 70 70 #endif /* CONFIG_FB */ 71 71 72 - static ssize_t backlight_show_power(struct class_device *cdev, char *buf) 72 + static ssize_t backlight_show_power(struct device *dev, 73 + struct device_attribute *attr,char *buf) 73 74 { 74 - struct backlight_device *bd = to_backlight_device(cdev); 75 + struct backlight_device *bd = to_backlight_device(dev); 75 76 76 77 return sprintf(buf, "%d\n", bd->props.power); 77 78 } 78 79 79 - static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count) 80 + static ssize_t backlight_store_power(struct device *dev, 81 + struct device_attribute *attr, const char *buf, size_t count) 80 82 { 81 83 int rc = -ENXIO; 82 84 char *endp; 83 - struct backlight_device *bd = to_backlight_device(cdev); 85 + struct backlight_device *bd = to_backlight_device(dev); 84 86 int power = simple_strtoul(buf, &endp, 0); 85 87 size_t size = endp - buf; 86 88 ··· 103 101 return rc; 104 102 } 105 103 106 - static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf) 104 + static ssize_t backlight_show_brightness(struct device *dev, 105 + struct device_attribute *attr, char *buf) 107 106 { 108 - struct backlight_device *bd = to_backlight_device(cdev); 107 + struct backlight_device *bd = to_backlight_device(dev); 109 108 110 109 return sprintf(buf, "%d\n", bd->props.brightness); 111 110 } 112 111 113 - static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count) 112 + static ssize_t backlight_store_brightness(struct device *dev, 113 + struct device_attribute *attr, const char *buf, size_t count) 114 114 { 115 115 int rc = -ENXIO; 116 116 char *endp; 117 - struct backlight_device *bd = to_backlight_device(cdev); 117 + struct backlight_device *bd = to_backlight_device(dev); 118 118 int brightness = simple_strtoul(buf, &endp, 0); 119 119 size_t size = endp - buf; 120 120 ··· 142 138 return rc; 143 139 } 144 140 145 - static ssize_t backlight_show_max_brightness(struct class_device *cdev, char *buf) 141 + static ssize_t backlight_show_max_brightness(struct device *dev, 142 + struct device_attribute *attr, char *buf) 146 143 { 147 - struct backlight_device *bd = to_backlight_device(cdev); 144 + struct backlight_device *bd = to_backlight_device(dev); 148 145 149 146 return sprintf(buf, "%d\n", bd->props.max_brightness); 150 147 } 151 148 152 - static ssize_t backlight_show_actual_brightness(struct class_device *cdev, 153 - char *buf) 149 + static ssize_t backlight_show_actual_brightness(struct device *dev, 150 + struct device_attribute *attr, char *buf) 154 151 { 155 152 int rc = -ENXIO; 156 - struct backlight_device *bd = to_backlight_device(cdev); 153 + struct backlight_device *bd = to_backlight_device(dev); 157 154 158 155 mutex_lock(&bd->ops_lock); 159 156 if (bd->ops && bd->ops->get_brightness) ··· 164 159 return rc; 165 160 } 166 161 167 - static void backlight_class_release(struct class_device *dev) 162 + struct class *backlight_class; 163 + 164 + static void bl_device_release(struct device *dev) 168 165 { 169 166 struct backlight_device *bd = to_backlight_device(dev); 170 167 kfree(bd); 171 168 } 172 169 173 - static struct class backlight_class = { 174 - .name = "backlight", 175 - .release = backlight_class_release, 176 - }; 177 - 178 - #define DECLARE_ATTR(_name,_mode,_show,_store) \ 179 - { \ 180 - .attr = { .name = __stringify(_name), .mode = _mode }, \ 181 - .show = _show, \ 182 - .store = _store, \ 183 - } 184 - 185 - static const struct class_device_attribute bl_class_device_attributes[] = { 186 - DECLARE_ATTR(power, 0644, backlight_show_power, backlight_store_power), 187 - DECLARE_ATTR(brightness, 0644, backlight_show_brightness, 170 + static struct device_attribute bl_device_attributes[] = { 171 + __ATTR(bl_power, 0644, backlight_show_power, backlight_store_power), 172 + __ATTR(brightness, 0644, backlight_show_brightness, 188 173 backlight_store_brightness), 189 - DECLARE_ATTR(actual_brightness, 0444, backlight_show_actual_brightness, 174 + __ATTR(actual_brightness, 0444, backlight_show_actual_brightness, 190 175 NULL), 191 - DECLARE_ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL), 176 + __ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL), 177 + __ATTR_NULL, 192 178 }; 193 179 194 180 /** ··· 187 191 * backlight_device class. 188 192 * @name: the name of the new object(must be the same as the name of the 189 193 * respective framebuffer device). 190 - * @devdata: an optional pointer to be stored in the class_device. The 191 - * methods may retrieve it by using class_get_devdata(&bd->class_dev). 194 + * @devdata: an optional pointer to be stored for private driver use. The 195 + * methods may retrieve it by using bl_get_data(bd). 192 196 * @ops: the backlight operations structure. 193 197 * 194 - * Creates and registers new backlight class_device. Returns either an 198 + * Creates and registers new backlight device. Returns either an 195 199 * ERR_PTR() or a pointer to the newly allocated device. 196 200 */ 197 201 struct backlight_device *backlight_device_register(const char *name, 198 - struct device *dev, 199 - void *devdata, 200 - struct backlight_ops *ops) 202 + struct device *parent, void *devdata, struct backlight_ops *ops) 201 203 { 202 - int i, rc; 203 204 struct backlight_device *new_bd; 205 + int rc; 204 206 205 - pr_debug("backlight_device_alloc: name=%s\n", name); 207 + pr_debug("backlight_device_register: name=%s\n", name); 206 208 207 209 new_bd = kzalloc(sizeof(struct backlight_device), GFP_KERNEL); 208 210 if (!new_bd) ··· 208 214 209 215 mutex_init(&new_bd->update_lock); 210 216 mutex_init(&new_bd->ops_lock); 211 - new_bd->ops = ops; 212 - new_bd->class_dev.class = &backlight_class; 213 - new_bd->class_dev.dev = dev; 214 - strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN); 215 - class_set_devdata(&new_bd->class_dev, devdata); 216 217 217 - rc = class_device_register(&new_bd->class_dev); 218 + new_bd->dev.class = backlight_class; 219 + new_bd->dev.parent = parent; 220 + new_bd->dev.release = bl_device_release; 221 + strlcpy(new_bd->dev.bus_id, name, BUS_ID_SIZE); 222 + dev_set_drvdata(&new_bd->dev, devdata); 223 + 224 + rc = device_register(&new_bd->dev); 218 225 if (rc) { 219 226 kfree(new_bd); 220 227 return ERR_PTR(rc); ··· 223 228 224 229 rc = backlight_register_fb(new_bd); 225 230 if (rc) { 226 - class_device_unregister(&new_bd->class_dev); 231 + device_unregister(&new_bd->dev); 227 232 return ERR_PTR(rc); 228 233 } 229 234 230 - 231 - for (i = 0; i < ARRAY_SIZE(bl_class_device_attributes); i++) { 232 - rc = class_device_create_file(&new_bd->class_dev, 233 - &bl_class_device_attributes[i]); 234 - if (rc) { 235 - while (--i >= 0) 236 - class_device_remove_file(&new_bd->class_dev, 237 - &bl_class_device_attributes[i]); 238 - class_device_unregister(&new_bd->class_dev); 239 - /* No need to kfree(new_bd) since release() method was called */ 240 - return ERR_PTR(rc); 241 - } 242 - } 235 + new_bd->ops = ops; 243 236 244 237 #ifdef CONFIG_PMAC_BACKLIGHT 245 238 mutex_lock(&pmac_backlight_mutex); ··· 248 265 */ 249 266 void backlight_device_unregister(struct backlight_device *bd) 250 267 { 251 - int i; 252 - 253 268 if (!bd) 254 269 return; 255 - 256 - pr_debug("backlight_device_unregister: name=%s\n", bd->class_dev.class_id); 257 270 258 271 #ifdef CONFIG_PMAC_BACKLIGHT 259 272 mutex_lock(&pmac_backlight_mutex); ··· 257 278 pmac_backlight = NULL; 258 279 mutex_unlock(&pmac_backlight_mutex); 259 280 #endif 260 - 261 - for (i = 0; i < ARRAY_SIZE(bl_class_device_attributes); i++) 262 - class_device_remove_file(&bd->class_dev, 263 - &bl_class_device_attributes[i]); 264 - 265 281 mutex_lock(&bd->ops_lock); 266 282 bd->ops = NULL; 267 283 mutex_unlock(&bd->ops_lock); 268 284 269 285 backlight_unregister_fb(bd); 270 - 271 - class_device_unregister(&bd->class_dev); 286 + device_unregister(&bd->dev); 272 287 } 273 288 EXPORT_SYMBOL(backlight_device_unregister); 274 289 275 290 static void __exit backlight_class_exit(void) 276 291 { 277 - class_unregister(&backlight_class); 292 + class_destroy(backlight_class); 278 293 } 279 294 280 295 static int __init backlight_class_init(void) 281 296 { 282 - return class_register(&backlight_class); 297 + backlight_class = class_create(THIS_MODULE, "backlight"); 298 + if (IS_ERR(backlight_class)) { 299 + printk(KERN_WARNING "Unable to create backlight class; errno = %ld\n", 300 + PTR_ERR(backlight_class)); 301 + return PTR_ERR(backlight_class); 302 + } 303 + 304 + backlight_class->dev_attrs = bl_device_attributes; 305 + return 0; 283 306 } 284 307 285 308 /*
+1 -1
drivers/video/backlight/cr_bllcd.c
··· 202 202 } 203 203 204 204 crp->cr_lcd_device = lcd_device_register("cr-lcd", 205 - &pdev->dev, 205 + &pdev->dev, NULL, 206 206 &cr_lcd_ops); 207 207 208 208 if (IS_ERR(crp->cr_lcd_device)) {
+50 -62
drivers/video/backlight/lcd.c
··· 61 61 } 62 62 #endif /* CONFIG_FB */ 63 63 64 - static ssize_t lcd_show_power(struct class_device *cdev, char *buf) 64 + static ssize_t lcd_show_power(struct device *dev, struct device_attribute *attr, 65 + char *buf) 65 66 { 66 67 int rc; 67 - struct lcd_device *ld = to_lcd_device(cdev); 68 + struct lcd_device *ld = to_lcd_device(dev); 68 69 69 70 mutex_lock(&ld->ops_lock); 70 71 if (ld->ops && ld->ops->get_power) ··· 77 76 return rc; 78 77 } 79 78 80 - static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count) 79 + static ssize_t lcd_store_power(struct device *dev, 80 + struct device_attribute *attr, const char *buf, size_t count) 81 81 { 82 82 int rc = -ENXIO; 83 83 char *endp; 84 - struct lcd_device *ld = to_lcd_device(cdev); 84 + struct lcd_device *ld = to_lcd_device(dev); 85 85 int power = simple_strtoul(buf, &endp, 0); 86 86 size_t size = endp - buf; 87 87 ··· 102 100 return rc; 103 101 } 104 102 105 - static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) 103 + static ssize_t lcd_show_contrast(struct device *dev, 104 + struct device_attribute *attr, char *buf) 106 105 { 107 106 int rc = -ENXIO; 108 - struct lcd_device *ld = to_lcd_device(cdev); 107 + struct lcd_device *ld = to_lcd_device(dev); 109 108 110 109 mutex_lock(&ld->ops_lock); 111 110 if (ld->ops && ld->ops->get_contrast) ··· 116 113 return rc; 117 114 } 118 115 119 - static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count) 116 + static ssize_t lcd_store_contrast(struct device *dev, 117 + struct device_attribute *attr, const char *buf, size_t count) 120 118 { 121 119 int rc = -ENXIO; 122 120 char *endp; 123 - struct lcd_device *ld = to_lcd_device(cdev); 121 + struct lcd_device *ld = to_lcd_device(dev); 124 122 int contrast = simple_strtoul(buf, &endp, 0); 125 123 size_t size = endp - buf; 126 124 ··· 141 137 return rc; 142 138 } 143 139 144 - static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) 140 + static ssize_t lcd_show_max_contrast(struct device *dev, 141 + struct device_attribute *attr, char *buf) 145 142 { 146 - struct lcd_device *ld = to_lcd_device(cdev); 143 + struct lcd_device *ld = to_lcd_device(dev); 147 144 148 145 return sprintf(buf, "%d\n", ld->props.max_contrast); 149 146 } 150 147 151 - static void lcd_class_release(struct class_device *dev) 148 + struct class *lcd_class; 149 + 150 + static void lcd_device_release(struct device *dev) 152 151 { 153 152 struct lcd_device *ld = to_lcd_device(dev); 154 153 kfree(ld); 155 154 } 156 155 157 - static struct class lcd_class = { 158 - .name = "lcd", 159 - .release = lcd_class_release, 160 - }; 161 - 162 - #define DECLARE_ATTR(_name,_mode,_show,_store) \ 163 - { \ 164 - .attr = { .name = __stringify(_name), .mode = _mode }, \ 165 - .show = _show, \ 166 - .store = _store, \ 167 - } 168 - 169 - static const struct class_device_attribute lcd_class_device_attributes[] = { 170 - DECLARE_ATTR(power, 0644, lcd_show_power, lcd_store_power), 171 - DECLARE_ATTR(contrast, 0644, lcd_show_contrast, lcd_store_contrast), 172 - DECLARE_ATTR(max_contrast, 0444, lcd_show_max_contrast, NULL), 156 + static struct device_attribute lcd_device_attributes[] = { 157 + __ATTR(lcd_power, 0644, lcd_show_power, lcd_store_power), 158 + __ATTR(contrast, 0644, lcd_show_contrast, lcd_store_contrast), 159 + __ATTR(max_contrast, 0444, lcd_show_max_contrast, NULL), 160 + __ATTR_NULL, 173 161 }; 174 162 175 163 /** 176 164 * lcd_device_register - register a new object of lcd_device class. 177 165 * @name: the name of the new object(must be the same as the name of the 178 166 * respective framebuffer device). 179 - * @devdata: an optional pointer to be stored in the class_device. The 180 - * methods may retrieve it by using class_get_devdata(ld->class_dev). 167 + * @devdata: an optional pointer to be stored in the device. The 168 + * methods may retrieve it by using lcd_get_data(ld). 181 169 * @ops: the lcd operations structure. 182 170 * 183 - * Creates and registers a new lcd class_device. Returns either an ERR_PTR() 171 + * Creates and registers a new lcd device. Returns either an ERR_PTR() 184 172 * or a pointer to the newly allocated device. 185 173 */ 186 - struct lcd_device *lcd_device_register(const char *name, void *devdata, 187 - struct lcd_ops *ops) 174 + struct lcd_device *lcd_device_register(const char *name, struct device *parent, 175 + void *devdata, struct lcd_ops *ops) 188 176 { 189 - int i, rc; 190 177 struct lcd_device *new_ld; 178 + int rc; 191 179 192 180 pr_debug("lcd_device_register: name=%s\n", name); 193 181 ··· 189 193 190 194 mutex_init(&new_ld->ops_lock); 191 195 mutex_init(&new_ld->update_lock); 192 - new_ld->ops = ops; 193 - new_ld->class_dev.class = &lcd_class; 194 - strlcpy(new_ld->class_dev.class_id, name, KOBJ_NAME_LEN); 195 - class_set_devdata(&new_ld->class_dev, devdata); 196 196 197 - rc = class_device_register(&new_ld->class_dev); 197 + new_ld->dev.class = lcd_class; 198 + new_ld->dev.parent = parent; 199 + new_ld->dev.release = lcd_device_release; 200 + strlcpy(new_ld->dev.bus_id, name, BUS_ID_SIZE); 201 + dev_set_drvdata(&new_ld->dev, devdata); 202 + 203 + rc = device_register(&new_ld->dev); 198 204 if (rc) { 199 205 kfree(new_ld); 200 206 return ERR_PTR(rc); ··· 204 206 205 207 rc = lcd_register_fb(new_ld); 206 208 if (rc) { 207 - class_device_unregister(&new_ld->class_dev); 209 + device_unregister(&new_ld->dev); 208 210 return ERR_PTR(rc); 209 211 } 210 212 211 - for (i = 0; i < ARRAY_SIZE(lcd_class_device_attributes); i++) { 212 - rc = class_device_create_file(&new_ld->class_dev, 213 - &lcd_class_device_attributes[i]); 214 - if (rc) { 215 - while (--i >= 0) 216 - class_device_remove_file(&new_ld->class_dev, 217 - &lcd_class_device_attributes[i]); 218 - class_device_unregister(&new_ld->class_dev); 219 - /* No need to kfree(new_ld) since release() method was called */ 220 - return ERR_PTR(rc); 221 - } 222 - } 213 + new_ld->ops = ops; 223 214 224 215 return new_ld; 225 216 } ··· 222 235 */ 223 236 void lcd_device_unregister(struct lcd_device *ld) 224 237 { 225 - int i; 226 - 227 238 if (!ld) 228 239 return; 229 - 230 - pr_debug("lcd_device_unregister: name=%s\n", ld->class_dev.class_id); 231 - 232 - for (i = 0; i < ARRAY_SIZE(lcd_class_device_attributes); i++) 233 - class_device_remove_file(&ld->class_dev, 234 - &lcd_class_device_attributes[i]); 235 240 236 241 mutex_lock(&ld->ops_lock); 237 242 ld->ops = NULL; 238 243 mutex_unlock(&ld->ops_lock); 239 244 lcd_unregister_fb(ld); 240 - class_device_unregister(&ld->class_dev); 245 + 246 + device_unregister(&ld->dev); 241 247 } 242 248 EXPORT_SYMBOL(lcd_device_unregister); 243 249 244 250 static void __exit lcd_class_exit(void) 245 251 { 246 - class_unregister(&lcd_class); 252 + class_destroy(lcd_class); 247 253 } 248 254 249 255 static int __init lcd_class_init(void) 250 256 { 251 - return class_register(&lcd_class); 257 + lcd_class = class_create(THIS_MODULE, "lcd"); 258 + if (IS_ERR(lcd_class)) { 259 + printk(KERN_WARNING "Unable to create backlight class; errno = %ld\n", 260 + PTR_ERR(lcd_class)); 261 + return PTR_ERR(lcd_class); 262 + } 263 + 264 + lcd_class->dev_attrs = lcd_device_attributes; 265 + return 0; 252 266 } 253 267 254 268 /*
+1 -1
drivers/video/nvidia/nv_backlight.c
··· 50 50 51 51 static int nvidia_bl_update_status(struct backlight_device *bd) 52 52 { 53 - struct nvidia_par *par = class_get_devdata(&bd->class_dev); 53 + struct nvidia_par *par = bl_get_data(bd); 54 54 u32 tmp_pcrt, tmp_pmc, fpcontrol; 55 55 int level; 56 56
+1 -1
drivers/video/riva/fbdev.c
··· 307 307 308 308 static int riva_bl_update_status(struct backlight_device *bd) 309 309 { 310 - struct riva_par *par = class_get_devdata(&bd->class_dev); 310 + struct riva_par *par = bl_get_data(bd); 311 311 U032 tmp_pcrt, tmp_pmc; 312 312 int level; 313 313
+8 -3
include/linux/backlight.h
··· 69 69 70 70 /* The framebuffer notifier block */ 71 71 struct notifier_block fb_notif; 72 - /* The class device structure */ 73 - struct class_device class_dev; 72 + 73 + struct device dev; 74 74 }; 75 75 76 76 static inline void backlight_update_status(struct backlight_device *bd) ··· 85 85 struct device *dev, void *devdata, struct backlight_ops *ops); 86 86 extern void backlight_device_unregister(struct backlight_device *bd); 87 87 88 - #define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev) 88 + #define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) 89 + 90 + static inline void * bl_get_data(struct backlight_device *bl_dev) 91 + { 92 + return dev_get_drvdata(&bl_dev->dev); 93 + } 89 94 90 95 #endif
+10 -4
include/linux/lcd.h
··· 62 62 struct mutex update_lock; 63 63 /* The framebuffer notifier block */ 64 64 struct notifier_block fb_notif; 65 - /* The class device structure */ 66 - struct class_device class_dev; 65 + 66 + struct device dev; 67 67 }; 68 68 69 69 static inline void lcd_set_power(struct lcd_device *ld, int power) ··· 75 75 } 76 76 77 77 extern struct lcd_device *lcd_device_register(const char *name, 78 - void *devdata, struct lcd_ops *ops); 78 + struct device *parent, void *devdata, struct lcd_ops *ops); 79 79 extern void lcd_device_unregister(struct lcd_device *ld); 80 80 81 - #define to_lcd_device(obj) container_of(obj, struct lcd_device, class_dev) 81 + #define to_lcd_device(obj) container_of(obj, struct lcd_device, dev) 82 + 83 + static inline void * lcd_get_data(struct lcd_device *ld_dev) 84 + { 85 + return dev_get_drvdata(&ld_dev->dev); 86 + } 87 + 82 88 83 89 #endif