1 From 9a8e1738c1136a857c1fd3ae0c5019f9767427ad Mon Sep 17 00:00:00 2001
2 From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
3 Date: Sat, 25 Nov 2006 16:36:00 -0200
4 Subject: [PATCH 22/28] ACPI: ibm-acpi: style fixes and cruft removal
6 This patch just fixes style, move some #defines to enums, and removes some
9 Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
11 drivers/acpi/ibm_acpi.c | 100 ++++++++++++++++++++---------------------------
12 1 files changed, 43 insertions(+), 57 deletions(-)
14 diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
15 index 36e2667..8bb41bd 100644
16 --- a/drivers/acpi/ibm_acpi.c
17 +++ b/drivers/acpi/ibm_acpi.c
19 #include <linux/init.h>
20 #include <linux/types.h>
21 #include <linux/string.h>
23 #include <linux/proc_fs.h>
24 #include <linux/backlight.h>
25 #include <asm/uaccess.h>
27 #include <linux/dmi.h>
28 #include <linux/jiffies.h>
29 #include <linux/workqueue.h>
30 @@ -121,28 +123,6 @@ static acpi_handle root_handle = NULL;
31 static char *object##_path; \
32 static char *object##_paths[] = { paths }
35 - * The following models are supported to various degrees:
37 - * 570, 600e, 600x, 770e, 770x
38 - * A20m, A21e, A21m, A21p, A22p, A30, A30p, A31, A31p
40 - * R30, R31, R32, R40, R40e, R50, R50e, R50p, R51
41 - * T20, T21, T22, T23, T30, T40, T40p, T41, T41p, T42, T42p, T43
42 - * X20, X21, X22, X23, X24, X30, X31, X40
44 - * The following models have no supported features:
48 - * Still missing DSDTs for the following models:
56 IBM_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC0", /* 240, 240x */
57 "\\_SB.PCI.ISA.EC", /* 570 */
58 "\\_SB.PCI0.ISA0.EC0", /* 600e/x, 770e, 770x */
59 @@ -785,12 +765,15 @@ static int wan_write(char *buf)
63 -static int video_supported;
64 -static int video_orig_autosw;
65 +enum video_access_mode {
66 + IBMACPI_VIDEO_NONE = 0,
67 + IBMACPI_VIDEO_570, /* 570 */
68 + IBMACPI_VIDEO_770, /* 600e/x, 770e, 770x */
69 + IBMACPI_VIDEO_NEW, /* all others */
75 +static enum video_access_mode video_supported;
76 +static int video_orig_autosw;
78 static int video_init(void)
80 @@ -802,16 +785,16 @@ static int video_init(void)
83 /* video switching not supported on R30, R31 */
84 - video_supported = 0;
85 + video_supported = IBMACPI_VIDEO_NONE;
86 else if (acpi_evalf(vid_handle, &video_orig_autosw, "SWIT", "qd"))
88 - video_supported = VIDEO_570;
89 + video_supported = IBMACPI_VIDEO_570;
90 else if (acpi_evalf(vid_handle, &video_orig_autosw, "^VADL", "qd"))
91 /* 600e/x, 770e, 770x */
92 - video_supported = VIDEO_770;
93 + video_supported = IBMACPI_VIDEO_770;
96 - video_supported = VIDEO_NEW;
97 + video_supported = IBMACPI_VIDEO_NEW;
101 @@ -821,15 +804,15 @@ static int video_status(void)
105 - if (video_supported == VIDEO_570) {
106 + if (video_supported == IBMACPI_VIDEO_570) {
107 if (acpi_evalf(NULL, &i, "\\_SB.PHS", "dd", 0x87))
109 - } else if (video_supported == VIDEO_770) {
110 + } else if (video_supported == IBMACPI_VIDEO_770) {
111 if (acpi_evalf(NULL, &i, "\\VCDL", "d"))
113 if (acpi_evalf(NULL, &i, "\\VCDC", "d"))
115 - } else if (video_supported == VIDEO_NEW) {
116 + } else if (video_supported == IBMACPI_VIDEO_NEW) {
117 acpi_evalf(NULL, NULL, "\\VUPS", "vd", 1);
118 if (acpi_evalf(NULL, &i, "\\VCDC", "d"))
120 @@ -848,9 +831,10 @@ static int video_autosw(void)
124 - if (video_supported == VIDEO_570)
125 + if (video_supported == IBMACPI_VIDEO_570)
126 acpi_evalf(vid_handle, &autosw, "SWIT", "d");
127 - else if (video_supported == VIDEO_770 || video_supported == VIDEO_NEW)
128 + else if (video_supported == IBMACPI_VIDEO_770 ||
129 + video_supported == IBMACPI_VIDEO_NEW)
130 acpi_evalf(vid_handle, &autosw, "^VDEE", "d");
133 @@ -870,12 +854,12 @@ static int video_read(char *p)
134 len += sprintf(p + len, "status:\t\tsupported\n");
135 len += sprintf(p + len, "lcd:\t\t%s\n", enabled(status, 0));
136 len += sprintf(p + len, "crt:\t\t%s\n", enabled(status, 1));
137 - if (video_supported == VIDEO_NEW)
138 + if (video_supported == IBMACPI_VIDEO_NEW)
139 len += sprintf(p + len, "dvi:\t\t%s\n", enabled(status, 3));
140 len += sprintf(p + len, "auto:\t\t%s\n", enabled(autosw, 0));
141 len += sprintf(p + len, "commands:\tlcd_enable, lcd_disable\n");
142 len += sprintf(p + len, "commands:\tcrt_enable, crt_disable\n");
143 - if (video_supported == VIDEO_NEW)
144 + if (video_supported == IBMACPI_VIDEO_NEW)
145 len += sprintf(p + len, "commands:\tdvi_enable, dvi_disable\n");
146 len += sprintf(p + len, "commands:\tauto_enable, auto_disable\n");
147 len += sprintf(p + len, "commands:\tvideo_switch, expand_toggle\n");
148 @@ -890,7 +874,7 @@ static int video_switch(void)
150 if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1))
152 - ret = video_supported == VIDEO_570 ?
153 + ret = video_supported == IBMACPI_VIDEO_570 ?
154 acpi_evalf(ec_handle, NULL, "_Q16", "v") :
155 acpi_evalf(vid_handle, NULL, "VSWT", "v");
156 acpi_evalf(vid_handle, NULL, "_DOS", "vd", autosw);
157 @@ -900,9 +884,9 @@ static int video_switch(void)
159 static int video_expand(void)
161 - if (video_supported == VIDEO_570)
162 + if (video_supported == IBMACPI_VIDEO_570)
163 return acpi_evalf(ec_handle, NULL, "_Q17", "v");
164 - else if (video_supported == VIDEO_770)
165 + else if (video_supported == IBMACPI_VIDEO_770)
166 return acpi_evalf(vid_handle, NULL, "VEXP", "v");
168 return acpi_evalf(NULL, NULL, "\\VEXP", "v");
169 @@ -912,10 +896,10 @@ static int video_switch2(int status)
173 - if (video_supported == VIDEO_570) {
174 + if (video_supported == IBMACPI_VIDEO_570) {
175 ret = acpi_evalf(NULL, NULL,
176 "\\_SB.PHS2", "vdd", 0x8b, status | 0x80);
177 - } else if (video_supported == VIDEO_770) {
178 + } else if (video_supported == IBMACPI_VIDEO_770) {
179 int autosw = video_autosw();
180 if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1))
182 @@ -951,10 +935,10 @@ static int video_write(char *buf)
184 } else if (strlencmp(cmd, "crt_disable") == 0) {
186 - } else if (video_supported == VIDEO_NEW &&
187 + } else if (video_supported == IBMACPI_VIDEO_NEW &&
188 strlencmp(cmd, "dvi_enable") == 0) {
190 - } else if (video_supported == VIDEO_NEW &&
191 + } else if (video_supported == IBMACPI_VIDEO_NEW &&
192 strlencmp(cmd, "dvi_disable") == 0) {
194 } else if (strlencmp(cmd, "auto_enable") == 0) {
195 @@ -1253,26 +1237,28 @@ static int cmos_write(char *buf)
199 -static int led_supported;
204 +enum led_access_mode {
205 + IBMACPI_LED_NONE = 0,
206 + IBMACPI_LED_570, /* 570 */
207 + IBMACPI_LED_OLD, /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */
208 + IBMACPI_LED_NEW, /* all others */
210 +static enum led_access_mode led_supported;
212 static int led_init(void)
215 /* led not supported on R30, R31 */
217 + led_supported = IBMACPI_LED_NONE;
218 else if (strlencmp(led_path, "SLED") == 0)
220 - led_supported = LED_570;
221 + led_supported = IBMACPI_LED_570;
222 else if (strlencmp(led_path, "SYSL") == 0)
223 /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */
224 - led_supported = LED_OLD;
225 + led_supported = IBMACPI_LED_OLD;
228 - led_supported = LED_NEW;
229 + led_supported = IBMACPI_LED_NEW;
233 @@ -1289,7 +1275,7 @@ static int led_read(char *p)
235 len += sprintf(p + len, "status:\t\tsupported\n");
237 - if (led_supported == LED_570) {
238 + if (led_supported == IBMACPI_LED_570) {
241 for (i = 0; i < 8; i++) {
242 @@ -1338,13 +1324,13 @@ static int led_write(char *buf)
246 - if (led_supported == LED_570) {
247 + if (led_supported == IBMACPI_LED_570) {
250 if (!acpi_evalf(led_handle, NULL, NULL, "vdd",
251 led, led_sled_arg1[ind]))
253 - } else if (led_supported == LED_OLD) {
254 + } else if (led_supported == IBMACPI_LED_OLD) {
255 /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */
257 ret = ec_write(EC_HLMS, led);