aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/asus-laptop.c
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-02-10 18:07:48 -0500
committerRichard Purdie <rpurdie@rpsys.net>2007-02-20 04:26:53 -0500
commit599a52d12629394236d785615808845823875868 (patch)
tree4e2dfa3a25ce761be0ecc0490acabac553f77a67 /drivers/misc/asus-laptop.c
parent321709c5994f952b78d567fd7083dbebbdc381b7 (diff)
backlight: Separate backlight properties from backlight ops pointers
Per device data such as brightness belongs to the indivdual device and should therefore be separate from the the backlight operation function pointers. This patch splits the two types of data and allows simplifcation of some code. Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/misc/asus-laptop.c')
-rw-r--r--drivers/misc/asus-laptop.c16
1 files changed, 8 insertions, 8 deletions
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 */
196static int read_brightness(struct backlight_device *bd); 196static int read_brightness(struct backlight_device *bd);
197static int update_bl_status(struct backlight_device *bd); 197static int update_bl_status(struct backlight_device *bd);
198static struct backlight_properties asusbl_data = { 198static 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)
381static int update_bl_status(struct backlight_device *bd) 380static 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;