aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/asus_acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/asus_acpi.c')
-rw-r--r--drivers/acpi/asus_acpi.c227
1 files changed, 114 insertions, 113 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index d3d0886d637f..1e74988c7b2d 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -42,7 +42,7 @@
42 42
43#define ASUS_ACPI_VERSION "0.30" 43#define ASUS_ACPI_VERSION "0.30"
44 44
45#define PROC_ASUS "asus" //the directory 45#define PROC_ASUS "asus" /* The directory */
46#define PROC_MLED "mled" 46#define PROC_MLED "mled"
47#define PROC_WLED "wled" 47#define PROC_WLED "wled"
48#define PROC_TLED "tled" 48#define PROC_TLED "tled"
@@ -66,10 +66,10 @@
66/* 66/*
67 * Flags for hotk status 67 * Flags for hotk status
68 */ 68 */
69#define MLED_ON 0x01 //mail LED 69#define MLED_ON 0x01 /* Mail LED */
70#define WLED_ON 0x02 //wireless LED 70#define WLED_ON 0x02 /* Wireless LED */
71#define TLED_ON 0x04 //touchpad LED 71#define TLED_ON 0x04 /* Touchpad LED */
72#define BT_ON 0x08 //internal Bluetooth 72#define BT_ON 0x08 /* Internal Bluetooth */
73 73
74MODULE_AUTHOR("Julien Lerouge, Karol Kozimor"); 74MODULE_AUTHOR("Julien Lerouge, Karol Kozimor");
75MODULE_DESCRIPTION(ACPI_HOTK_NAME); 75MODULE_DESCRIPTION(ACPI_HOTK_NAME);
@@ -82,28 +82,28 @@ MODULE_PARM_DESC(asus_uid, "UID for entries in /proc/acpi/asus");
82module_param(asus_gid, uint, 0); 82module_param(asus_gid, uint, 0);
83MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus"); 83MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus");
84 84
85/* For each model, all features implemented, 85/* For each model, all features implemented,
86 * those marked with R are relative to HOTK, A for absolute */ 86 * those marked with R are relative to HOTK, A for absolute */
87struct model_data { 87struct model_data {
88 char *name; //name of the laptop________________A 88 char *name; /* name of the laptop________________A */
89 char *mt_mled; //method to handle mled_____________R 89 char *mt_mled; /* method to handle mled_____________R */
90 char *mled_status; //node to handle mled reading_______A 90 char *mled_status; /* node to handle mled reading_______A */
91 char *mt_wled; //method to handle wled_____________R 91 char *mt_wled; /* method to handle wled_____________R */
92 char *wled_status; //node to handle wled reading_______A 92 char *wled_status; /* node to handle wled reading_______A */
93 char *mt_tled; //method to handle tled_____________R 93 char *mt_tled; /* method to handle tled_____________R */
94 char *tled_status; //node to handle tled reading_______A 94 char *tled_status; /* node to handle tled reading_______A */
95 char *mt_ledd; //method to handle LED display______R 95 char *mt_ledd; /* method to handle LED display______R */
96 char *mt_bt_switch; //method to switch Bluetooth on/off_R 96 char *mt_bt_switch; /* method to switch Bluetooth on/off_R */
97 char *bt_status; //no model currently supports this__? 97 char *bt_status; /* no model currently supports this__? */
98 char *mt_lcd_switch; //method to turn LCD on/off_________A 98 char *mt_lcd_switch; /* method to turn LCD on/off_________A */
99 char *lcd_status; //node to read LCD panel state______A 99 char *lcd_status; /* node to read LCD panel state______A */
100 char *brightness_up; //method to set brightness up_______A 100 char *brightness_up; /* method to set brightness up_______A */
101 char *brightness_down; //guess what ?______________________A 101 char *brightness_down; /* method to set brightness down ____A */
102 char *brightness_set; //method to set absolute brightness_R 102 char *brightness_set; /* method to set absolute brightness_R */
103 char *brightness_get; //method to get absolute brightness_R 103 char *brightness_get; /* method to get absolute brightness_R */
104 char *brightness_status; //node to get brightness____________A 104 char *brightness_status;/* node to get brightness____________A */
105 char *display_set; //method to set video output________R 105 char *display_set; /* method to set video output________R */
106 char *display_get; //method to get video output________R 106 char *display_get; /* method to get video output________R */
107}; 107};
108 108
109/* 109/*
@@ -111,41 +111,41 @@ struct model_data {
111 * about the hotk device 111 * about the hotk device
112 */ 112 */
113struct asus_hotk { 113struct asus_hotk {
114 struct acpi_device *device; //the device we are in 114 struct acpi_device *device; /* the device we are in */
115 acpi_handle handle; //the handle of the hotk device 115 acpi_handle handle; /* the handle of the hotk device */
116 char status; //status of the hotk, for LEDs, ... 116 char status; /* status of the hotk, for LEDs */
117 u32 ledd_status; //status of the LED display 117 u32 ledd_status; /* status of the LED display */
118 struct model_data *methods; //methods available on the laptop 118 struct model_data *methods; /* methods available on the laptop */
119 u8 brightness; //brightness level 119 u8 brightness; /* brightness level */
120 enum { 120 enum {
121 A1x = 0, //A1340D, A1300F 121 A1x = 0, /* A1340D, A1300F */
122 A2x, //A2500H 122 A2x, /* A2500H */
123 A4G, //A4700G 123 A4G, /* A4700G */
124 D1x, //D1 124 D1x, /* D1 */
125 L2D, //L2000D 125 L2D, /* L2000D */
126 L3C, //L3800C 126 L3C, /* L3800C */
127 L3D, //L3400D 127 L3D, /* L3400D */
128 L3H, //L3H, L2000E, L5D 128 L3H, /* L3H, L2000E, L5D */
129 L4R, //L4500R 129 L4R, /* L4500R */
130 L5x, //L5800C 130 L5x, /* L5800C */
131 L8L, //L8400L 131 L8L, /* L8400L */
132 M1A, //M1300A 132 M1A, /* M1300A */
133 M2E, //M2400E, L4400L 133 M2E, /* M2400E, L4400L */
134 M6N, //M6800N, W3400N 134 M6N, /* M6800N, W3400N */
135 M6R, //M6700R, A3000G 135 M6R, /* M6700R, A3000G */
136 P30, //Samsung P30 136 P30, /* Samsung P30 */
137 S1x, //S1300A, but also L1400B and M2400A (L84F) 137 S1x, /* S1300A, but also L1400B and M2400A (L84F) */
138 S2x, //S200 (J1 reported), Victor MP-XP7210 138 S2x, /* S200 (J1 reported), Victor MP-XP7210 */
139 W1N, //W1000N 139 W1N, /* W1000N */
140 W5A, //W5A 140 W5A, /* W5A */
141 W3V, //W3030V 141 W3V, /* W3030V */
142 xxN, //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N 142 xxN, /* M2400N, M3700N, M5200N, M6800N,
143 A4S, //Z81sp 143 S1300N, S5200N*/
144 //(Centrino) 144 A4S, /* Z81sp */
145 F3Sa, 145 F3Sa, /* (Centrino) */
146 END_MODEL 146 END_MODEL
147 } model; //Models currently supported 147 } model; /* Models currently supported */
148 u16 event_count[128]; //count for each event TODO make this better 148 u16 event_count[128]; /* Count for each event TODO make this better */
149}; 149};
150 150
151/* Here we go */ 151/* Here we go */
@@ -459,18 +459,18 @@ static struct acpi_driver asus_hotk_driver = {
459 }, 459 },
460}; 460};
461 461
462/* 462/*
463 * This function evaluates an ACPI method, given an int as parameter, the 463 * This function evaluates an ACPI method, given an int as parameter, the
464 * method is searched within the scope of the handle, can be NULL. The output 464 * method is searched within the scope of the handle, can be NULL. The output
465 * of the method is written is output, which can also be NULL 465 * of the method is written is output, which can also be NULL
466 * 466 *
467 * returns 1 if write is successful, 0 else. 467 * returns 1 if write is successful, 0 else.
468 */ 468 */
469static int write_acpi_int(acpi_handle handle, const char *method, int val, 469static int write_acpi_int(acpi_handle handle, const char *method, int val,
470 struct acpi_buffer *output) 470 struct acpi_buffer *output)
471{ 471{
472 struct acpi_object_list params; //list of input parameters (an int here) 472 struct acpi_object_list params; /* list of input parameters (int) */
473 union acpi_object in_obj; //the only param we use 473 union acpi_object in_obj; /* the only param we use */
474 acpi_status status; 474 acpi_status status;
475 475
476 params.count = 1; 476 params.count = 1;
@@ -507,18 +507,18 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
507{ 507{
508 int len = 0; 508 int len = 0;
509 int temp; 509 int temp;
510 char buf[16]; //enough for all info 510 char buf[16]; /* enough for all info */
511 /* 511 /*
512 * We use the easy way, we don't care of off and count, so we don't set eof 512 * We use the easy way, we don't care of off and count,
513 * to 1 513 * so we don't set eof to 1
514 */ 514 */
515 515
516 len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n"); 516 len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n");
517 len += sprintf(page + len, "Model reference : %s\n", 517 len += sprintf(page + len, "Model reference : %s\n",
518 hotk->methods->name); 518 hotk->methods->name);
519 /* 519 /*
520 * The SFUN method probably allows the original driver to get the list 520 * The SFUN method probably allows the original driver to get the list
521 * of features supported by a given model. For now, 0x0100 or 0x0800 521 * of features supported by a given model. For now, 0x0100 or 0x0800
522 * bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card. 522 * bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card.
523 * The significance of others is yet to be found. 523 * The significance of others is yet to be found.
524 */ 524 */
@@ -528,7 +528,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
528 /* 528 /*
529 * Another value for userspace: the ASYM method returns 0x02 for 529 * Another value for userspace: the ASYM method returns 0x02 for
530 * battery low and 0x04 for battery critical, its readings tend to be 530 * battery low and 0x04 for battery critical, its readings tend to be
531 * more accurate than those provided by _BST. 531 * more accurate than those provided by _BST.
532 * Note: since not all the laptops provide this method, errors are 532 * Note: since not all the laptops provide this method, errors are
533 * silently ignored. 533 * silently ignored.
534 */ 534 */
@@ -579,7 +579,7 @@ static int read_led(const char *ledname, int ledmask)
579 return (hotk->status & ledmask) ? 1 : 0; 579 return (hotk->status & ledmask) ? 1 : 0;
580} 580}
581 581
582static int parse_arg(const char __user * buf, unsigned long count, int *val) 582static int parse_arg(const char __user *buf, unsigned long count, int *val)
583{ 583{
584 char s[32]; 584 char s[32];
585 if (!count) 585 if (!count)
@@ -596,7 +596,7 @@ static int parse_arg(const char __user * buf, unsigned long count, int *val)
596 596
597/* FIXME: kill extraneous args so it can be called independently */ 597/* FIXME: kill extraneous args so it can be called independently */
598static int 598static int
599write_led(const char __user * buffer, unsigned long count, 599write_led(const char __user *buffer, unsigned long count,
600 char *ledname, int ledmask, int invert) 600 char *ledname, int ledmask, int invert)
601{ 601{
602 int rv, value; 602 int rv, value;
@@ -631,7 +631,7 @@ proc_read_mled(char *page, char **start, off_t off, int count, int *eof,
631} 631}
632 632
633static int 633static int
634proc_write_mled(struct file *file, const char __user * buffer, 634proc_write_mled(struct file *file, const char __user *buffer,
635 unsigned long count, void *data) 635 unsigned long count, void *data)
636{ 636{
637 return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1); 637 return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1);
@@ -648,7 +648,7 @@ proc_read_ledd(char *page, char **start, off_t off, int count, int *eof,
648} 648}
649 649
650static int 650static int
651proc_write_ledd(struct file *file, const char __user * buffer, 651proc_write_ledd(struct file *file, const char __user *buffer,
652 unsigned long count, void *data) 652 unsigned long count, void *data)
653{ 653{
654 int rv, value; 654 int rv, value;
@@ -677,7 +677,7 @@ proc_read_wled(char *page, char **start, off_t off, int count, int *eof,
677} 677}
678 678
679static int 679static int
680proc_write_wled(struct file *file, const char __user * buffer, 680proc_write_wled(struct file *file, const char __user *buffer,
681 unsigned long count, void *data) 681 unsigned long count, void *data)
682{ 682{
683 return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0); 683 return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0);
@@ -694,10 +694,10 @@ proc_read_bluetooth(char *page, char **start, off_t off, int count, int *eof,
694} 694}
695 695
696static int 696static int
697proc_write_bluetooth(struct file *file, const char __user * buffer, 697proc_write_bluetooth(struct file *file, const char __user *buffer,
698 unsigned long count, void *data) 698 unsigned long count, void *data)
699{ 699{
700 /* Note: mt_bt_switch controls both internal Bluetooth adapter's 700 /* Note: mt_bt_switch controls both internal Bluetooth adapter's
701 presence and its LED */ 701 presence and its LED */
702 return write_led(buffer, count, hotk->methods->mt_bt_switch, BT_ON, 0); 702 return write_led(buffer, count, hotk->methods->mt_bt_switch, BT_ON, 0);
703} 703}
@@ -714,7 +714,7 @@ proc_read_tled(char *page, char **start, off_t off, int count, int *eof,
714} 714}
715 715
716static int 716static int
717proc_write_tled(struct file *file, const char __user * buffer, 717proc_write_tled(struct file *file, const char __user *buffer,
718 unsigned long count, void *data) 718 unsigned long count, void *data)
719{ 719{
720 return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0); 720 return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0);
@@ -734,7 +734,7 @@ static int get_lcd_state(void)
734 734
735 input.count = 2; 735 input.count = 2;
736 input.pointer = mt_params; 736 input.pointer = mt_params;
737 /* Note: the following values are partly guessed up, but 737 /* Note: the following values are partly guessed up, but
738 otherwise they seem to work */ 738 otherwise they seem to work */
739 mt_params[0].type = ACPI_TYPE_INTEGER; 739 mt_params[0].type = ACPI_TYPE_INTEGER;
740 mt_params[0].integer.value = 0x02; 740 mt_params[0].integer.value = 0x02;
@@ -753,7 +753,7 @@ static int get_lcd_state(void)
753 /* That's what the AML code does */ 753 /* That's what the AML code does */
754 lcd = out_obj.integer.value >> 8; 754 lcd = out_obj.integer.value >> 8;
755 } else if (hotk->model == F3Sa) { 755 } else if (hotk->model == F3Sa) {
756 unsigned long tmp; 756 unsigned long long tmp;
757 union acpi_object param; 757 union acpi_object param;
758 struct acpi_object_list input; 758 struct acpi_object_list input;
759 acpi_status status; 759 acpi_status status;
@@ -796,12 +796,13 @@ static int set_lcd_state(int value)
796 acpi_evaluate_object(NULL, 796 acpi_evaluate_object(NULL,
797 hotk->methods->mt_lcd_switch, 797 hotk->methods->mt_lcd_switch,
798 NULL, NULL); 798 NULL, NULL);
799 } else { /* L3H and the like have to be handled differently */ 799 } else {
800 /* L3H and the like must be handled differently */
800 if (!write_acpi_int 801 if (!write_acpi_int
801 (hotk->handle, hotk->methods->mt_lcd_switch, 0x07, 802 (hotk->handle, hotk->methods->mt_lcd_switch, 0x07,
802 NULL)) 803 NULL))
803 status = AE_ERROR; 804 status = AE_ERROR;
804 /* L3H's AML executes EHK (0x07) upon Fn+F7 keypress, 805 /* L3H's AML executes EHK (0x07) upon Fn+F7 keypress,
805 the exact behaviour is simulated here */ 806 the exact behaviour is simulated here */
806 } 807 }
807 if (ACPI_FAILURE(status)) 808 if (ACPI_FAILURE(status))
@@ -819,7 +820,7 @@ proc_read_lcd(char *page, char **start, off_t off, int count, int *eof,
819} 820}
820 821
821static int 822static int
822proc_write_lcd(struct file *file, const char __user * buffer, 823proc_write_lcd(struct file *file, const char __user *buffer,
823 unsigned long count, void *data) 824 unsigned long count, void *data)
824{ 825{
825 int rv, value; 826 int rv, value;
@@ -897,7 +898,7 @@ proc_read_brn(char *page, char **start, off_t off, int count, int *eof,
897} 898}
898 899
899static int 900static int
900proc_write_brn(struct file *file, const char __user * buffer, 901proc_write_brn(struct file *file, const char __user *buffer,
901 unsigned long count, void *data) 902 unsigned long count, void *data)
902{ 903{
903 int rv, value; 904 int rv, value;
@@ -921,7 +922,7 @@ static void set_display(int value)
921} 922}
922 923
923/* 924/*
924 * Now, *this* one could be more user-friendly, but so far, no-one has 925 * Now, *this* one could be more user-friendly, but so far, no-one has
925 * complained. The significance of bits is the same as in proc_write_disp() 926 * complained. The significance of bits is the same as in proc_write_disp()
926 */ 927 */
927static int 928static int
@@ -933,18 +934,18 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
933 if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value)) 934 if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value))
934 printk(KERN_WARNING 935 printk(KERN_WARNING
935 "Asus ACPI: Error reading display status\n"); 936 "Asus ACPI: Error reading display status\n");
936 value &= 0x07; /* needed for some models, shouldn't hurt others */ 937 value &= 0x07; /* needed for some models, shouldn't hurt others */
937 return sprintf(page, "%d\n", value); 938 return sprintf(page, "%d\n", value);
938} 939}
939 940
940/* 941/*
941 * Experimental support for display switching. As of now: 1 should activate 942 * Experimental support for display switching. As of now: 1 should activate
942 * the LCD output, 2 should do for CRT, and 4 for TV-Out. Any combination 943 * the LCD output, 2 should do for CRT, and 4 for TV-Out. Any combination
943 * (bitwise) of these will suffice. I never actually tested 3 displays hooked up 944 * (bitwise) of these will suffice. I never actually tested 3 displays hooked
944 * simultaneously, so be warned. See the acpi4asus README for more info. 945 * up simultaneously, so be warned. See the acpi4asus README for more info.
945 */ 946 */
946static int 947static int
947proc_write_disp(struct file *file, const char __user * buffer, 948proc_write_disp(struct file *file, const char __user *buffer,
948 unsigned long count, void *data) 949 unsigned long count, void *data)
949{ 950{
950 int rv, value; 951 int rv, value;
@@ -957,12 +958,12 @@ proc_write_disp(struct file *file, const char __user * buffer,
957 958
958typedef int (proc_readfunc) (char *page, char **start, off_t off, int count, 959typedef int (proc_readfunc) (char *page, char **start, off_t off, int count,
959 int *eof, void *data); 960 int *eof, void *data);
960typedef int (proc_writefunc) (struct file * file, const char __user * buffer, 961typedef int (proc_writefunc) (struct file *file, const char __user *buffer,
961 unsigned long count, void *data); 962 unsigned long count, void *data);
962 963
963static int 964static int
964asus_proc_add(char *name, proc_writefunc * writefunc, 965asus_proc_add(char *name, proc_writefunc *writefunc,
965 proc_readfunc * readfunc, mode_t mode, 966 proc_readfunc *readfunc, mode_t mode,
966 struct acpi_device *device) 967 struct acpi_device *device)
967{ 968{
968 struct proc_dir_entry *proc = 969 struct proc_dir_entry *proc =
@@ -1040,9 +1041,9 @@ static int asus_hotk_add_fs(struct acpi_device *device)
1040 &proc_read_bluetooth, mode, device); 1041 &proc_read_bluetooth, mode, device);
1041 } 1042 }
1042 1043
1043 /* 1044 /*
1044 * We need both read node and write method as LCD switch is also accessible 1045 * We need both read node and write method as LCD switch is also
1045 * from keyboard 1046 * accessible from the keyboard
1046 */ 1047 */
1047 if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) { 1048 if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) {
1048 asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, 1049 asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode,
@@ -1096,11 +1097,10 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
1096 if (!hotk) 1097 if (!hotk)
1097 return; 1098 return;
1098 1099
1099 if ((event & ~((u32) BR_UP)) < 16) { 1100 if ((event & ~((u32) BR_UP)) < 16)
1100 hotk->brightness = (event & ~((u32) BR_UP)); 1101 hotk->brightness = (event & ~((u32) BR_UP));
1101 } else if ((event & ~((u32) BR_DOWN)) < 16) { 1102 else if ((event & ~((u32) BR_DOWN)) < 16)
1102 hotk->brightness = (event & ~((u32) BR_DOWN)); 1103 hotk->brightness = (event & ~((u32) BR_DOWN));
1103 }
1104 1104
1105 acpi_bus_generate_proc_event(hotk->device, event, 1105 acpi_bus_generate_proc_event(hotk->device, event,
1106 hotk->event_count[event % 128]++); 1106 hotk->event_count[event % 128]++);
@@ -1186,8 +1186,8 @@ static int asus_hotk_get_info(void)
1186 acpi_status status; 1186 acpi_status status;
1187 1187
1188 /* 1188 /*
1189 * Get DSDT headers early enough to allow for differentiating between 1189 * Get DSDT headers early enough to allow for differentiating between
1190 * models, but late enough to allow acpi_bus_register_driver() to fail 1190 * models, but late enough to allow acpi_bus_register_driver() to fail
1191 * before doing anything ACPI-specific. Should we encounter a machine, 1191 * before doing anything ACPI-specific. Should we encounter a machine,
1192 * which needs special handling (i.e. its hotkey device has a different 1192 * which needs special handling (i.e. its hotkey device has a different
1193 * HID), this bit will be moved. A global variable asus_info contains 1193 * HID), this bit will be moved. A global variable asus_info contains
@@ -1212,8 +1212,8 @@ static int asus_hotk_get_info(void)
1212 1212
1213 /* 1213 /*
1214 * Try to match the object returned by INIT to the specific model. 1214 * Try to match the object returned by INIT to the specific model.
1215 * Handle every possible object (or the lack of thereof) the DSDT 1215 * Handle every possible object (or the lack of thereof) the DSDT
1216 * writers might throw at us. When in trouble, we pass NULL to 1216 * writers might throw at us. When in trouble, we pass NULL to
1217 * asus_model_match() and try something completely different. 1217 * asus_model_match() and try something completely different.
1218 */ 1218 */
1219 if (buffer.pointer) { 1219 if (buffer.pointer) {
@@ -1244,6 +1244,8 @@ static int asus_hotk_get_info(void)
1244 "default values\n", string); 1244 "default values\n", string);
1245 printk(KERN_NOTICE 1245 printk(KERN_NOTICE
1246 " send /proc/acpi/dsdt to the developers\n"); 1246 " send /proc/acpi/dsdt to the developers\n");
1247 kfree(model);
1248 return -ENODEV;
1247 } 1249 }
1248 hotk->methods = &model_conf[hotk->model]; 1250 hotk->methods = &model_conf[hotk->model];
1249 return AE_OK; 1251 return AE_OK;
@@ -1254,7 +1256,7 @@ static int asus_hotk_get_info(void)
1254 /* Sort of per-model blacklist */ 1256 /* Sort of per-model blacklist */
1255 if (strncmp(string, "L2B", 3) == 0) 1257 if (strncmp(string, "L2B", 3) == 0)
1256 hotk->methods->lcd_status = NULL; 1258 hotk->methods->lcd_status = NULL;
1257 /* L2B is similar enough to L3C to use its settings, with this only 1259 /* L2B is similar enough to L3C to use its settings, with this only
1258 exception */ 1260 exception */
1259 else if (strncmp(string, "A3G", 3) == 0) 1261 else if (strncmp(string, "A3G", 3) == 0)
1260 hotk->methods->lcd_status = "\\BLFG"; 1262 hotk->methods->lcd_status = "\\BLFG";
@@ -1321,7 +1323,7 @@ static int asus_hotk_add(struct acpi_device *device)
1321 hotk->handle = device->handle; 1323 hotk->handle = device->handle;
1322 strcpy(acpi_device_name(device), ACPI_HOTK_DEVICE_NAME); 1324 strcpy(acpi_device_name(device), ACPI_HOTK_DEVICE_NAME);
1323 strcpy(acpi_device_class(device), ACPI_HOTK_CLASS); 1325 strcpy(acpi_device_class(device), ACPI_HOTK_CLASS);
1324 acpi_driver_data(device) = hotk; 1326 device->driver_data = hotk;
1325 hotk->device = device; 1327 hotk->device = device;
1326 1328
1327 result = asus_hotk_check(); 1329 result = asus_hotk_check();
@@ -1366,10 +1368,9 @@ static int asus_hotk_add(struct acpi_device *device)
1366 /* LED display is off by default */ 1368 /* LED display is off by default */
1367 hotk->ledd_status = 0xFFF; 1369 hotk->ledd_status = 0xFFF;
1368 1370
1369 end: 1371end:
1370 if (result) { 1372 if (result)
1371 kfree(hotk); 1373 kfree(hotk);
1372 }
1373 1374
1374 return result; 1375 return result;
1375} 1376}
@@ -1394,8 +1395,8 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
1394} 1395}
1395 1396
1396static struct backlight_ops asus_backlight_data = { 1397static struct backlight_ops asus_backlight_data = {
1397 .get_brightness = read_brightness, 1398 .get_brightness = read_brightness,
1398 .update_status = set_brightness_status, 1399 .update_status = set_brightness_status,
1399}; 1400};
1400 1401
1401static void asus_acpi_exit(void) 1402static void asus_acpi_exit(void)
@@ -1442,15 +1443,15 @@ static int __init asus_acpi_init(void)
1442 return -ENODEV; 1443 return -ENODEV;
1443 } 1444 }
1444 1445
1445 asus_backlight_device = backlight_device_register("asus",NULL,NULL, 1446 asus_backlight_device = backlight_device_register("asus", NULL, NULL,
1446 &asus_backlight_data); 1447 &asus_backlight_data);
1447 if (IS_ERR(asus_backlight_device)) { 1448 if (IS_ERR(asus_backlight_device)) {
1448 printk(KERN_ERR "Could not register asus backlight device\n"); 1449 printk(KERN_ERR "Could not register asus backlight device\n");
1449 asus_backlight_device = NULL; 1450 asus_backlight_device = NULL;
1450 asus_acpi_exit(); 1451 asus_acpi_exit();
1451 return -ENODEV; 1452 return -ENODEV;
1452 } 1453 }
1453 asus_backlight_device->props.max_brightness = 15; 1454 asus_backlight_device->props.max_brightness = 15;
1454 1455
1455 return 0; 1456 return 0;
1456} 1457}