aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/asus-laptop.c31
-rw-r--r--drivers/misc/msi-laptop.c10
-rw-r--r--drivers/misc/sony-laptop.c16
3 files changed, 24 insertions, 33 deletions
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index e4e2b707a353..295e931c0dfb 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -195,11 +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 .owner = THIS_MODULE,
200 .get_brightness = read_brightness, 199 .get_brightness = read_brightness,
201 .update_status = update_bl_status, 200 .update_status = update_bl_status,
202 .max_brightness = 15,
203}; 201};
204 202
205/* 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
@@ -349,13 +347,8 @@ static void lcd_blank(int blank)
349 struct backlight_device *bd = asus_backlight_device; 347 struct backlight_device *bd = asus_backlight_device;
350 348
351 if (bd) { 349 if (bd) {
352 down(&bd->sem); 350 bd->props.power = blank;
353 if (likely(bd->props)) { 351 backlight_update_status(bd);
354 bd->props->power = blank;
355 if (likely(bd->props->update_status))
356 bd->props->update_status(bd);
357 }
358 up(&bd->sem);
359 } 352 }
360} 353}
361 354
@@ -387,13 +380,13 @@ static int set_brightness(struct backlight_device *bd, int value)
387static int update_bl_status(struct backlight_device *bd) 380static int update_bl_status(struct backlight_device *bd)
388{ 381{
389 int rv; 382 int rv;
390 int value = bd->props->brightness; 383 int value = bd->props.brightness;
391 384
392 rv = set_brightness(bd, value); 385 rv = set_brightness(bd, value);
393 if (rv) 386 if (rv)
394 return rv; 387 return rv;
395 388
396 value = (bd->props->power == FB_BLANK_UNBLANK) ? 1 : 0; 389 value = (bd->props.power == FB_BLANK_UNBLANK) ? 1 : 0;
397 return set_lcd_state(value); 390 return set_lcd_state(value);
398} 391}
399 392
@@ -1019,7 +1012,7 @@ static int asus_backlight_init(struct device *dev)
1019 1012
1020 if (brightness_set_handle && lcd_switch_handle) { 1013 if (brightness_set_handle && lcd_switch_handle) {
1021 bd = backlight_device_register(ASUS_HOTK_FILE, dev, 1014 bd = backlight_device_register(ASUS_HOTK_FILE, dev,
1022 NULL, &asusbl_data); 1015 NULL, &asusbl_ops);
1023 if (IS_ERR(bd)) { 1016 if (IS_ERR(bd)) {
1024 printk(ASUS_ERR 1017 printk(ASUS_ERR
1025 "Could not register asus backlight device\n"); 1018 "Could not register asus backlight device\n");
@@ -1029,14 +1022,10 @@ static int asus_backlight_init(struct device *dev)
1029 1022
1030 asus_backlight_device = bd; 1023 asus_backlight_device = bd;
1031 1024
1032 down(&bd->sem); 1025 bd->props.max_brightness = 15;
1033 if (likely(bd->props)) { 1026 bd->props.brightness = read_brightness(NULL);
1034 bd->props->brightness = read_brightness(NULL); 1027 bd->props.power = FB_BLANK_UNBLANK;
1035 bd->props->power = FB_BLANK_UNBLANK; 1028 backlight_update_status(bd);
1036 if (likely(bd->props->update_status))
1037 bd->props->update_status(bd);
1038 }
1039 up(&bd->sem);
1040 } 1029 }
1041 return 0; 1030 return 0;
1042} 1031}
diff --git a/drivers/misc/msi-laptop.c b/drivers/misc/msi-laptop.c
index 8e5e07e4c1cf..68c4b58525ba 100644
--- a/drivers/misc/msi-laptop.c
+++ b/drivers/misc/msi-laptop.c
@@ -157,14 +157,12 @@ static int bl_get_brightness(struct backlight_device *b)
157 157
158static int bl_update_status(struct backlight_device *b) 158static 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
163static struct backlight_properties msibl_props = { 163static struct backlight_ops msibl_ops = {
164 .owner = THIS_MODULE,
165 .get_brightness = bl_get_brightness, 164 .get_brightness = bl_get_brightness,
166 .update_status = bl_update_status, 165 .update_status = bl_update_status,
167 .max_brightness = MSI_LCD_LEVEL_MAX-1,
168}; 166};
169 167
170static struct backlight_device *msibl_device; 168static struct backlight_device *msibl_device;
@@ -318,10 +316,12 @@ static int __init msi_init(void)
318 /* Register backlight stuff */ 316 /* Register backlight stuff */
319 317
320 msibl_device = backlight_device_register("msi-laptop-bl", NULL, NULL, 318 msibl_device = backlight_device_register("msi-laptop-bl", NULL, NULL,
321 &msibl_props); 319 &msibl_ops);
322 if (IS_ERR(msibl_device)) 320 if (IS_ERR(msibl_device))
323 return PTR_ERR(msibl_device); 321 return PTR_ERR(msibl_device);
324 322
323 msibl_device->props.max_brightness = MSI_LCD_LEVEL_MAX-1,
324
325 ret = platform_driver_register(&msipf_driver); 325 ret = platform_driver_register(&msipf_driver);
326 if (ret) 326 if (ret)
327 goto fail_backlight; 327 goto fail_backlight;
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index cabbed0015e4..2ebe240dd537 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -384,7 +384,7 @@ static void sony_snc_pf_remove(void)
384static int sony_backlight_update_status(struct backlight_device *bd) 384static int sony_backlight_update_status(struct backlight_device *bd)
385{ 385{
386 return acpi_callsetfunc(sony_acpi_handle, "SBRT", 386 return acpi_callsetfunc(sony_acpi_handle, "SBRT",
387 bd->props->brightness + 1, NULL); 387 bd->props.brightness + 1, NULL);
388} 388}
389 389
390static int sony_backlight_get_brightness(struct backlight_device *bd) 390static int sony_backlight_get_brightness(struct backlight_device *bd)
@@ -398,11 +398,9 @@ static int sony_backlight_get_brightness(struct backlight_device *bd)
398} 398}
399 399
400static struct backlight_device *sony_backlight_device; 400static struct backlight_device *sony_backlight_device;
401static struct backlight_properties sony_backlight_properties = { 401static struct backlight_ops sony_backlight_ops = {
402 .owner = THIS_MODULE,
403 .update_status = sony_backlight_update_status, 402 .update_status = sony_backlight_update_status,
404 .get_brightness = sony_backlight_get_brightness, 403 .get_brightness = sony_backlight_get_brightness,
405 .max_brightness = SONY_MAX_BRIGHTNESS - 1,
406}; 404};
407 405
408/* 406/*
@@ -484,15 +482,19 @@ static int sony_acpi_add(struct acpi_device *device)
484 if (ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle, "GBRT", &handle))) { 482 if (ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle, "GBRT", &handle))) {
485 sony_backlight_device = backlight_device_register("sony", NULL, 483 sony_backlight_device = backlight_device_register("sony", NULL,
486 NULL, 484 NULL,
487 &sony_backlight_properties); 485 &sony_backlight_ops);
488 486
489 if (IS_ERR(sony_backlight_device)) { 487 if (IS_ERR(sony_backlight_device)) {
490 printk(LOG_PFX "unable to register backlight device\n"); 488 printk(LOG_PFX "unable to register backlight device\n");
491 sony_backlight_device = NULL; 489 sony_backlight_device = NULL;
492 } else 490 } else {
493 sony_backlight_properties.brightness = 491 sony_backlight_device->props.brightness =
494 sony_backlight_get_brightness 492 sony_backlight_get_brightness
495 (sony_backlight_device); 493 (sony_backlight_device);
494 sony_backlight_device->props.max_brightness =
495 SONY_MAX_BRIGHTNESS - 1;
496 }
497
496 } 498 }
497 499
498 if (sony_snc_pf_add()) 500 if (sony_snc_pf_add())