diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/asus_acpi.c | 6 | ||||
-rw-r--r-- | drivers/acpi/ibm_acpi.c | 7 | ||||
-rw-r--r-- | drivers/acpi/toshiba_acpi.c | 6 | ||||
-rw-r--r-- | drivers/acpi/video.c | 35 | ||||
-rw-r--r-- | drivers/macintosh/via-pmu-backlight.c | 23 | ||||
-rw-r--r-- | drivers/misc/asus-laptop.c | 16 | ||||
-rw-r--r-- | drivers/misc/msi-laptop.c | 9 | ||||
-rw-r--r-- | drivers/usb/misc/appledisplay.c | 11 | ||||
-rw-r--r-- | drivers/video/aty/aty128fb.c | 20 | ||||
-rw-r--r-- | drivers/video/aty/atyfb_base.c | 18 | ||||
-rw-r--r-- | drivers/video/aty/radeon_backlight.c | 18 | ||||
-rw-r--r-- | drivers/video/backlight/backlight.c | 79 | ||||
-rw-r--r-- | drivers/video/backlight/corgi_bl.c | 16 | ||||
-rw-r--r-- | drivers/video/backlight/hp680_bl.c | 14 | ||||
-rw-r--r-- | drivers/video/backlight/lcd.c | 67 | ||||
-rw-r--r-- | drivers/video/backlight/locomolcd.c | 12 | ||||
-rw-r--r-- | drivers/video/backlight/progear_bl.c | 16 | ||||
-rw-r--r-- | drivers/video/chipsfb.c | 2 | ||||
-rw-r--r-- | drivers/video/nvidia/nv_backlight.c | 18 | ||||
-rw-r--r-- | drivers/video/riva/fbdev.c | 18 |
20 files changed, 186 insertions, 225 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index 906c54f9ba50..b770deab968c 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -848,7 +848,7 @@ out: | |||
848 | 848 | ||
849 | static int set_brightness_status(struct backlight_device *bd) | 849 | static int set_brightness_status(struct backlight_device *bd) |
850 | { | 850 | { |
851 | return set_brightness(bd->props->brightness); | 851 | return set_brightness(bd->props.brightness); |
852 | } | 852 | } |
853 | 853 | ||
854 | static int | 854 | static int |
@@ -1352,10 +1352,9 @@ static int asus_hotk_remove(struct acpi_device *device, int type) | |||
1352 | return 0; | 1352 | return 0; |
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | static struct backlight_properties asus_backlight_data = { | 1355 | static struct backlight_ops asus_backlight_data = { |
1356 | .get_brightness = read_brightness, | 1356 | .get_brightness = read_brightness, |
1357 | .update_status = set_brightness_status, | 1357 | .update_status = set_brightness_status, |
1358 | .max_brightness = 15, | ||
1359 | }; | 1358 | }; |
1360 | 1359 | ||
1361 | static void __exit asus_acpi_exit(void) | 1360 | static void __exit asus_acpi_exit(void) |
@@ -1409,6 +1408,7 @@ static int __init asus_acpi_init(void) | |||
1409 | asus_backlight_device = NULL; | 1408 | asus_backlight_device = NULL; |
1410 | asus_acpi_exit(); | 1409 | asus_acpi_exit(); |
1411 | } | 1410 | } |
1411 | asus_backlight_device->props.max_brightness = 15; | ||
1412 | 1412 | ||
1413 | return 0; | 1413 | return 0; |
1414 | } | 1414 | } |
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index accf4f7da889..4cc534e36e81 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c | |||
@@ -1701,13 +1701,12 @@ static int brightness_write(char *buf) | |||
1701 | 1701 | ||
1702 | static int brightness_update_status(struct backlight_device *bd) | 1702 | static int brightness_update_status(struct backlight_device *bd) |
1703 | { | 1703 | { |
1704 | return brightness_set(bd->props->brightness); | 1704 | return brightness_set(bd->props.brightness); |
1705 | } | 1705 | } |
1706 | 1706 | ||
1707 | static struct backlight_properties ibm_backlight_data = { | 1707 | static struct backlight_ops ibm_backlight_data = { |
1708 | .get_brightness = brightness_get, | 1708 | .get_brightness = brightness_get, |
1709 | .update_status = brightness_update_status, | 1709 | .update_status = brightness_update_status, |
1710 | .max_brightness = 7, | ||
1711 | }; | 1710 | }; |
1712 | 1711 | ||
1713 | static int brightness_init(void) | 1712 | static int brightness_init(void) |
@@ -1719,6 +1718,8 @@ static int brightness_init(void) | |||
1719 | return PTR_ERR(ibm_backlight_device); | 1718 | return PTR_ERR(ibm_backlight_device); |
1720 | } | 1719 | } |
1721 | 1720 | ||
1721 | ibm_backlight_device->props.max_brightness = 7; | ||
1722 | |||
1722 | return 0; | 1723 | return 0; |
1723 | } | 1724 | } |
1724 | 1725 | ||
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index efc3669a84e8..3906d47b9783 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c | |||
@@ -315,7 +315,7 @@ static int set_lcd(int value) | |||
315 | 315 | ||
316 | static int set_lcd_status(struct backlight_device *bd) | 316 | static int set_lcd_status(struct backlight_device *bd) |
317 | { | 317 | { |
318 | return set_lcd(bd->props->brightness); | 318 | return set_lcd(bd->props.brightness); |
319 | } | 319 | } |
320 | 320 | ||
321 | static unsigned long write_lcd(const char *buffer, unsigned long count) | 321 | static unsigned long write_lcd(const char *buffer, unsigned long count) |
@@ -533,10 +533,9 @@ static acpi_status __exit remove_device(void) | |||
533 | return AE_OK; | 533 | return AE_OK; |
534 | } | 534 | } |
535 | 535 | ||
536 | static struct backlight_properties toshiba_backlight_data = { | 536 | static struct backlight_ops toshiba_backlight_data = { |
537 | .get_brightness = get_lcd, | 537 | .get_brightness = get_lcd, |
538 | .update_status = set_lcd_status, | 538 | .update_status = set_lcd_status, |
539 | .max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1, | ||
540 | }; | 539 | }; |
541 | 540 | ||
542 | static void __exit toshiba_acpi_exit(void) | 541 | static void __exit toshiba_acpi_exit(void) |
@@ -596,6 +595,7 @@ static int __init toshiba_acpi_init(void) | |||
596 | toshiba_backlight_device = NULL; | 595 | toshiba_backlight_device = NULL; |
597 | toshiba_acpi_exit(); | 596 | toshiba_acpi_exit(); |
598 | } | 597 | } |
598 | toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; | ||
599 | 599 | ||
600 | return (ACPI_SUCCESS(status)) ? 0 : -ENODEV; | 600 | return (ACPI_SUCCESS(status)) ? 0 : -ENODEV; |
601 | } | 601 | } |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 75e422bd926a..0771b434feb2 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -169,7 +169,6 @@ struct acpi_video_device { | |||
169 | struct acpi_device *dev; | 169 | struct acpi_device *dev; |
170 | struct acpi_video_device_brightness *brightness; | 170 | struct acpi_video_device_brightness *brightness; |
171 | struct backlight_device *backlight; | 171 | struct backlight_device *backlight; |
172 | struct backlight_properties *data; | ||
173 | }; | 172 | }; |
174 | 173 | ||
175 | /* bus */ | 174 | /* bus */ |
@@ -286,13 +285,18 @@ static int acpi_video_get_brightness(struct backlight_device *bd) | |||
286 | 285 | ||
287 | static int acpi_video_set_brightness(struct backlight_device *bd) | 286 | static int acpi_video_set_brightness(struct backlight_device *bd) |
288 | { | 287 | { |
289 | int request_level = bd->props->brightness; | 288 | int request_level = bd->props.brightness; |
290 | struct acpi_video_device *vd = | 289 | struct acpi_video_device *vd = |
291 | (struct acpi_video_device *)class_get_devdata(&bd->class_dev); | 290 | (struct acpi_video_device *)class_get_devdata(&bd->class_dev); |
292 | acpi_video_device_lcd_set_level(vd, request_level); | 291 | acpi_video_device_lcd_set_level(vd, request_level); |
293 | return 0; | 292 | return 0; |
294 | } | 293 | } |
295 | 294 | ||
295 | static struct backlight_ops acpi_backlight_ops = { | ||
296 | .get_brightness = acpi_video_get_brightness, | ||
297 | .update_status = acpi_video_set_brightness, | ||
298 | }; | ||
299 | |||
296 | /* -------------------------------------------------------------------------- | 300 | /* -------------------------------------------------------------------------- |
297 | Video Management | 301 | Video Management |
298 | -------------------------------------------------------------------------- */ | 302 | -------------------------------------------------------------------------- */ |
@@ -608,30 +612,18 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
608 | unsigned long tmp; | 612 | unsigned long tmp; |
609 | static int count = 0; | 613 | static int count = 0; |
610 | char *name; | 614 | char *name; |
611 | struct backlight_properties *acpi_video_data; | ||
612 | |||
613 | name = kzalloc(MAX_NAME_LEN, GFP_KERNEL); | 615 | name = kzalloc(MAX_NAME_LEN, GFP_KERNEL); |
614 | if (!name) | 616 | if (!name) |
615 | return; | 617 | return; |
616 | 618 | ||
617 | acpi_video_data = kzalloc( | ||
618 | sizeof(struct backlight_properties), | ||
619 | GFP_KERNEL); | ||
620 | if (!acpi_video_data){ | ||
621 | kfree(name); | ||
622 | return; | ||
623 | } | ||
624 | acpi_video_data->get_brightness = | ||
625 | acpi_video_get_brightness; | ||
626 | acpi_video_data->update_status = | ||
627 | acpi_video_set_brightness; | ||
628 | sprintf(name, "acpi_video%d", count++); | 619 | sprintf(name, "acpi_video%d", count++); |
629 | device->data = acpi_video_data; | ||
630 | acpi_video_data->max_brightness = max_level; | ||
631 | acpi_video_device_lcd_get_level_current(device, &tmp); | 620 | acpi_video_device_lcd_get_level_current(device, &tmp); |
632 | acpi_video_data->brightness = (int)tmp; | ||
633 | device->backlight = backlight_device_register(name, | 621 | device->backlight = backlight_device_register(name, |
634 | NULL, device, acpi_video_data); | 622 | NULL, device, &acpi_backlight_ops); |
623 | device->backlight->props.max_brightness = max_level; | ||
624 | device->backlight->props.brightness = (int)tmp; | ||
625 | backlight_update_status(device->backlight); | ||
626 | |||
635 | kfree(name); | 627 | kfree(name); |
636 | } | 628 | } |
637 | return; | 629 | return; |
@@ -1676,10 +1668,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
1676 | status = acpi_remove_notify_handler(device->dev->handle, | 1668 | status = acpi_remove_notify_handler(device->dev->handle, |
1677 | ACPI_DEVICE_NOTIFY, | 1669 | ACPI_DEVICE_NOTIFY, |
1678 | acpi_video_device_notify); | 1670 | acpi_video_device_notify); |
1679 | if (device->backlight){ | 1671 | backlight_device_unregister(device->backlight); |
1680 | backlight_device_unregister(device->backlight); | ||
1681 | kfree(device->data); | ||
1682 | } | ||
1683 | return 0; | 1672 | return 0; |
1684 | } | 1673 | } |
1685 | 1674 | ||
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c index 9f9d03127978..7e27071746e4 100644 --- a/drivers/macintosh/via-pmu-backlight.c +++ b/drivers/macintosh/via-pmu-backlight.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #define MAX_PMU_LEVEL 0xFF | 16 | #define MAX_PMU_LEVEL 0xFF |
17 | 17 | ||
18 | static struct backlight_properties pmu_backlight_data; | 18 | static struct backlight_ops pmu_backlight_data; |
19 | static DEFINE_SPINLOCK(pmu_backlight_lock); | 19 | static DEFINE_SPINLOCK(pmu_backlight_lock); |
20 | static int sleeping; | 20 | static int sleeping; |
21 | static u8 bl_curve[FB_BACKLIGHT_LEVELS]; | 21 | static u8 bl_curve[FB_BACKLIGHT_LEVELS]; |
@@ -72,7 +72,7 @@ static int pmu_backlight_update_status(struct backlight_device *bd) | |||
72 | { | 72 | { |
73 | struct adb_request req; | 73 | struct adb_request req; |
74 | unsigned long flags; | 74 | unsigned long flags; |
75 | int level = bd->props->brightness; | 75 | int level = bd->props.brightness; |
76 | 76 | ||
77 | spin_lock_irqsave(&pmu_backlight_lock, flags); | 77 | spin_lock_irqsave(&pmu_backlight_lock, flags); |
78 | 78 | ||
@@ -80,8 +80,8 @@ static int pmu_backlight_update_status(struct backlight_device *bd) | |||
80 | if (sleeping) | 80 | if (sleeping) |
81 | goto out; | 81 | goto out; |
82 | 82 | ||
83 | if (bd->props->power != FB_BLANK_UNBLANK || | 83 | if (bd->props.power != FB_BLANK_UNBLANK || |
84 | bd->props->fb_blank != FB_BLANK_UNBLANK) | 84 | bd->props.fb_blank != FB_BLANK_UNBLANK) |
85 | level = 0; | 85 | level = 0; |
86 | 86 | ||
87 | if (level > 0) { | 87 | if (level > 0) { |
@@ -107,13 +107,13 @@ out: | |||
107 | 107 | ||
108 | static int pmu_backlight_get_brightness(struct backlight_device *bd) | 108 | static int pmu_backlight_get_brightness(struct backlight_device *bd) |
109 | { | 109 | { |
110 | return bd->props->brightness; | 110 | return bd->props.brightness; |
111 | } | 111 | } |
112 | 112 | ||
113 | static struct backlight_properties pmu_backlight_data = { | 113 | static struct backlight_ops pmu_backlight_data = { |
114 | .get_brightness = pmu_backlight_get_brightness, | 114 | .get_brightness = pmu_backlight_get_brightness, |
115 | .update_status = pmu_backlight_update_status, | 115 | .update_status = pmu_backlight_update_status, |
116 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | 116 | |
117 | }; | 117 | }; |
118 | 118 | ||
119 | #ifdef CONFIG_PM | 119 | #ifdef CONFIG_PM |
@@ -151,9 +151,10 @@ void __init pmu_backlight_init() | |||
151 | printk("pmubl: Backlight registration failed\n"); | 151 | printk("pmubl: Backlight registration failed\n"); |
152 | goto error; | 152 | goto error; |
153 | } | 153 | } |
154 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | ||
154 | pmu_backlight_init_curve(0x7F, 0x46, 0x0E); | 155 | pmu_backlight_init_curve(0x7F, 0x46, 0x0E); |
155 | 156 | ||
156 | level = pmu_backlight_data.max_brightness; | 157 | level = bd->props.max_brightness; |
157 | 158 | ||
158 | if (autosave) { | 159 | if (autosave) { |
159 | /* read autosaved value if available */ | 160 | /* read autosaved value if available */ |
@@ -163,11 +164,11 @@ void __init pmu_backlight_init() | |||
163 | 164 | ||
164 | level = pmu_backlight_curve_lookup( | 165 | level = pmu_backlight_curve_lookup( |
165 | (req.reply[0] >> 4) * | 166 | (req.reply[0] >> 4) * |
166 | pmu_backlight_data.max_brightness / 15); | 167 | bd->props.max_brightness / 15); |
167 | } | 168 | } |
168 | 169 | ||
169 | bd->props->brightness = level; | 170 | bd->props.brightness = level; |
170 | bd->props->power = FB_BLANK_UNBLANK; | 171 | bd->props.power = FB_BLANK_UNBLANK; |
171 | backlight_update_status(bd); | 172 | backlight_update_status(bd); |
172 | 173 | ||
173 | printk("pmubl: Backlight initialized (%s)\n", name); | 174 | printk("pmubl: Backlight initialized (%s)\n", name); |
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index 7ace5b9a3d28..295e931c0dfb 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/misc/asus-laptop.c | |||
@@ -195,10 +195,9 @@ static struct backlight_device *asus_backlight_device; | |||
195 | */ | 195 | */ |
196 | static int read_brightness(struct backlight_device *bd); | 196 | static int read_brightness(struct backlight_device *bd); |
197 | static int update_bl_status(struct backlight_device *bd); | 197 | static int update_bl_status(struct backlight_device *bd); |
198 | static struct backlight_properties asusbl_data = { | 198 | static struct backlight_ops asusbl_ops = { |
199 | .get_brightness = read_brightness, | 199 | .get_brightness = read_brightness, |
200 | .update_status = update_bl_status, | 200 | .update_status = update_bl_status, |
201 | .max_brightness = 15, | ||
202 | }; | 201 | }; |
203 | 202 | ||
204 | /* These functions actually update the LED's, and are called from a | 203 | /* These functions actually update the LED's, and are called from a |
@@ -348,7 +347,7 @@ static void lcd_blank(int blank) | |||
348 | struct backlight_device *bd = asus_backlight_device; | 347 | struct backlight_device *bd = asus_backlight_device; |
349 | 348 | ||
350 | if (bd) { | 349 | if (bd) { |
351 | bd->props->power = blank; | 350 | bd->props.power = blank; |
352 | backlight_update_status(bd); | 351 | backlight_update_status(bd); |
353 | } | 352 | } |
354 | } | 353 | } |
@@ -381,13 +380,13 @@ static int set_brightness(struct backlight_device *bd, int value) | |||
381 | static int update_bl_status(struct backlight_device *bd) | 380 | static int update_bl_status(struct backlight_device *bd) |
382 | { | 381 | { |
383 | int rv; | 382 | int rv; |
384 | int value = bd->props->brightness; | 383 | int value = bd->props.brightness; |
385 | 384 | ||
386 | rv = set_brightness(bd, value); | 385 | rv = set_brightness(bd, value); |
387 | if (rv) | 386 | if (rv) |
388 | return rv; | 387 | return rv; |
389 | 388 | ||
390 | value = (bd->props->power == FB_BLANK_UNBLANK) ? 1 : 0; | 389 | value = (bd->props.power == FB_BLANK_UNBLANK) ? 1 : 0; |
391 | return set_lcd_state(value); | 390 | return set_lcd_state(value); |
392 | } | 391 | } |
393 | 392 | ||
@@ -1013,7 +1012,7 @@ static int asus_backlight_init(struct device *dev) | |||
1013 | 1012 | ||
1014 | if (brightness_set_handle && lcd_switch_handle) { | 1013 | if (brightness_set_handle && lcd_switch_handle) { |
1015 | bd = backlight_device_register(ASUS_HOTK_FILE, dev, | 1014 | bd = backlight_device_register(ASUS_HOTK_FILE, dev, |
1016 | NULL, &asusbl_data); | 1015 | NULL, &asusbl_ops); |
1017 | if (IS_ERR(bd)) { | 1016 | if (IS_ERR(bd)) { |
1018 | printk(ASUS_ERR | 1017 | printk(ASUS_ERR |
1019 | "Could not register asus backlight device\n"); | 1018 | "Could not register asus backlight device\n"); |
@@ -1023,8 +1022,9 @@ static int asus_backlight_init(struct device *dev) | |||
1023 | 1022 | ||
1024 | asus_backlight_device = bd; | 1023 | asus_backlight_device = bd; |
1025 | 1024 | ||
1026 | bd->props->brightness = read_brightness(NULL); | 1025 | bd->props.max_brightness = 15; |
1027 | bd->props->power = FB_BLANK_UNBLANK; | 1026 | bd->props.brightness = read_brightness(NULL); |
1027 | bd->props.power = FB_BLANK_UNBLANK; | ||
1028 | backlight_update_status(bd); | 1028 | backlight_update_status(bd); |
1029 | } | 1029 | } |
1030 | return 0; | 1030 | return 0; |
diff --git a/drivers/misc/msi-laptop.c b/drivers/misc/msi-laptop.c index dd4d92e031b7..68c4b58525ba 100644 --- a/drivers/misc/msi-laptop.c +++ b/drivers/misc/msi-laptop.c | |||
@@ -157,13 +157,12 @@ static int bl_get_brightness(struct backlight_device *b) | |||
157 | 157 | ||
158 | static int bl_update_status(struct backlight_device *b) | 158 | static int bl_update_status(struct backlight_device *b) |
159 | { | 159 | { |
160 | return set_lcd_level(b->props->brightness); | 160 | return set_lcd_level(b->props.brightness); |
161 | } | 161 | } |
162 | 162 | ||
163 | static struct backlight_properties msibl_props = { | 163 | static struct backlight_ops msibl_ops = { |
164 | .get_brightness = bl_get_brightness, | 164 | .get_brightness = bl_get_brightness, |
165 | .update_status = bl_update_status, | 165 | .update_status = bl_update_status, |
166 | .max_brightness = MSI_LCD_LEVEL_MAX-1, | ||
167 | }; | 166 | }; |
168 | 167 | ||
169 | static struct backlight_device *msibl_device; | 168 | static struct backlight_device *msibl_device; |
@@ -317,10 +316,12 @@ static int __init msi_init(void) | |||
317 | /* Register backlight stuff */ | 316 | /* Register backlight stuff */ |
318 | 317 | ||
319 | msibl_device = backlight_device_register("msi-laptop-bl", NULL, NULL, | 318 | msibl_device = backlight_device_register("msi-laptop-bl", NULL, NULL, |
320 | &msibl_props); | 319 | &msibl_ops); |
321 | if (IS_ERR(msibl_device)) | 320 | if (IS_ERR(msibl_device)) |
322 | return PTR_ERR(msibl_device); | 321 | return PTR_ERR(msibl_device); |
323 | 322 | ||
323 | msibl_device->props.max_brightness = MSI_LCD_LEVEL_MAX-1, | ||
324 | |||
324 | ret = platform_driver_register(&msipf_driver); | 325 | ret = platform_driver_register(&msipf_driver); |
325 | if (ret) | 326 | if (ret) |
326 | goto fail_backlight; | 327 | goto fail_backlight; |
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c index cd2c5574cf93..cf70c16f0e3f 100644 --- a/drivers/usb/misc/appledisplay.c +++ b/drivers/usb/misc/appledisplay.c | |||
@@ -141,7 +141,7 @@ static int appledisplay_bl_update_status(struct backlight_device *bd) | |||
141 | int retval; | 141 | int retval; |
142 | 142 | ||
143 | pdata->msgdata[0] = 0x10; | 143 | pdata->msgdata[0] = 0x10; |
144 | pdata->msgdata[1] = bd->props->brightness; | 144 | pdata->msgdata[1] = bd->props.brightness; |
145 | 145 | ||
146 | retval = usb_control_msg( | 146 | retval = usb_control_msg( |
147 | pdata->udev, | 147 | pdata->udev, |
@@ -177,10 +177,9 @@ static int appledisplay_bl_get_brightness(struct backlight_device *bd) | |||
177 | return pdata->msgdata[1]; | 177 | return pdata->msgdata[1]; |
178 | } | 178 | } |
179 | 179 | ||
180 | static struct backlight_properties appledisplay_bl_data = { | 180 | static struct backlight_ops appledisplay_bl_data = { |
181 | .get_brightness = appledisplay_bl_get_brightness, | 181 | .get_brightness = appledisplay_bl_get_brightness, |
182 | .update_status = appledisplay_bl_update_status, | 182 | .update_status = appledisplay_bl_update_status, |
183 | .max_brightness = 0xFF | ||
184 | }; | 183 | }; |
185 | 184 | ||
186 | static void appledisplay_work(struct work_struct *work) | 185 | static void appledisplay_work(struct work_struct *work) |
@@ -191,7 +190,7 @@ static void appledisplay_work(struct work_struct *work) | |||
191 | 190 | ||
192 | retval = appledisplay_bl_get_brightness(pdata->bd); | 191 | retval = appledisplay_bl_get_brightness(pdata->bd); |
193 | if (retval >= 0) | 192 | if (retval >= 0) |
194 | pdata->bd->props->brightness = retval; | 193 | pdata->bd->props.brightness = retval; |
195 | 194 | ||
196 | /* Poll again in about 125ms if there's still a button pressed */ | 195 | /* Poll again in about 125ms if there's still a button pressed */ |
197 | if (pdata->button_pressed) | 196 | if (pdata->button_pressed) |
@@ -285,6 +284,8 @@ static int appledisplay_probe(struct usb_interface *iface, | |||
285 | goto error; | 284 | goto error; |
286 | } | 285 | } |
287 | 286 | ||
287 | pdata->bd->props.max_brightness = 0xff; | ||
288 | |||
288 | /* Try to get brightness */ | 289 | /* Try to get brightness */ |
289 | brightness = appledisplay_bl_get_brightness(pdata->bd); | 290 | brightness = appledisplay_bl_get_brightness(pdata->bd); |
290 | 291 | ||
@@ -295,7 +296,7 @@ static int appledisplay_probe(struct usb_interface *iface, | |||
295 | } | 296 | } |
296 | 297 | ||
297 | /* Set brightness in backlight device */ | 298 | /* Set brightness in backlight device */ |
298 | pdata->bd->props->brightness = brightness; | 299 | pdata->bd->props.brightness = brightness; |
299 | 300 | ||
300 | /* save our data pointer in the interface device */ | 301 | /* save our data pointer in the interface device */ |
301 | usb_set_intfdata(iface, pdata); | 302 | usb_set_intfdata(iface, pdata); |
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 4de8d6252c3c..8726c3669713 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -1695,8 +1695,6 @@ static int __devinit aty128fb_setup(char *options) | |||
1695 | #ifdef CONFIG_FB_ATY128_BACKLIGHT | 1695 | #ifdef CONFIG_FB_ATY128_BACKLIGHT |
1696 | #define MAX_LEVEL 0xFF | 1696 | #define MAX_LEVEL 0xFF |
1697 | 1697 | ||
1698 | static struct backlight_properties aty128_bl_data; | ||
1699 | |||
1700 | static int aty128_bl_get_level_brightness(struct aty128fb_par *par, | 1698 | static int aty128_bl_get_level_brightness(struct aty128fb_par *par, |
1701 | int level) | 1699 | int level) |
1702 | { | 1700 | { |
@@ -1730,12 +1728,12 @@ static int aty128_bl_update_status(struct backlight_device *bd) | |||
1730 | unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); | 1728 | unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); |
1731 | int level; | 1729 | int level; |
1732 | 1730 | ||
1733 | if (bd->props->power != FB_BLANK_UNBLANK || | 1731 | if (bd->props.power != FB_BLANK_UNBLANK || |
1734 | bd->props->fb_blank != FB_BLANK_UNBLANK || | 1732 | bd->props.fb_blank != FB_BLANK_UNBLANK || |
1735 | !par->lcd_on) | 1733 | !par->lcd_on) |
1736 | level = 0; | 1734 | level = 0; |
1737 | else | 1735 | else |
1738 | level = bd->props->brightness; | 1736 | level = bd->props.brightness; |
1739 | 1737 | ||
1740 | reg |= LVDS_BL_MOD_EN | LVDS_BLON; | 1738 | reg |= LVDS_BL_MOD_EN | LVDS_BLON; |
1741 | if (level > 0) { | 1739 | if (level > 0) { |
@@ -1779,19 +1777,18 @@ static int aty128_bl_update_status(struct backlight_device *bd) | |||
1779 | 1777 | ||
1780 | static int aty128_bl_get_brightness(struct backlight_device *bd) | 1778 | static int aty128_bl_get_brightness(struct backlight_device *bd) |
1781 | { | 1779 | { |
1782 | return bd->props->brightness; | 1780 | return bd->props.brightness; |
1783 | } | 1781 | } |
1784 | 1782 | ||
1785 | static struct backlight_properties aty128_bl_data = { | 1783 | static struct backlight_ops aty128_bl_data = { |
1786 | .get_brightness = aty128_bl_get_brightness, | 1784 | .get_brightness = aty128_bl_get_brightness, |
1787 | .update_status = aty128_bl_update_status, | 1785 | .update_status = aty128_bl_update_status, |
1788 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | ||
1789 | }; | 1786 | }; |
1790 | 1787 | ||
1791 | static void aty128_bl_set_power(struct fb_info *info, int power) | 1788 | static void aty128_bl_set_power(struct fb_info *info, int power) |
1792 | { | 1789 | { |
1793 | if (info->bl_dev) { | 1790 | if (info->bl_dev) { |
1794 | info->bl_dev->props->power = power; | 1791 | info->bl_dev->props.power = power; |
1795 | backlight_update_status(info->bl_dev); | 1792 | backlight_update_status(info->bl_dev); |
1796 | } | 1793 | } |
1797 | } | 1794 | } |
@@ -1825,8 +1822,9 @@ static void aty128_bl_init(struct aty128fb_par *par) | |||
1825 | 63 * FB_BACKLIGHT_MAX / MAX_LEVEL, | 1822 | 63 * FB_BACKLIGHT_MAX / MAX_LEVEL, |
1826 | 219 * FB_BACKLIGHT_MAX / MAX_LEVEL); | 1823 | 219 * FB_BACKLIGHT_MAX / MAX_LEVEL); |
1827 | 1824 | ||
1828 | bd->props->brightness = aty128_bl_data.max_brightness; | 1825 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
1829 | bd->props->power = FB_BLANK_UNBLANK; | 1826 | bd->props.brightness = bd->props.max_brightness; |
1827 | bd->props.power = FB_BLANK_UNBLANK; | ||
1830 | backlight_update_status(bd); | 1828 | backlight_update_status(bd); |
1831 | 1829 | ||
1832 | printk("aty128: Backlight initialized (%s)\n", name); | 1830 | printk("aty128: Backlight initialized (%s)\n", name); |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 35ba26567598..a7e0062233f2 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -2114,8 +2114,6 @@ static int atyfb_pci_resume(struct pci_dev *pdev) | |||
2114 | #ifdef CONFIG_FB_ATY_BACKLIGHT | 2114 | #ifdef CONFIG_FB_ATY_BACKLIGHT |
2115 | #define MAX_LEVEL 0xFF | 2115 | #define MAX_LEVEL 0xFF |
2116 | 2116 | ||
2117 | static struct backlight_properties aty_bl_data; | ||
2118 | |||
2119 | static int aty_bl_get_level_brightness(struct atyfb_par *par, int level) | 2117 | static int aty_bl_get_level_brightness(struct atyfb_par *par, int level) |
2120 | { | 2118 | { |
2121 | struct fb_info *info = pci_get_drvdata(par->pdev); | 2119 | struct fb_info *info = pci_get_drvdata(par->pdev); |
@@ -2139,11 +2137,11 @@ static int aty_bl_update_status(struct backlight_device *bd) | |||
2139 | unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par); | 2137 | unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par); |
2140 | int level; | 2138 | int level; |
2141 | 2139 | ||
2142 | if (bd->props->power != FB_BLANK_UNBLANK || | 2140 | if (bd->props.power != FB_BLANK_UNBLANK || |
2143 | bd->props->fb_blank != FB_BLANK_UNBLANK) | 2141 | bd->props.fb_blank != FB_BLANK_UNBLANK) |
2144 | level = 0; | 2142 | level = 0; |
2145 | else | 2143 | else |
2146 | level = bd->props->brightness; | 2144 | level = bd->props.brightness; |
2147 | 2145 | ||
2148 | reg |= (BLMOD_EN | BIASMOD_EN); | 2146 | reg |= (BLMOD_EN | BIASMOD_EN); |
2149 | if (level > 0) { | 2147 | if (level > 0) { |
@@ -2160,13 +2158,12 @@ static int aty_bl_update_status(struct backlight_device *bd) | |||
2160 | 2158 | ||
2161 | static int aty_bl_get_brightness(struct backlight_device *bd) | 2159 | static int aty_bl_get_brightness(struct backlight_device *bd) |
2162 | { | 2160 | { |
2163 | return bd->props->brightness; | 2161 | return bd->props.brightness; |
2164 | } | 2162 | } |
2165 | 2163 | ||
2166 | static struct backlight_properties aty_bl_data = { | 2164 | static struct backlight_ops aty_bl_data = { |
2167 | .get_brightness = aty_bl_get_brightness, | 2165 | .get_brightness = aty_bl_get_brightness, |
2168 | .update_status = aty_bl_update_status, | 2166 | .update_status = aty_bl_update_status, |
2169 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | ||
2170 | }; | 2167 | }; |
2171 | 2168 | ||
2172 | static void aty_bl_init(struct atyfb_par *par) | 2169 | static void aty_bl_init(struct atyfb_par *par) |
@@ -2194,8 +2191,9 @@ static void aty_bl_init(struct atyfb_par *par) | |||
2194 | 0x3F * FB_BACKLIGHT_MAX / MAX_LEVEL, | 2191 | 0x3F * FB_BACKLIGHT_MAX / MAX_LEVEL, |
2195 | 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL); | 2192 | 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL); |
2196 | 2193 | ||
2197 | bd->props->brightness = aty_bl_data.max_brightness; | 2194 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
2198 | bd->props->power = FB_BLANK_UNBLANK; | 2195 | bd->props.brightness = bd->props.max_brightness; |
2196 | bd->props.power = FB_BLANK_UNBLANK; | ||
2199 | backlight_update_status(bd); | 2197 | backlight_update_status(bd); |
2200 | 2198 | ||
2201 | printk("aty: Backlight initialized (%s)\n", name); | 2199 | printk("aty: Backlight initialized (%s)\n", name); |
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c index 8c775e6a7e03..0be25fa5540c 100644 --- a/drivers/video/aty/radeon_backlight.c +++ b/drivers/video/aty/radeon_backlight.c | |||
@@ -19,8 +19,6 @@ | |||
19 | 19 | ||
20 | #define MAX_RADEON_LEVEL 0xFF | 20 | #define MAX_RADEON_LEVEL 0xFF |
21 | 21 | ||
22 | static struct backlight_properties radeon_bl_data; | ||
23 | |||
24 | struct radeon_bl_privdata { | 22 | struct radeon_bl_privdata { |
25 | struct radeonfb_info *rinfo; | 23 | struct radeonfb_info *rinfo; |
26 | uint8_t negative; | 24 | uint8_t negative; |
@@ -61,11 +59,11 @@ static int radeon_bl_update_status(struct backlight_device *bd) | |||
61 | * backlight. This provides some greater power saving and the display | 59 | * backlight. This provides some greater power saving and the display |
62 | * is useless without backlight anyway. | 60 | * is useless without backlight anyway. |
63 | */ | 61 | */ |
64 | if (bd->props->power != FB_BLANK_UNBLANK || | 62 | if (bd->props.power != FB_BLANK_UNBLANK || |
65 | bd->props->fb_blank != FB_BLANK_UNBLANK) | 63 | bd->props.fb_blank != FB_BLANK_UNBLANK) |
66 | level = 0; | 64 | level = 0; |
67 | else | 65 | else |
68 | level = bd->props->brightness; | 66 | level = bd->props.brightness; |
69 | 67 | ||
70 | del_timer_sync(&rinfo->lvds_timer); | 68 | del_timer_sync(&rinfo->lvds_timer); |
71 | radeon_engine_idle(); | 69 | radeon_engine_idle(); |
@@ -126,13 +124,12 @@ static int radeon_bl_update_status(struct backlight_device *bd) | |||
126 | 124 | ||
127 | static int radeon_bl_get_brightness(struct backlight_device *bd) | 125 | static int radeon_bl_get_brightness(struct backlight_device *bd) |
128 | { | 126 | { |
129 | return bd->props->brightness; | 127 | return bd->props.brightness; |
130 | } | 128 | } |
131 | 129 | ||
132 | static struct backlight_properties radeon_bl_data = { | 130 | static struct backlight_ops radeon_bl_data = { |
133 | .get_brightness = radeon_bl_get_brightness, | 131 | .get_brightness = radeon_bl_get_brightness, |
134 | .update_status = radeon_bl_update_status, | 132 | .update_status = radeon_bl_update_status, |
135 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | ||
136 | }; | 133 | }; |
137 | 134 | ||
138 | void radeonfb_bl_init(struct radeonfb_info *rinfo) | 135 | void radeonfb_bl_init(struct radeonfb_info *rinfo) |
@@ -188,8 +185,9 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo) | |||
188 | 63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL, | 185 | 63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL, |
189 | 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); | 186 | 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); |
190 | 187 | ||
191 | bd->props->brightness = radeon_bl_data.max_brightness; | 188 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
192 | bd->props->power = FB_BLANK_UNBLANK; | 189 | bd->props.brightness = bd->props.max_brightness; |
190 | bd->props.power = FB_BLANK_UNBLANK; | ||
193 | backlight_update_status(bd); | 191 | backlight_update_status(bd); |
194 | 192 | ||
195 | printk("radeonfb: Backlight initialized (%s)\n", name); | 193 | printk("radeonfb: Backlight initialized (%s)\n", name); |
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 822a373d3346..c65e81ff3578 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -35,14 +35,14 @@ static int fb_notifier_callback(struct notifier_block *self, | |||
35 | return 0; | 35 | return 0; |
36 | 36 | ||
37 | bd = container_of(self, struct backlight_device, fb_notif); | 37 | bd = container_of(self, struct backlight_device, fb_notif); |
38 | mutex_lock(&bd->props_lock); | 38 | mutex_lock(&bd->ops_lock); |
39 | if (bd->props) | 39 | if (bd->ops) |
40 | if (!bd->props->check_fb || | 40 | if (!bd->ops->check_fb || |
41 | bd->props->check_fb(evdata->info)) { | 41 | bd->ops->check_fb(evdata->info)) { |
42 | bd->props->fb_blank = *(int *)evdata->data; | 42 | bd->props.fb_blank = *(int *)evdata->data; |
43 | backlight_update_status(bd); | 43 | backlight_update_status(bd); |
44 | } | 44 | } |
45 | mutex_unlock(&bd->props_lock); | 45 | mutex_unlock(&bd->ops_lock); |
46 | return 0; | 46 | return 0; |
47 | } | 47 | } |
48 | 48 | ||
@@ -71,15 +71,9 @@ static inline void backlight_unregister_fb(struct backlight_device *bd) | |||
71 | 71 | ||
72 | static ssize_t backlight_show_power(struct class_device *cdev, char *buf) | 72 | static ssize_t backlight_show_power(struct class_device *cdev, char *buf) |
73 | { | 73 | { |
74 | int rc = -ENXIO; | ||
75 | struct backlight_device *bd = to_backlight_device(cdev); | 74 | struct backlight_device *bd = to_backlight_device(cdev); |
76 | 75 | ||
77 | mutex_lock(&bd->props_lock); | 76 | return sprintf(buf, "%d\n", bd->props.power); |
78 | if (bd->props) | ||
79 | rc = sprintf(buf, "%d\n", bd->props->power); | ||
80 | mutex_unlock(&bd->props_lock); | ||
81 | |||
82 | return rc; | ||
83 | } | 77 | } |
84 | 78 | ||
85 | static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count) | 79 | static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count) |
@@ -95,29 +89,23 @@ static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, | |||
95 | if (size != count) | 89 | if (size != count) |
96 | return -EINVAL; | 90 | return -EINVAL; |
97 | 91 | ||
98 | mutex_lock(&bd->props_lock); | 92 | mutex_lock(&bd->ops_lock); |
99 | if (bd->props) { | 93 | if (bd->ops) { |
100 | pr_debug("backlight: set power to %d\n", power); | 94 | pr_debug("backlight: set power to %d\n", power); |
101 | bd->props->power = power; | 95 | bd->props.power = power; |
102 | backlight_update_status(bd); | 96 | backlight_update_status(bd); |
103 | rc = count; | 97 | rc = count; |
104 | } | 98 | } |
105 | mutex_unlock(&bd->props_lock); | 99 | mutex_unlock(&bd->ops_lock); |
106 | 100 | ||
107 | return rc; | 101 | return rc; |
108 | } | 102 | } |
109 | 103 | ||
110 | static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf) | 104 | static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf) |
111 | { | 105 | { |
112 | int rc = -ENXIO; | ||
113 | struct backlight_device *bd = to_backlight_device(cdev); | 106 | struct backlight_device *bd = to_backlight_device(cdev); |
114 | 107 | ||
115 | mutex_lock(&bd->props_lock); | 108 | return sprintf(buf, "%d\n", bd->props.brightness); |
116 | if (bd->props) | ||
117 | rc = sprintf(buf, "%d\n", bd->props->brightness); | ||
118 | mutex_unlock(&bd->props_lock); | ||
119 | |||
120 | return rc; | ||
121 | } | 109 | } |
122 | 110 | ||
123 | static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count) | 111 | static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count) |
@@ -133,34 +121,28 @@ static ssize_t backlight_store_brightness(struct class_device *cdev, const char | |||
133 | if (size != count) | 121 | if (size != count) |
134 | return -EINVAL; | 122 | return -EINVAL; |
135 | 123 | ||
136 | mutex_lock(&bd->props_lock); | 124 | mutex_lock(&bd->ops_lock); |
137 | if (bd->props) { | 125 | if (bd->ops) { |
138 | if (brightness > bd->props->max_brightness) | 126 | if (brightness > bd->props.max_brightness) |
139 | rc = -EINVAL; | 127 | rc = -EINVAL; |
140 | else { | 128 | else { |
141 | pr_debug("backlight: set brightness to %d\n", | 129 | pr_debug("backlight: set brightness to %d\n", |
142 | brightness); | 130 | brightness); |
143 | bd->props->brightness = brightness; | 131 | bd->props.brightness = brightness; |
144 | backlight_update_status(bd); | 132 | backlight_update_status(bd); |
145 | rc = count; | 133 | rc = count; |
146 | } | 134 | } |
147 | } | 135 | } |
148 | mutex_unlock(&bd->props_lock); | 136 | mutex_unlock(&bd->ops_lock); |
149 | 137 | ||
150 | return rc; | 138 | return rc; |
151 | } | 139 | } |
152 | 140 | ||
153 | static ssize_t backlight_show_max_brightness(struct class_device *cdev, char *buf) | 141 | static ssize_t backlight_show_max_brightness(struct class_device *cdev, char *buf) |
154 | { | 142 | { |
155 | int rc = -ENXIO; | ||
156 | struct backlight_device *bd = to_backlight_device(cdev); | 143 | struct backlight_device *bd = to_backlight_device(cdev); |
157 | 144 | ||
158 | mutex_lock(&bd->props_lock); | 145 | return sprintf(buf, "%d\n", bd->props.max_brightness); |
159 | if (bd->props) | ||
160 | rc = sprintf(buf, "%d\n", bd->props->max_brightness); | ||
161 | mutex_unlock(&bd->props_lock); | ||
162 | |||
163 | return rc; | ||
164 | } | 146 | } |
165 | 147 | ||
166 | static ssize_t backlight_show_actual_brightness(struct class_device *cdev, | 148 | static ssize_t backlight_show_actual_brightness(struct class_device *cdev, |
@@ -169,10 +151,10 @@ static ssize_t backlight_show_actual_brightness(struct class_device *cdev, | |||
169 | int rc = -ENXIO; | 151 | int rc = -ENXIO; |
170 | struct backlight_device *bd = to_backlight_device(cdev); | 152 | struct backlight_device *bd = to_backlight_device(cdev); |
171 | 153 | ||
172 | mutex_lock(&bd->props_lock); | 154 | mutex_lock(&bd->ops_lock); |
173 | if (bd->props && bd->props->get_brightness) | 155 | if (bd->ops && bd->ops->get_brightness) |
174 | rc = sprintf(buf, "%d\n", bd->props->get_brightness(bd)); | 156 | rc = sprintf(buf, "%d\n", bd->ops->get_brightness(bd)); |
175 | mutex_unlock(&bd->props_lock); | 157 | mutex_unlock(&bd->ops_lock); |
176 | 158 | ||
177 | return rc; | 159 | return rc; |
178 | } | 160 | } |
@@ -211,7 +193,7 @@ static const struct class_device_attribute bl_class_device_attributes[] = { | |||
211 | * respective framebuffer device). | 193 | * respective framebuffer device). |
212 | * @devdata: an optional pointer to be stored in the class_device. The | 194 | * @devdata: an optional pointer to be stored in the class_device. The |
213 | * methods may retrieve it by using class_get_devdata(&bd->class_dev). | 195 | * methods may retrieve it by using class_get_devdata(&bd->class_dev). |
214 | * @bp: the backlight properties structure. | 196 | * @ops: the backlight operations structure. |
215 | * | 197 | * |
216 | * Creates and registers new backlight class_device. Returns either an | 198 | * Creates and registers new backlight class_device. Returns either an |
217 | * ERR_PTR() or a pointer to the newly allocated device. | 199 | * ERR_PTR() or a pointer to the newly allocated device. |
@@ -219,21 +201,20 @@ static const struct class_device_attribute bl_class_device_attributes[] = { | |||
219 | struct backlight_device *backlight_device_register(const char *name, | 201 | struct backlight_device *backlight_device_register(const char *name, |
220 | struct device *dev, | 202 | struct device *dev, |
221 | void *devdata, | 203 | void *devdata, |
222 | struct backlight_properties *bp) | 204 | struct backlight_ops *ops) |
223 | { | 205 | { |
224 | int i, rc; | 206 | int i, rc; |
225 | struct backlight_device *new_bd; | 207 | struct backlight_device *new_bd; |
226 | 208 | ||
227 | pr_debug("backlight_device_alloc: name=%s\n", name); | 209 | pr_debug("backlight_device_alloc: name=%s\n", name); |
228 | 210 | ||
229 | new_bd = kmalloc(sizeof(struct backlight_device), GFP_KERNEL); | 211 | new_bd = kzalloc(sizeof(struct backlight_device), GFP_KERNEL); |
230 | if (!new_bd) | 212 | if (!new_bd) |
231 | return ERR_PTR(-ENOMEM); | 213 | return ERR_PTR(-ENOMEM); |
232 | 214 | ||
233 | mutex_init(&new_bd->update_lock); | 215 | mutex_init(&new_bd->update_lock); |
234 | mutex_init(&new_bd->props_lock); | 216 | mutex_init(&new_bd->ops_lock); |
235 | new_bd->props = bp; | 217 | new_bd->ops = ops; |
236 | memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev)); | ||
237 | new_bd->class_dev.class = &backlight_class; | 218 | new_bd->class_dev.class = &backlight_class; |
238 | new_bd->class_dev.dev = dev; | 219 | new_bd->class_dev.dev = dev; |
239 | strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN); | 220 | strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN); |
@@ -302,9 +283,9 @@ void backlight_device_unregister(struct backlight_device *bd) | |||
302 | class_device_remove_file(&bd->class_dev, | 283 | class_device_remove_file(&bd->class_dev, |
303 | &bl_class_device_attributes[i]); | 284 | &bl_class_device_attributes[i]); |
304 | 285 | ||
305 | mutex_lock(&bd->props_lock); | 286 | mutex_lock(&bd->ops_lock); |
306 | bd->props = NULL; | 287 | bd->ops = NULL; |
307 | mutex_unlock(&bd->props_lock); | 288 | mutex_unlock(&bd->ops_lock); |
308 | 289 | ||
309 | backlight_unregister_fb(bd); | 290 | backlight_unregister_fb(bd); |
310 | 291 | ||
diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c index c1eba0e8a1b0..05f36811ac95 100644 --- a/drivers/video/backlight/corgi_bl.c +++ b/drivers/video/backlight/corgi_bl.c | |||
@@ -34,11 +34,11 @@ static unsigned long corgibl_flags; | |||
34 | static int corgibl_send_intensity(struct backlight_device *bd) | 34 | static int corgibl_send_intensity(struct backlight_device *bd) |
35 | { | 35 | { |
36 | void (*corgi_kick_batt)(void); | 36 | void (*corgi_kick_batt)(void); |
37 | int intensity = bd->props->brightness; | 37 | int intensity = bd->props.brightness; |
38 | 38 | ||
39 | if (bd->props->power != FB_BLANK_UNBLANK) | 39 | if (bd->props.power != FB_BLANK_UNBLANK) |
40 | intensity = 0; | 40 | intensity = 0; |
41 | if (bd->props->fb_blank != FB_BLANK_UNBLANK) | 41 | if (bd->props.fb_blank != FB_BLANK_UNBLANK) |
42 | intensity = 0; | 42 | intensity = 0; |
43 | if (corgibl_flags & CORGIBL_SUSPENDED) | 43 | if (corgibl_flags & CORGIBL_SUSPENDED) |
44 | intensity = 0; | 44 | intensity = 0; |
@@ -103,7 +103,7 @@ void corgibl_limit_intensity(int limit) | |||
103 | EXPORT_SYMBOL(corgibl_limit_intensity); | 103 | EXPORT_SYMBOL(corgibl_limit_intensity); |
104 | 104 | ||
105 | 105 | ||
106 | static struct backlight_properties corgibl_data = { | 106 | static struct backlight_ops corgibl_ops = { |
107 | .get_brightness = corgibl_get_intensity, | 107 | .get_brightness = corgibl_get_intensity, |
108 | .update_status = corgibl_send_intensity, | 108 | .update_status = corgibl_send_intensity, |
109 | }; | 109 | }; |
@@ -113,19 +113,19 @@ static int corgibl_probe(struct platform_device *pdev) | |||
113 | struct corgibl_machinfo *machinfo = pdev->dev.platform_data; | 113 | struct corgibl_machinfo *machinfo = pdev->dev.platform_data; |
114 | 114 | ||
115 | bl_machinfo = machinfo; | 115 | bl_machinfo = machinfo; |
116 | corgibl_data.max_brightness = machinfo->max_intensity; | ||
117 | if (!machinfo->limit_mask) | 116 | if (!machinfo->limit_mask) |
118 | machinfo->limit_mask = -1; | 117 | machinfo->limit_mask = -1; |
119 | 118 | ||
120 | corgi_backlight_device = backlight_device_register ("corgi-bl", | 119 | corgi_backlight_device = backlight_device_register ("corgi-bl", |
121 | &pdev->dev, NULL, &corgibl_data); | 120 | &pdev->dev, NULL, &corgibl_ops); |
122 | if (IS_ERR (corgi_backlight_device)) | 121 | if (IS_ERR (corgi_backlight_device)) |
123 | return PTR_ERR (corgi_backlight_device); | 122 | return PTR_ERR (corgi_backlight_device); |
124 | 123 | ||
125 | platform_set_drvdata(pdev, corgi_backlight_device); | 124 | platform_set_drvdata(pdev, corgi_backlight_device); |
126 | 125 | ||
127 | corgibl_data.power = FB_BLANK_UNBLANK; | 126 | corgi_backlight_device->props.max_brightness = machinfo->max_intensity; |
128 | corgibl_data.brightness = machinfo->default_intensity; | 127 | corgi_backlight_device->props.power = FB_BLANK_UNBLANK; |
128 | corgi_backlight_device->props.brightness = machinfo->default_intensity; | ||
129 | corgibl_send_intensity(corgi_backlight_device); | 129 | corgibl_send_intensity(corgi_backlight_device); |
130 | 130 | ||
131 | printk("Corgi Backlight Driver Initialized.\n"); | 131 | printk("Corgi Backlight Driver Initialized.\n"); |
diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c index e7444c8f289d..0899fccbd570 100644 --- a/drivers/video/backlight/hp680_bl.c +++ b/drivers/video/backlight/hp680_bl.c | |||
@@ -33,11 +33,11 @@ static void hp680bl_send_intensity(struct backlight_device *bd) | |||
33 | { | 33 | { |
34 | unsigned long flags; | 34 | unsigned long flags; |
35 | u16 v; | 35 | u16 v; |
36 | int intensity = bd->props->brightness; | 36 | int intensity = bd->props.brightness; |
37 | 37 | ||
38 | if (bd->props->power != FB_BLANK_UNBLANK) | 38 | if (bd->props.power != FB_BLANK_UNBLANK) |
39 | intensity = 0; | 39 | intensity = 0; |
40 | if (bd->props->fb_blank != FB_BLANK_UNBLANK) | 40 | if (bd->props.fb_blank != FB_BLANK_UNBLANK) |
41 | intensity = 0; | 41 | intensity = 0; |
42 | if (hp680bl_suspended) | 42 | if (hp680bl_suspended) |
43 | intensity = 0; | 43 | intensity = 0; |
@@ -98,8 +98,7 @@ static int hp680bl_get_intensity(struct backlight_device *bd) | |||
98 | return current_intensity; | 98 | return current_intensity; |
99 | } | 99 | } |
100 | 100 | ||
101 | static struct backlight_properties hp680bl_data = { | 101 | static struct backlight_ops hp680bl_ops = { |
102 | .max_brightness = HP680_MAX_INTENSITY, | ||
103 | .get_brightness = hp680bl_get_intensity, | 102 | .get_brightness = hp680bl_get_intensity, |
104 | .update_status = hp680bl_set_intensity, | 103 | .update_status = hp680bl_set_intensity, |
105 | }; | 104 | }; |
@@ -109,13 +108,14 @@ static int __init hp680bl_probe(struct platform_device *pdev) | |||
109 | struct backlight_device *bd; | 108 | struct backlight_device *bd; |
110 | 109 | ||
111 | bd = backlight_device_register ("hp680-bl", &pdev->dev, NULL, | 110 | bd = backlight_device_register ("hp680-bl", &pdev->dev, NULL, |
112 | &hp680bl_data); | 111 | &hp680bl_ops); |
113 | if (IS_ERR(bd)) | 112 | if (IS_ERR(bd)) |
114 | return PTR_ERR(bd); | 113 | return PTR_ERR(bd); |
115 | 114 | ||
116 | platform_set_drvdata(pdev, bd); | 115 | platform_set_drvdata(pdev, bd); |
117 | 116 | ||
118 | bd->props->brightness = HP680_DEFAULT_INTENSITY; | 117 | bd->props.max_brightness = HP680_MAX_INTENSITY; |
118 | bd->props.brightness = HP680_DEFAULT_INTENSITY; | ||
119 | hp680bl_send_intensity(bd); | 119 | hp680bl_send_intensity(bd); |
120 | 120 | ||
121 | return 0; | 121 | return 0; |
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 430ba018a896..6ef8f0a7a137 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c | |||
@@ -31,11 +31,11 @@ static int fb_notifier_callback(struct notifier_block *self, | |||
31 | return 0; | 31 | return 0; |
32 | 32 | ||
33 | ld = container_of(self, struct lcd_device, fb_notif); | 33 | ld = container_of(self, struct lcd_device, fb_notif); |
34 | mutex_lock(&ld->props_lock); | 34 | mutex_lock(&ld->ops_lock); |
35 | if (ld->props) | 35 | if (ld->ops) |
36 | if (!ld->props->check_fb || ld->props->check_fb(evdata->info)) | 36 | if (!ld->ops->check_fb || ld->ops->check_fb(evdata->info)) |
37 | ld->props->set_power(ld, *(int *)evdata->data); | 37 | ld->ops->set_power(ld, *(int *)evdata->data); |
38 | mutex_unlock(&ld->props_lock); | 38 | mutex_unlock(&ld->ops_lock); |
39 | return 0; | 39 | return 0; |
40 | } | 40 | } |
41 | 41 | ||
@@ -66,12 +66,12 @@ static ssize_t lcd_show_power(struct class_device *cdev, char *buf) | |||
66 | int rc; | 66 | int rc; |
67 | struct lcd_device *ld = to_lcd_device(cdev); | 67 | struct lcd_device *ld = to_lcd_device(cdev); |
68 | 68 | ||
69 | mutex_lock(&ld->props_lock); | 69 | mutex_lock(&ld->ops_lock); |
70 | if (ld->props && ld->props->get_power) | 70 | if (ld->ops && ld->ops->get_power) |
71 | rc = sprintf(buf, "%d\n", ld->props->get_power(ld)); | 71 | rc = sprintf(buf, "%d\n", ld->ops->get_power(ld)); |
72 | else | 72 | else |
73 | rc = -ENXIO; | 73 | rc = -ENXIO; |
74 | mutex_unlock(&ld->props_lock); | 74 | mutex_unlock(&ld->ops_lock); |
75 | 75 | ||
76 | return rc; | 76 | return rc; |
77 | } | 77 | } |
@@ -89,13 +89,13 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_ | |||
89 | if (size != count) | 89 | if (size != count) |
90 | return -EINVAL; | 90 | return -EINVAL; |
91 | 91 | ||
92 | mutex_lock(&ld->props_lock); | 92 | mutex_lock(&ld->ops_lock); |
93 | if (ld->props && ld->props->set_power) { | 93 | if (ld->ops && ld->ops->set_power) { |
94 | pr_debug("lcd: set power to %d\n", power); | 94 | pr_debug("lcd: set power to %d\n", power); |
95 | ld->props->set_power(ld, power); | 95 | ld->ops->set_power(ld, power); |
96 | rc = count; | 96 | rc = count; |
97 | } | 97 | } |
98 | mutex_unlock(&ld->props_lock); | 98 | mutex_unlock(&ld->ops_lock); |
99 | 99 | ||
100 | return rc; | 100 | return rc; |
101 | } | 101 | } |
@@ -105,10 +105,10 @@ static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) | |||
105 | int rc = -ENXIO; | 105 | int rc = -ENXIO; |
106 | struct lcd_device *ld = to_lcd_device(cdev); | 106 | struct lcd_device *ld = to_lcd_device(cdev); |
107 | 107 | ||
108 | mutex_lock(&ld->props_lock); | 108 | mutex_lock(&ld->ops_lock); |
109 | if (ld->props && ld->props->get_contrast) | 109 | if (ld->ops && ld->ops->get_contrast) |
110 | rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); | 110 | rc = sprintf(buf, "%d\n", ld->ops->get_contrast(ld)); |
111 | mutex_unlock(&ld->props_lock); | 111 | mutex_unlock(&ld->ops_lock); |
112 | 112 | ||
113 | return rc; | 113 | return rc; |
114 | } | 114 | } |
@@ -126,28 +126,22 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si | |||
126 | if (size != count) | 126 | if (size != count) |
127 | return -EINVAL; | 127 | return -EINVAL; |
128 | 128 | ||
129 | mutex_lock(&ld->props_lock); | 129 | mutex_lock(&ld->ops_lock); |
130 | if (ld->props && ld->props->set_contrast) { | 130 | if (ld->ops && ld->ops->set_contrast) { |
131 | pr_debug("lcd: set contrast to %d\n", contrast); | 131 | pr_debug("lcd: set contrast to %d\n", contrast); |
132 | ld->props->set_contrast(ld, contrast); | 132 | ld->ops->set_contrast(ld, contrast); |
133 | rc = count; | 133 | rc = count; |
134 | } | 134 | } |
135 | mutex_unlock(&ld->props_lock); | 135 | mutex_unlock(&ld->ops_lock); |
136 | 136 | ||
137 | return rc; | 137 | return rc; |
138 | } | 138 | } |
139 | 139 | ||
140 | static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) | 140 | static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) |
141 | { | 141 | { |
142 | int rc = -ENXIO; | ||
143 | struct lcd_device *ld = to_lcd_device(cdev); | 142 | struct lcd_device *ld = to_lcd_device(cdev); |
144 | 143 | ||
145 | mutex_lock(&ld->props_lock); | 144 | return sprintf(buf, "%d\n", ld->props.max_contrast); |
146 | if (ld->props) | ||
147 | rc = sprintf(buf, "%d\n", ld->props->max_contrast); | ||
148 | mutex_unlock(&ld->props_lock); | ||
149 | |||
150 | return rc; | ||
151 | } | 145 | } |
152 | 146 | ||
153 | static void lcd_class_release(struct class_device *dev) | 147 | static void lcd_class_release(struct class_device *dev) |
@@ -180,27 +174,26 @@ static const struct class_device_attribute lcd_class_device_attributes[] = { | |||
180 | * respective framebuffer device). | 174 | * respective framebuffer device). |
181 | * @devdata: an optional pointer to be stored in the class_device. The | 175 | * @devdata: an optional pointer to be stored in the class_device. The |
182 | * methods may retrieve it by using class_get_devdata(ld->class_dev). | 176 | * methods may retrieve it by using class_get_devdata(ld->class_dev). |
183 | * @lp: the lcd properties structure. | 177 | * @ops: the lcd operations structure. |
184 | * | 178 | * |
185 | * Creates and registers a new lcd class_device. Returns either an ERR_PTR() | 179 | * Creates and registers a new lcd class_device. Returns either an ERR_PTR() |
186 | * or a pointer to the newly allocated device. | 180 | * or a pointer to the newly allocated device. |
187 | */ | 181 | */ |
188 | struct lcd_device *lcd_device_register(const char *name, void *devdata, | 182 | struct lcd_device *lcd_device_register(const char *name, void *devdata, |
189 | struct lcd_properties *lp) | 183 | struct lcd_ops *ops) |
190 | { | 184 | { |
191 | int i, rc; | 185 | int i, rc; |
192 | struct lcd_device *new_ld; | 186 | struct lcd_device *new_ld; |
193 | 187 | ||
194 | pr_debug("lcd_device_register: name=%s\n", name); | 188 | pr_debug("lcd_device_register: name=%s\n", name); |
195 | 189 | ||
196 | new_ld = kmalloc(sizeof(struct lcd_device), GFP_KERNEL); | 190 | new_ld = kzalloc(sizeof(struct lcd_device), GFP_KERNEL); |
197 | if (!new_ld) | 191 | if (!new_ld) |
198 | return ERR_PTR(-ENOMEM); | 192 | return ERR_PTR(-ENOMEM); |
199 | 193 | ||
200 | mutex_init(&new_ld->props_lock); | 194 | mutex_init(&new_ld->ops_lock); |
201 | mutex_init(&new_ld->update_lock); | 195 | mutex_init(&new_ld->update_lock); |
202 | new_ld->props = lp; | 196 | new_ld->ops = ops; |
203 | memset(&new_ld->class_dev, 0, sizeof(new_ld->class_dev)); | ||
204 | new_ld->class_dev.class = &lcd_class; | 197 | new_ld->class_dev.class = &lcd_class; |
205 | strlcpy(new_ld->class_dev.class_id, name, KOBJ_NAME_LEN); | 198 | strlcpy(new_ld->class_dev.class_id, name, KOBJ_NAME_LEN); |
206 | class_set_devdata(&new_ld->class_dev, devdata); | 199 | class_set_devdata(&new_ld->class_dev, devdata); |
@@ -253,9 +246,9 @@ void lcd_device_unregister(struct lcd_device *ld) | |||
253 | class_device_remove_file(&ld->class_dev, | 246 | class_device_remove_file(&ld->class_dev, |
254 | &lcd_class_device_attributes[i]); | 247 | &lcd_class_device_attributes[i]); |
255 | 248 | ||
256 | mutex_lock(&ld->props_lock); | 249 | mutex_lock(&ld->ops_lock); |
257 | ld->props = NULL; | 250 | ld->ops = NULL; |
258 | mutex_unlock(&ld->props_lock); | 251 | mutex_unlock(&ld->ops_lock); |
259 | lcd_unregister_fb(ld); | 252 | lcd_unregister_fb(ld); |
260 | class_device_unregister(&ld->class_dev); | 253 | class_device_unregister(&ld->class_dev); |
261 | } | 254 | } |
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index 3c5abbf0d042..d1312477813e 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c | |||
@@ -112,11 +112,11 @@ static int current_intensity; | |||
112 | 112 | ||
113 | static int locomolcd_set_intensity(struct backlight_device *bd) | 113 | static int locomolcd_set_intensity(struct backlight_device *bd) |
114 | { | 114 | { |
115 | int intensity = bd->props->brightness; | 115 | int intensity = bd->props.brightness; |
116 | 116 | ||
117 | if (bd->props->power != FB_BLANK_UNBLANK) | 117 | if (bd->props.power != FB_BLANK_UNBLANK) |
118 | intensity = 0; | 118 | intensity = 0; |
119 | if (bd->props->fb_blank != FB_BLANK_UNBLANK) | 119 | if (bd->props.fb_blank != FB_BLANK_UNBLANK) |
120 | intensity = 0; | 120 | intensity = 0; |
121 | if (locomolcd_flags & LOCOMOLCD_SUSPENDED) | 121 | if (locomolcd_flags & LOCOMOLCD_SUSPENDED) |
122 | intensity = 0; | 122 | intensity = 0; |
@@ -141,10 +141,9 @@ static int locomolcd_get_intensity(struct backlight_device *bd) | |||
141 | return current_intensity; | 141 | return current_intensity; |
142 | } | 142 | } |
143 | 143 | ||
144 | static struct backlight_properties locomobl_data = { | 144 | static struct backlight_ops locomobl_data = { |
145 | .get_brightness = locomolcd_get_intensity, | 145 | .get_brightness = locomolcd_get_intensity, |
146 | .update_status = locomolcd_set_intensity, | 146 | .update_status = locomolcd_set_intensity, |
147 | .max_brightness = 4, | ||
148 | }; | 147 | }; |
149 | 148 | ||
150 | #ifdef CONFIG_PM | 149 | #ifdef CONFIG_PM |
@@ -189,7 +188,8 @@ static int locomolcd_probe(struct locomo_dev *ldev) | |||
189 | return PTR_ERR (locomolcd_bl_device); | 188 | return PTR_ERR (locomolcd_bl_device); |
190 | 189 | ||
191 | /* Set up frontlight so that screen is readable */ | 190 | /* Set up frontlight so that screen is readable */ |
192 | locomobl_data.brightness = 2; | 191 | locomolcd_bl_device->props.max_brightness = 4, |
192 | locomolcd_bl_device->props.brightness = 2; | ||
193 | locomolcd_set_intensity(locomolcd_bl_device); | 193 | locomolcd_set_intensity(locomolcd_bl_device); |
194 | 194 | ||
195 | return 0; | 195 | return 0; |
diff --git a/drivers/video/backlight/progear_bl.c b/drivers/video/backlight/progear_bl.c index 42d6acd96c1a..702269357861 100644 --- a/drivers/video/backlight/progear_bl.c +++ b/drivers/video/backlight/progear_bl.c | |||
@@ -35,11 +35,11 @@ static struct pci_dev *sb_dev = NULL; | |||
35 | 35 | ||
36 | static int progearbl_set_intensity(struct backlight_device *bd) | 36 | static int progearbl_set_intensity(struct backlight_device *bd) |
37 | { | 37 | { |
38 | int intensity = bd->props->brightness; | 38 | int intensity = bd->props.brightness; |
39 | 39 | ||
40 | if (bd->props->power != FB_BLANK_UNBLANK) | 40 | if (bd->props.power != FB_BLANK_UNBLANK) |
41 | intensity = 0; | 41 | intensity = 0; |
42 | if (bd->props->fb_blank != FB_BLANK_UNBLANK) | 42 | if (bd->props.fb_blank != FB_BLANK_UNBLANK) |
43 | intensity = 0; | 43 | intensity = 0; |
44 | 44 | ||
45 | pci_write_config_byte(pmu_dev, PMU_LPCR, intensity + HW_LEVEL_MIN); | 45 | pci_write_config_byte(pmu_dev, PMU_LPCR, intensity + HW_LEVEL_MIN); |
@@ -55,7 +55,7 @@ static int progearbl_get_intensity(struct backlight_device *bd) | |||
55 | return intensity - HW_LEVEL_MIN; | 55 | return intensity - HW_LEVEL_MIN; |
56 | } | 56 | } |
57 | 57 | ||
58 | static struct backlight_properties progearbl_data = { | 58 | static struct backlight_ops progearbl_ops = { |
59 | .get_brightness = progearbl_get_intensity, | 59 | .get_brightness = progearbl_get_intensity, |
60 | .update_status = progearbl_set_intensity, | 60 | .update_status = progearbl_set_intensity, |
61 | }; | 61 | }; |
@@ -84,15 +84,15 @@ static int progearbl_probe(struct platform_device *pdev) | |||
84 | 84 | ||
85 | progear_backlight_device = backlight_device_register("progear-bl", | 85 | progear_backlight_device = backlight_device_register("progear-bl", |
86 | &pdev->dev, NULL, | 86 | &pdev->dev, NULL, |
87 | &progearbl_data); | 87 | &progearbl_ops); |
88 | if (IS_ERR(progear_backlight_device)) | 88 | if (IS_ERR(progear_backlight_device)) |
89 | return PTR_ERR(progear_backlight_device); | 89 | return PTR_ERR(progear_backlight_device); |
90 | 90 | ||
91 | platform_set_drvdata(pdev, progear_backlight_device); | 91 | platform_set_drvdata(pdev, progear_backlight_device); |
92 | 92 | ||
93 | progearbl_data.power = FB_BLANK_UNBLANK; | 93 | progear_backlight_device->props.power = FB_BLANK_UNBLANK; |
94 | progearbl_data.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; | 94 | progear_backlight_device->props.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; |
95 | progearbl_data.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; | 95 | progear_backlight_device->props.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; |
96 | progearbl_set_intensity(progear_backlight_device); | 96 | progearbl_set_intensity(progear_backlight_device); |
97 | 97 | ||
98 | return 0; | 98 | return 0; |
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c index 2a17dfc232f3..af313bf1a2da 100644 --- a/drivers/video/chipsfb.c +++ b/drivers/video/chipsfb.c | |||
@@ -395,7 +395,7 @@ chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) | |||
395 | /* turn on the backlight */ | 395 | /* turn on the backlight */ |
396 | mutex_lock(&pmac_backlight_mutex); | 396 | mutex_lock(&pmac_backlight_mutex); |
397 | if (pmac_backlight) { | 397 | if (pmac_backlight) { |
398 | pmac_backlight->props->power = FB_BLANK_UNBLANK; | 398 | pmac_backlight->props.power = FB_BLANK_UNBLANK; |
399 | backlight_update_status(pmac_backlight); | 399 | backlight_update_status(pmac_backlight); |
400 | } | 400 | } |
401 | mutex_unlock(&pmac_backlight_mutex); | 401 | mutex_unlock(&pmac_backlight_mutex); |
diff --git a/drivers/video/nvidia/nv_backlight.c b/drivers/video/nvidia/nv_backlight.c index 0e2bc519dcab..b7016e9b9e13 100644 --- a/drivers/video/nvidia/nv_backlight.c +++ b/drivers/video/nvidia/nv_backlight.c | |||
@@ -54,11 +54,11 @@ static int nvidia_bl_update_status(struct backlight_device *bd) | |||
54 | if (!par->FlatPanel) | 54 | if (!par->FlatPanel) |
55 | return 0; | 55 | return 0; |
56 | 56 | ||
57 | if (bd->props->power != FB_BLANK_UNBLANK || | 57 | if (bd->props.power != FB_BLANK_UNBLANK || |
58 | bd->props->fb_blank != FB_BLANK_UNBLANK) | 58 | bd->props.fb_blank != FB_BLANK_UNBLANK) |
59 | level = 0; | 59 | level = 0; |
60 | else | 60 | else |
61 | level = bd->props->brightness; | 61 | level = bd->props.brightness; |
62 | 62 | ||
63 | tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF; | 63 | tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF; |
64 | tmp_pcrt = NV_RD32(par->PCRTC0, 0x081C) & 0xFFFFFFFC; | 64 | tmp_pcrt = NV_RD32(par->PCRTC0, 0x081C) & 0xFFFFFFFC; |
@@ -81,13 +81,12 @@ static int nvidia_bl_update_status(struct backlight_device *bd) | |||
81 | 81 | ||
82 | static int nvidia_bl_get_brightness(struct backlight_device *bd) | 82 | static int nvidia_bl_get_brightness(struct backlight_device *bd) |
83 | { | 83 | { |
84 | return bd->props->brightness; | 84 | return bd->props.brightness; |
85 | } | 85 | } |
86 | 86 | ||
87 | static struct backlight_properties nvidia_bl_data = { | 87 | static struct backlight_ops nvidia_bl_ops = { |
88 | .get_brightness = nvidia_bl_get_brightness, | 88 | .get_brightness = nvidia_bl_get_brightness, |
89 | .update_status = nvidia_bl_update_status, | 89 | .update_status = nvidia_bl_update_status, |
90 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | ||
91 | }; | 90 | }; |
92 | 91 | ||
93 | void nvidia_bl_init(struct nvidia_par *par) | 92 | void nvidia_bl_init(struct nvidia_par *par) |
@@ -107,7 +106,7 @@ void nvidia_bl_init(struct nvidia_par *par) | |||
107 | 106 | ||
108 | snprintf(name, sizeof(name), "nvidiabl%d", info->node); | 107 | snprintf(name, sizeof(name), "nvidiabl%d", info->node); |
109 | 108 | ||
110 | bd = backlight_device_register(name, info->dev, par, &nvidia_bl_data); | 109 | bd = backlight_device_register(name, info->dev, par, &nvidia_bl_ops); |
111 | if (IS_ERR(bd)) { | 110 | if (IS_ERR(bd)) { |
112 | info->bl_dev = NULL; | 111 | info->bl_dev = NULL; |
113 | printk(KERN_WARNING "nvidia: Backlight registration failed\n"); | 112 | printk(KERN_WARNING "nvidia: Backlight registration failed\n"); |
@@ -119,8 +118,9 @@ void nvidia_bl_init(struct nvidia_par *par) | |||
119 | 0x158 * FB_BACKLIGHT_MAX / MAX_LEVEL, | 118 | 0x158 * FB_BACKLIGHT_MAX / MAX_LEVEL, |
120 | 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); | 119 | 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); |
121 | 120 | ||
122 | bd->props->brightness = nvidia_bl_data.max_brightness; | 121 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
123 | bd->props->power = FB_BLANK_UNBLANK; | 122 | bd->props.brightness = nvidia_bl_data.max_brightness; |
123 | bd->props.power = FB_BLANK_UNBLANK; | ||
124 | backlight_update_status(bd); | 124 | backlight_update_status(bd); |
125 | 125 | ||
126 | printk("nvidia: Backlight initialized (%s)\n", name); | 126 | printk("nvidia: Backlight initialized (%s)\n", name); |
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 3a75def01b28..f8a3d608b208 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c | |||
@@ -308,11 +308,11 @@ static int riva_bl_update_status(struct backlight_device *bd) | |||
308 | U032 tmp_pcrt, tmp_pmc; | 308 | U032 tmp_pcrt, tmp_pmc; |
309 | int level; | 309 | int level; |
310 | 310 | ||
311 | if (bd->props->power != FB_BLANK_UNBLANK || | 311 | if (bd->props.power != FB_BLANK_UNBLANK || |
312 | bd->props->fb_blank != FB_BLANK_UNBLANK) | 312 | bd->props.fb_blank != FB_BLANK_UNBLANK) |
313 | level = 0; | 313 | level = 0; |
314 | else | 314 | else |
315 | level = bd->props->brightness; | 315 | level = bd->props.brightness; |
316 | 316 | ||
317 | tmp_pmc = par->riva.PMC[0x10F0/4] & 0x0000FFFF; | 317 | tmp_pmc = par->riva.PMC[0x10F0/4] & 0x0000FFFF; |
318 | tmp_pcrt = par->riva.PCRTC0[0x081C/4] & 0xFFFFFFFC; | 318 | tmp_pcrt = par->riva.PCRTC0[0x081C/4] & 0xFFFFFFFC; |
@@ -329,13 +329,12 @@ static int riva_bl_update_status(struct backlight_device *bd) | |||
329 | 329 | ||
330 | static int riva_bl_get_brightness(struct backlight_device *bd) | 330 | static int riva_bl_get_brightness(struct backlight_device *bd) |
331 | { | 331 | { |
332 | return bd->props->brightness; | 332 | return bd->props.brightness; |
333 | } | 333 | } |
334 | 334 | ||
335 | static struct backlight_properties riva_bl_data = { | 335 | static struct backlight_ops riva_bl_ops = { |
336 | .get_brightness = riva_bl_get_brightness, | 336 | .get_brightness = riva_bl_get_brightness, |
337 | .update_status = riva_bl_update_status, | 337 | .update_status = riva_bl_update_status, |
338 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | ||
339 | }; | 338 | }; |
340 | 339 | ||
341 | static void riva_bl_init(struct riva_par *par) | 340 | static void riva_bl_init(struct riva_par *par) |
@@ -355,7 +354,7 @@ static void riva_bl_init(struct riva_par *par) | |||
355 | 354 | ||
356 | snprintf(name, sizeof(name), "rivabl%d", info->node); | 355 | snprintf(name, sizeof(name), "rivabl%d", info->node); |
357 | 356 | ||
358 | bd = backlight_device_register(name, info->dev, par, &riva_bl_data); | 357 | bd = backlight_device_register(name, info->dev, par, &riva_bl_ops); |
359 | if (IS_ERR(bd)) { | 358 | if (IS_ERR(bd)) { |
360 | info->bl_dev = NULL; | 359 | info->bl_dev = NULL; |
361 | printk(KERN_WARNING "riva: Backlight registration failed\n"); | 360 | printk(KERN_WARNING "riva: Backlight registration failed\n"); |
@@ -367,8 +366,9 @@ static void riva_bl_init(struct riva_par *par) | |||
367 | MIN_LEVEL * FB_BACKLIGHT_MAX / MAX_LEVEL, | 366 | MIN_LEVEL * FB_BACKLIGHT_MAX / MAX_LEVEL, |
368 | FB_BACKLIGHT_MAX); | 367 | FB_BACKLIGHT_MAX); |
369 | 368 | ||
370 | bd->props->brightness = riva_bl_data.max_brightness; | 369 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
371 | bd->props->power = FB_BLANK_UNBLANK; | 370 | bd->props.brightness = riva_bl_data.max_brightness; |
371 | bd->props.power = FB_BLANK_UNBLANK; | ||
372 | backlight_update_status(bd); | 372 | backlight_update_status(bd); |
373 | 373 | ||
374 | printk("riva: Backlight initialized (%s)\n", name); | 374 | printk("riva: Backlight initialized (%s)\n", name); |