aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2007-01-30 01:46:43 -0500
committerLen Brown <len.brown@intel.com>2007-01-30 01:46:43 -0500
commit8def05fa82bfa4af0c8e83a00ff377ddd9074480 (patch)
treedd29dc302fff2d524bc1335edfb1e0d77c1ff606 /drivers/misc
parent8b857353237c144113b9bbbf9e0236b3f0e7d315 (diff)
asus-laptop: Lindent
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/asus-laptop.c247
1 files changed, 123 insertions, 124 deletions
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index 6f72cd529556..b6243506add8 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -79,9 +79,9 @@
79#define BT_ON 0x02 //internal Bluetooth 79#define BT_ON 0x02 //internal Bluetooth
80#define MLED_ON 0x04 //mail LED 80#define MLED_ON 0x04 //mail LED
81#define TLED_ON 0x08 //touchpad LED 81#define TLED_ON 0x08 //touchpad LED
82#define RLED_ON 0x10 //Record LED 82#define RLED_ON 0x10 //Record LED
83#define PLED_ON 0x20 //Phone LED 83#define PLED_ON 0x20 //Phone LED
84#define LCD_ON 0x40 //LCD backlight 84#define LCD_ON 0x40 //LCD backlight
85 85
86#define ASUS_LOG ASUS_HOTK_FILE ": " 86#define ASUS_LOG ASUS_HOTK_FILE ": "
87#define ASUS_ERR KERN_ERR ASUS_LOG 87#define ASUS_ERR KERN_ERR ASUS_LOG
@@ -101,8 +101,8 @@ MODULE_LICENSE("GPL");
101/* LED */ 101/* LED */
102ASUS_HANDLE(mled_set, ASUS_HOTK_PREFIX "MLED"); 102ASUS_HANDLE(mled_set, ASUS_HOTK_PREFIX "MLED");
103ASUS_HANDLE(tled_set, ASUS_HOTK_PREFIX "TLED"); 103ASUS_HANDLE(tled_set, ASUS_HOTK_PREFIX "TLED");
104ASUS_HANDLE(rled_set, ASUS_HOTK_PREFIX "RLED"); /* W1JC */ 104ASUS_HANDLE(rled_set, ASUS_HOTK_PREFIX "RLED"); /* W1JC */
105ASUS_HANDLE(pled_set, ASUS_HOTK_PREFIX "PLED"); /* A7J */ 105ASUS_HANDLE(pled_set, ASUS_HOTK_PREFIX "PLED"); /* A7J */
106 106
107/* LEDD */ 107/* LEDD */
108ASUS_HANDLE(ledd_set, ASUS_HOTK_PREFIX "SLCM"); 108ASUS_HANDLE(ledd_set, ASUS_HOTK_PREFIX "SLCM");
@@ -113,53 +113,52 @@ ASUS_HANDLE(ledd_set, ASUS_HOTK_PREFIX "SLCM");
113 */ 113 */
114ASUS_HANDLE(wl_switch, ASUS_HOTK_PREFIX "WLED"); 114ASUS_HANDLE(wl_switch, ASUS_HOTK_PREFIX "WLED");
115ASUS_HANDLE(bt_switch, ASUS_HOTK_PREFIX "BLED"); 115ASUS_HANDLE(bt_switch, ASUS_HOTK_PREFIX "BLED");
116ASUS_HANDLE(wireless_status, ASUS_HOTK_PREFIX "RSTS"); /* All new models */ 116ASUS_HANDLE(wireless_status, ASUS_HOTK_PREFIX "RSTS"); /* All new models */
117 117
118/* Brightness */ 118/* Brightness */
119ASUS_HANDLE(brightness_set, ASUS_HOTK_PREFIX "SPLV"); 119ASUS_HANDLE(brightness_set, ASUS_HOTK_PREFIX "SPLV");
120ASUS_HANDLE(brightness_get, ASUS_HOTK_PREFIX "GPLV"); 120ASUS_HANDLE(brightness_get, ASUS_HOTK_PREFIX "GPLV");
121 121
122/* Backlight */ 122/* Backlight */
123ASUS_HANDLE(lcd_switch, "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */ 123ASUS_HANDLE(lcd_switch, "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */
124 "\\_SB.PCI0.ISA.EC0._Q10", /* A1x */ 124 "\\_SB.PCI0.ISA.EC0._Q10", /* A1x */
125 "\\_SB.PCI0.PX40.ECD0._Q10", /* L3C */ 125 "\\_SB.PCI0.PX40.ECD0._Q10", /* L3C */
126 "\\_SB.PCI0.PX40.EC0.Q10", /* M1A */ 126 "\\_SB.PCI0.PX40.EC0.Q10", /* M1A */
127 "\\_SB.PCI0.LPCB.EC0._Q10", /* P30 */ 127 "\\_SB.PCI0.LPCB.EC0._Q10", /* P30 */
128 "\\_SB.PCI0.PX40.Q10", /* S1x */ 128 "\\_SB.PCI0.PX40.Q10", /* S1x */
129 "\\Q10"); /* A2x, L2D, L3D, M2E */ 129 "\\Q10"); /* A2x, L2D, L3D, M2E */
130 130
131/* Display */ 131/* Display */
132ASUS_HANDLE(display_set, ASUS_HOTK_PREFIX "SDSP"); 132ASUS_HANDLE(display_set, ASUS_HOTK_PREFIX "SDSP");
133ASUS_HANDLE(display_get, 133ASUS_HANDLE(display_get, "\\_SB.PCI0.P0P1.VGA.GETD", /* A6B, A6K A6R A7D F3JM L4R M6R A3G
134 "\\_SB.PCI0.P0P1.VGA.GETD", /* A6B, A6K A6R A7D F3JM L4R M6R A3G 134 M6A M6V VX-1 V6J V6V W3Z */
135 M6A M6V VX-1 V6J V6V W3Z */ 135 "\\_SB.PCI0.P0P2.VGA.GETD", /* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V
136 "\\_SB.PCI0.P0P2.VGA.GETD", /* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V
137 S5A M5A z33A W1Jc W2V */ 136 S5A M5A z33A W1Jc W2V */
138 "\\_SB.PCI0.P0P3.VGA.GETD", /* A6V A6Q */ 137 "\\_SB.PCI0.P0P3.VGA.GETD", /* A6V A6Q */
139 "\\_SB.PCI0.P0PA.VGA.GETD", /* A6T, A6M */ 138 "\\_SB.PCI0.P0PA.VGA.GETD", /* A6T, A6M */
140 "\\_SB.PCI0.PCI1.VGAC.NMAP", /* L3C */ 139 "\\_SB.PCI0.PCI1.VGAC.NMAP", /* L3C */
141 "\\_SB.PCI0.VGA.GETD", /* Z96F */ 140 "\\_SB.PCI0.VGA.GETD", /* Z96F */
142 "\\ACTD", /* A2D */ 141 "\\ACTD", /* A2D */
143 "\\ADVG", /* A4G Z71A W1N W5A W5F M2N M3N M5N M6N S1N S5N */ 142 "\\ADVG", /* A4G Z71A W1N W5A W5F M2N M3N M5N M6N S1N S5N */
144 "\\DNXT", /* P30 */ 143 "\\DNXT", /* P30 */
145 "\\INFB", /* A2H D1 L2D L3D L3H L2E L5D L5C M1A M2E L4L W3V */ 144 "\\INFB", /* A2H D1 L2D L3D L3H L2E L5D L5C M1A M2E L4L W3V */
146 "\\SSTE"); /* A3F A6F A3N A3L M6N W3N W6A */ 145 "\\SSTE"); /* A3F A6F A3N A3L M6N W3N W6A */
147 146
148ASUS_HANDLE(ls_switch, ASUS_HOTK_PREFIX "ALSC"); /* Z71A Z71V */ 147ASUS_HANDLE(ls_switch, ASUS_HOTK_PREFIX "ALSC"); /* Z71A Z71V */
149ASUS_HANDLE(ls_level, ASUS_HOTK_PREFIX "ALSL"); /* Z71A Z71V */ 148ASUS_HANDLE(ls_level, ASUS_HOTK_PREFIX "ALSL"); /* Z71A Z71V */
150 149
151/* 150/*
152 * This is the main structure, we can use it to store anything interesting 151 * This is the main structure, we can use it to store anything interesting
153 * about the hotk device 152 * about the hotk device
154 */ 153 */
155struct asus_hotk { 154struct asus_hotk {
156 char *name; //laptop name 155 char *name; //laptop name
157 struct acpi_device *device; //the device we are in 156 struct acpi_device *device; //the device we are in
158 acpi_handle handle; //the handle of the hotk device 157 acpi_handle handle; //the handle of the hotk device
159 char status; //status of the hotk, for LEDs, ... 158 char status; //status of the hotk, for LEDs, ...
160 u32 ledd_status; //status of the LED display 159 u32 ledd_status; //status of the LED display
161 u8 light_level; //light sensor level 160 u8 light_level; //light sensor level
162 u8 light_switch; //light sensor switch value 161 u8 light_switch; //light sensor switch value
163 u16 event_count[128]; //count for each event TODO make this better 162 u16 event_count[128]; //count for each event TODO make this better
164}; 163};
165 164
@@ -197,10 +196,10 @@ static struct backlight_device *asus_backlight_device;
197static int read_brightness(struct backlight_device *bd); 196static int read_brightness(struct backlight_device *bd);
198static int update_bl_status(struct backlight_device *bd); 197static int update_bl_status(struct backlight_device *bd);
199static struct backlight_properties asusbl_data = { 198static struct backlight_properties asusbl_data = {
200 .owner = THIS_MODULE, 199 .owner = THIS_MODULE,
201 .get_brightness = read_brightness, 200 .get_brightness = read_brightness,
202 .update_status = update_bl_status, 201 .update_status = update_bl_status,
203 .max_brightness = 15, 202 .max_brightness = 15,
204}; 203};
205 204
206/* These functions actually update the LED's, and are called from a 205/* These functions actually update the LED's, and are called from a
@@ -263,7 +262,8 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val,
263 return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER); 262 return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER);
264} 263}
265 264
266static int read_wireless_status(int mask) { 265static int read_wireless_status(int mask)
266{
267 int status; 267 int status;
268 268
269 if (!wireless_status_handle) 269 if (!wireless_status_handle)
@@ -287,8 +287,7 @@ static int read_status(int mask)
287 return (hotk->status & mask) ? 1 : 0; 287 return (hotk->status & mask) ? 1 : 0;
288} 288}
289 289
290static void write_status(acpi_handle handle, int out, int mask, 290static void write_status(acpi_handle handle, int out, int mask, int invert)
291 int invert)
292{ 291{
293 hotk->status = (out) ? (hotk->status | mask) : (hotk->status & ~mask); 292 hotk->status = (out) ? (hotk->status | mask) : (hotk->status & ~mask);
294 293
@@ -333,7 +332,7 @@ static int set_lcd_state(int value)
333 if (lcd == get_lcd_state()) 332 if (lcd == get_lcd_state())
334 return 0; 333 return 0;
335 334
336 if(lcd_switch_handle) { 335 if (lcd_switch_handle) {
337 status = acpi_evaluate_object(lcd_switch_handle, 336 status = acpi_evaluate_object(lcd_switch_handle,
338 NULL, NULL, NULL); 337 NULL, NULL, NULL);
339 338
@@ -349,12 +348,12 @@ static void lcd_blank(int blank)
349{ 348{
350 struct backlight_device *bd = asus_backlight_device; 349 struct backlight_device *bd = asus_backlight_device;
351 350
352 if(bd) { 351 if (bd) {
353 down(&bd->sem); 352 down(&bd->sem);
354 if(likely(bd->props)) { 353 if (likely(bd->props)) {
355 bd->props->power = blank; 354 bd->props->power = blank;
356 if(likely(bd->props->update_status)) 355 if (likely(bd->props->update_status))
357 bd->props->update_status(bd); 356 bd->props->update_status(bd);
358 } 357 }
359 up(&bd->sem); 358 up(&bd->sem);
360 } 359 }
@@ -391,7 +390,7 @@ static int update_bl_status(struct backlight_device *bd)
391 int value = bd->props->brightness; 390 int value = bd->props->brightness;
392 391
393 rv = set_brightness(bd, value); 392 rv = set_brightness(bd, value);
394 if(rv) 393 if (rv)
395 return rv; 394 return rv;
396 395
397 value = (bd->props->power == FB_BLANK_UNBLANK) ? 1 : 0; 396 value = (bd->props->power == FB_BLANK_UNBLANK) ? 1 : 0;
@@ -408,7 +407,7 @@ static int update_bl_status(struct backlight_device *bd)
408 * number of bytes written in page 407 * number of bytes written in page
409 */ 408 */
410static ssize_t show_infos(struct device *dev, 409static ssize_t show_infos(struct device *dev,
411 struct device_attribute *attr, char *page) 410 struct device_attribute *attr, char *page)
412{ 411{
413 int len = 0; 412 int len = 0;
414 int temp; 413 int temp;
@@ -535,8 +534,9 @@ static ssize_t show_bluetooth(struct device *dev,
535 return sprintf(buf, "%d\n", read_status(BT_ON)); 534 return sprintf(buf, "%d\n", read_status(BT_ON));
536} 535}
537 536
538static ssize_t store_bluetooth(struct device *dev, struct device_attribute *attr, 537static ssize_t store_bluetooth(struct device *dev,
539 const char *buf, size_t count) 538 struct device_attribute *attr, const char *buf,
539 size_t count)
540{ 540{
541 return store_status(buf, count, bt_switch_handle, BT_ON, 0); 541 return store_status(buf, count, bt_switch_handle, BT_ON, 0);
542} 542}
@@ -558,7 +558,7 @@ static int read_display(void)
558 558
559 /* In most of the case, we know how to set the display, but sometime 559 /* In most of the case, we know how to set the display, but sometime
560 we can't read it */ 560 we can't read it */
561 if(display_get_handle) { 561 if (display_get_handle) {
562 if (!read_acpi_int(display_get_handle, NULL, &value, NULL)) 562 if (!read_acpi_int(display_get_handle, NULL, &value, NULL))
563 printk(ASUS_WARNING "Error reading display status\n"); 563 printk(ASUS_WARNING "Error reading display status\n");
564 } 564 }
@@ -567,6 +567,7 @@ static int read_display(void)
567 567
568 return value; 568 return value;
569} 569}
570
570/* 571/*
571 * Now, *this* one could be more user-friendly, but so far, no-one has 572 * Now, *this* one could be more user-friendly, but so far, no-one has
572 * complained. The significance of bits is the same as in store_disp() 573 * complained. The significance of bits is the same as in store_disp()
@@ -664,7 +665,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
664 if (event == ATKD_LCD_ON) { 665 if (event == ATKD_LCD_ON) {
665 write_status(NULL, 1, LCD_ON, 0); 666 write_status(NULL, 1, LCD_ON, 0);
666 lcd_blank(FB_BLANK_UNBLANK); 667 lcd_blank(FB_BLANK_UNBLANK);
667 } else if(event == ATKD_LCD_OFF) { 668 } else if (event == ATKD_LCD_OFF) {
668 write_status(NULL, 0, LCD_ON, 0); 669 write_status(NULL, 0, LCD_ON, 0);
669 lcd_blank(FB_BLANK_POWERDOWN); 670 lcd_blank(FB_BLANK_POWERDOWN);
670 } 671 }
@@ -701,30 +702,29 @@ static ASUS_CREATE_DEVICE_ATTR(ls_switch);
701static ASUS_CREATE_DEVICE_ATTR(ls_level); 702static ASUS_CREATE_DEVICE_ATTR(ls_level);
702 703
703static struct attribute *asuspf_attributes[] = { 704static struct attribute *asuspf_attributes[] = {
704 &dev_attr_infos.attr, 705 &dev_attr_infos.attr,
705 &dev_attr_wlan.attr, 706 &dev_attr_wlan.attr,
706 &dev_attr_bluetooth.attr, 707 &dev_attr_bluetooth.attr,
707 &dev_attr_display.attr, 708 &dev_attr_display.attr,
708 &dev_attr_ledd.attr, 709 &dev_attr_ledd.attr,
709 &dev_attr_ls_switch.attr, 710 &dev_attr_ls_switch.attr,
710 &dev_attr_ls_level.attr, 711 &dev_attr_ls_level.attr,
711 NULL 712 NULL
712}; 713};
713 714
714static struct attribute_group asuspf_attribute_group = { 715static struct attribute_group asuspf_attribute_group = {
715 .attrs = asuspf_attributes 716 .attrs = asuspf_attributes
716}; 717};
717 718
718static struct platform_driver asuspf_driver = { 719static struct platform_driver asuspf_driver = {
719 .driver = { 720 .driver = {
720 .name = ASUS_HOTK_FILE, 721 .name = ASUS_HOTK_FILE,
721 .owner = THIS_MODULE, 722 .owner = THIS_MODULE,
722 } 723 }
723}; 724};
724 725
725static struct platform_device *asuspf_device; 726static struct platform_device *asuspf_device;
726 727
727
728static void asus_hotk_add_fs(void) 728static void asus_hotk_add_fs(void)
729{ 729{
730 ASUS_SET_DEVICE_ATTR(infos, 0444, show_infos, NULL); 730 ASUS_SET_DEVICE_ATTR(infos, 0444, show_infos, NULL);
@@ -738,7 +738,7 @@ static void asus_hotk_add_fs(void)
738 738
739 if (display_set_handle && display_get_handle) 739 if (display_set_handle && display_get_handle)
740 ASUS_SET_DEVICE_ATTR(display, 0644, show_disp, store_disp); 740 ASUS_SET_DEVICE_ATTR(display, 0644, show_disp, store_disp);
741 else if(display_set_handle) 741 else if (display_set_handle)
742 ASUS_SET_DEVICE_ATTR(display, 0200, NULL, store_disp); 742 ASUS_SET_DEVICE_ATTR(display, 0200, NULL, store_disp);
743 743
744 if (ledd_set_handle) 744 if (ledd_set_handle)
@@ -750,7 +750,7 @@ static void asus_hotk_add_fs(void)
750 } 750 }
751} 751}
752 752
753static int asus_handle_init(char *name, acpi_handle *handle, 753static int asus_handle_init(char *name, acpi_handle * handle,
754 char **paths, int num_paths) 754 char **paths, int num_paths)
755{ 755{
756 int i; 756 int i;
@@ -770,7 +770,6 @@ static int asus_handle_init(char *name, acpi_handle *handle,
770 asus_handle_init(#object, &object##_handle, object##_paths, \ 770 asus_handle_init(#object, &object##_handle, object##_paths, \
771 ARRAY_SIZE(object##_paths)) 771 ARRAY_SIZE(object##_paths))
772 772
773
774/* 773/*
775 * This function is used to initialize the hotk with right values. In this 774 * This function is used to initialize the hotk with right values. In this
776 * method, we can make all the detection we want, and modify the hotk struct 775 * method, we can make all the detection we want, and modify the hotk struct
@@ -835,7 +834,7 @@ static int asus_hotk_get_info(void)
835 if (!hotk->name) 834 if (!hotk->name)
836 return -ENOMEM; 835 return -ENOMEM;
837 836
838 if(*string) 837 if (*string)
839 printk(ASUS_NOTICE " %s model detected\n", string); 838 printk(ASUS_NOTICE " %s model detected\n", string);
840 839
841 ASUS_HANDLE_INIT(mled_set); 840 ASUS_HANDLE_INIT(mled_set);
@@ -854,9 +853,9 @@ static int asus_hotk_get_info(void)
854 if (!read_acpi_int(hotk->handle, "HRWS", &hwrs_result, NULL)) 853 if (!read_acpi_int(hotk->handle, "HRWS", &hwrs_result, NULL))
855 hwrs_result = WL_HWRS | BT_HWRS; 854 hwrs_result = WL_HWRS | BT_HWRS;
856 855
857 if(hwrs_result & WL_HWRS) 856 if (hwrs_result & WL_HWRS)
858 ASUS_HANDLE_INIT(wl_switch); 857 ASUS_HANDLE_INIT(wl_switch);
859 if(hwrs_result & BT_HWRS) 858 if (hwrs_result & BT_HWRS)
860 ASUS_HANDLE_INIT(bt_switch); 859 ASUS_HANDLE_INIT(bt_switch);
861 860
862 ASUS_HANDLE_INIT(wireless_status); 861 ASUS_HANDLE_INIT(wireless_status);
@@ -871,7 +870,7 @@ static int asus_hotk_get_info(void)
871 870
872 /* There is a lot of models with "ALSL", but a few get 871 /* There is a lot of models with "ALSL", but a few get
873 a real light sens, so we need to check it. */ 872 a real light sens, so we need to check it. */
874 if(ASUS_HANDLE_INIT(ls_switch)) 873 if (ASUS_HANDLE_INIT(ls_switch))
875 ASUS_HANDLE_INIT(ls_level); 874 ASUS_HANDLE_INIT(ls_level);
876 875
877 kfree(model); 876 kfree(model);
@@ -948,15 +947,15 @@ static int asus_hotk_add(struct acpi_device *device)
948 /* LED display is off by default */ 947 /* LED display is off by default */
949 hotk->ledd_status = 0xFFF; 948 hotk->ledd_status = 0xFFF;
950 949
951 /* Set initial values of light sensor and level */ 950 /* Set initial values of light sensor and level */
952 hotk->light_switch = 1; /* Default to light sensor disabled */ 951 hotk->light_switch = 1; /* Default to light sensor disabled */
953 hotk->light_level = 0; /* level 5 for sensor sensitivity */ 952 hotk->light_level = 0; /* level 5 for sensor sensitivity */
954 953
955 if (ls_switch_handle) 954 if (ls_switch_handle)
956 set_light_sens_switch(hotk->light_switch); 955 set_light_sens_switch(hotk->light_switch);
957 956
958 if (ls_level_handle) 957 if (ls_level_handle)
959 set_light_sens_level(hotk->light_level); 958 set_light_sens_level(hotk->light_level);
960 959
961 end: 960 end:
962 if (result) { 961 if (result) {
@@ -987,7 +986,7 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
987 986
988static void asus_backlight_exit(void) 987static void asus_backlight_exit(void)
989{ 988{
990 if(asus_backlight_device) 989 if (asus_backlight_device)
991 backlight_device_unregister(asus_backlight_device); 990 backlight_device_unregister(asus_backlight_device);
992} 991}
993 992
@@ -1012,21 +1011,21 @@ static void __exit asus_laptop_exit(void)
1012 asus_led_exit(); 1011 asus_led_exit();
1013 1012
1014 acpi_bus_unregister_driver(&asus_hotk_driver); 1013 acpi_bus_unregister_driver(&asus_hotk_driver);
1015 sysfs_remove_group(&asuspf_device->dev.kobj, &asuspf_attribute_group); 1014 sysfs_remove_group(&asuspf_device->dev.kobj, &asuspf_attribute_group);
1016 platform_device_unregister(asuspf_device); 1015 platform_device_unregister(asuspf_device);
1017 platform_driver_unregister(&asuspf_driver); 1016 platform_driver_unregister(&asuspf_driver);
1018 1017
1019 kfree(asus_info); 1018 kfree(asus_info);
1020} 1019}
1021 1020
1022static int asus_backlight_init(struct device * dev) 1021static int asus_backlight_init(struct device *dev)
1023{ 1022{
1024 struct backlight_device *bd; 1023 struct backlight_device *bd;
1025 1024
1026 if(brightness_set_handle && lcd_switch_handle) { 1025 if (brightness_set_handle && lcd_switch_handle) {
1027 bd = backlight_device_register (ASUS_HOTK_FILE, dev, 1026 bd = backlight_device_register(ASUS_HOTK_FILE, dev,
1028 NULL, &asusbl_data); 1027 NULL, &asusbl_data);
1029 if (IS_ERR (bd)) { 1028 if (IS_ERR(bd)) {
1030 printk(ASUS_ERR 1029 printk(ASUS_ERR
1031 "Could not register asus backlight device\n"); 1030 "Could not register asus backlight device\n");
1032 asus_backlight_device = NULL; 1031 asus_backlight_device = NULL;
@@ -1036,11 +1035,11 @@ static int asus_backlight_init(struct device * dev)
1036 asus_backlight_device = bd; 1035 asus_backlight_device = bd;
1037 1036
1038 down(&bd->sem); 1037 down(&bd->sem);
1039 if(likely(bd->props)) { 1038 if (likely(bd->props)) {
1040 bd->props->brightness = read_brightness(NULL); 1039 bd->props->brightness = read_brightness(NULL);
1041 bd->props->power = FB_BLANK_UNBLANK; 1040 bd->props->power = FB_BLANK_UNBLANK;
1042 if(likely(bd->props->update_status)) 1041 if (likely(bd->props->update_status))
1043 bd->props->update_status(bd); 1042 bd->props->update_status(bd);
1044 } 1043 }
1045 up(&bd->sem); 1044 up(&bd->sem);
1046 } 1045 }
@@ -1048,39 +1047,39 @@ static int asus_backlight_init(struct device * dev)
1048} 1047}
1049 1048
1050static int asus_led_register(acpi_handle handle, 1049static int asus_led_register(acpi_handle handle,
1051 struct led_classdev * ldev, 1050 struct led_classdev *ldev, struct device *dev)
1052 struct device * dev)
1053{ 1051{
1054 if(!handle) 1052 if (!handle)
1055 return 0; 1053 return 0;
1056 1054
1057 return led_classdev_register(dev, ldev); 1055 return led_classdev_register(dev, ldev);
1058} 1056}
1057
1059#define ASUS_LED_REGISTER(object, device) \ 1058#define ASUS_LED_REGISTER(object, device) \
1060 asus_led_register(object##_set_handle, &object##_led, device) 1059 asus_led_register(object##_set_handle, &object##_led, device)
1061 1060
1062static int asus_led_init(struct device * dev) 1061static int asus_led_init(struct device *dev)
1063{ 1062{
1064 int rv; 1063 int rv;
1065 1064
1066 rv = ASUS_LED_REGISTER(mled, dev); 1065 rv = ASUS_LED_REGISTER(mled, dev);
1067 if(rv) 1066 if (rv)
1068 return rv; 1067 return rv;
1069 1068
1070 rv = ASUS_LED_REGISTER(tled, dev); 1069 rv = ASUS_LED_REGISTER(tled, dev);
1071 if(rv) 1070 if (rv)
1072 return rv; 1071 return rv;
1073 1072
1074 rv = ASUS_LED_REGISTER(rled, dev); 1073 rv = ASUS_LED_REGISTER(rled, dev);
1075 if(rv) 1074 if (rv)
1076 return rv; 1075 return rv;
1077 1076
1078 rv = ASUS_LED_REGISTER(pled, dev); 1077 rv = ASUS_LED_REGISTER(pled, dev);
1079 if(rv) 1078 if (rv)
1080 return rv; 1079 return rv;
1081 1080
1082 led_workqueue = create_singlethread_workqueue("led_workqueue"); 1081 led_workqueue = create_singlethread_workqueue("led_workqueue");
1083 if(!led_workqueue) 1082 if (!led_workqueue)
1084 return -ENOMEM; 1083 return -ENOMEM;
1085 1084
1086 return 0; 1085 return 0;
@@ -1118,51 +1117,51 @@ static int __init asus_laptop_init(void)
1118 dev = acpi_get_physical_device(hotk->device->handle); 1117 dev = acpi_get_physical_device(hotk->device->handle);
1119 1118
1120 result = asus_backlight_init(dev); 1119 result = asus_backlight_init(dev);
1121 if(result) 1120 if (result)
1122 goto fail_backlight; 1121 goto fail_backlight;
1123 1122
1124 result = asus_led_init(dev); 1123 result = asus_led_init(dev);
1125 if(result) 1124 if (result)
1126 goto fail_led; 1125 goto fail_led;
1127 1126
1128 /* Register platform stuff */ 1127 /* Register platform stuff */
1129 result = platform_driver_register(&asuspf_driver); 1128 result = platform_driver_register(&asuspf_driver);
1130 if (result) 1129 if (result)
1131 goto fail_platform_driver; 1130 goto fail_platform_driver;
1132 1131
1133 asuspf_device = platform_device_alloc(ASUS_HOTK_FILE, -1); 1132 asuspf_device = platform_device_alloc(ASUS_HOTK_FILE, -1);
1134 if (!asuspf_device) { 1133 if (!asuspf_device) {
1135 result = -ENOMEM; 1134 result = -ENOMEM;
1136 goto fail_platform_device1; 1135 goto fail_platform_device1;
1137 } 1136 }
1138 1137
1139 result = platform_device_add(asuspf_device); 1138 result = platform_device_add(asuspf_device);
1140 if (result) 1139 if (result)
1141 goto fail_platform_device2; 1140 goto fail_platform_device2;
1142 1141
1143 result = sysfs_create_group(&asuspf_device->dev.kobj, 1142 result = sysfs_create_group(&asuspf_device->dev.kobj,
1144 &asuspf_attribute_group); 1143 &asuspf_attribute_group);
1145 if (result) 1144 if (result)
1146 goto fail_sysfs; 1145 goto fail_sysfs;
1147 1146
1148 return 0; 1147 return 0;
1149 1148
1150fail_sysfs: 1149 fail_sysfs:
1151 platform_device_del(asuspf_device); 1150 platform_device_del(asuspf_device);
1152 1151
1153fail_platform_device2: 1152 fail_platform_device2:
1154 platform_device_put(asuspf_device); 1153 platform_device_put(asuspf_device);
1155 1154
1156fail_platform_device1: 1155 fail_platform_device1:
1157 platform_driver_unregister(&asuspf_driver); 1156 platform_driver_unregister(&asuspf_driver);
1158 1157
1159fail_platform_driver: 1158 fail_platform_driver:
1160 asus_led_exit(); 1159 asus_led_exit();
1161 1160
1162fail_led: 1161 fail_led:
1163 asus_backlight_exit(); 1162 asus_backlight_exit();
1164 1163
1165fail_backlight: 1164 fail_backlight:
1166 1165
1167 return result; 1166 return result;
1168} 1167}