From: Henrique de M. H. <hm...@hm...> - 2006-11-22 20:13:52
|
From: Henrique de Moraes Holschuh <hm...@hm...> This patch just fixes style, move some #defines to enums, and removes som= e old cruft. Signed-off-by: Henrique de Moraes Holschuh <hm...@hm...> --- drivers/acpi/ibm_acpi.c | 100 ++++++++++++++++++++---------------------= ------ 1 files changed, 43 insertions(+), 57 deletions(-) diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 4299f43..3339567 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c @@ -78,9 +78,11 @@ #include <linux/init.h> #include <linux/types.h> #include <linux/string.h> + #include <linux/proc_fs.h> #include <linux/backlight.h> #include <asm/uaccess.h> + #include <linux/dmi.h> #include <linux/jiffies.h> #include <linux/workqueue.h> @@ -121,28 +123,6 @@ static acpi_handle root_handle =3D NULL; static char *object##_path; \ static char *object##_paths[] =3D { paths } =20 -/* - * The following models are supported to various degrees: - * - * 570, 600e, 600x, 770e, 770x - * A20m, A21e, A21m, A21p, A22p, A30, A30p, A31, A31p - * G40, G41 - * R30, R31, R32, R40, R40e, R50, R50e, R50p, R51 - * T20, T21, T22, T23, T30, T40, T40p, T41, T41p, T42, T42p, T43 - * X20, X21, X22, X23, X24, X30, X31, X40 - * - * The following models have no supported features: - * - * 240, 240x, i1400 - * - * Still missing DSDTs for the following models: - * - * A20p, A22e, A22m - * R52 - * S31 - * T43p - */ - IBM_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC0", /* 240, 240x, S30 */ "\\_SB.PCI.ISA.EC", /* 570 */ "\\_SB.PCI0.ISA0.EC0", /* 600e/x, 770e, 770x */ @@ -783,12 +763,15 @@ static int wan_write(char *buf) return 0; } =20 -static int video_supported; -static int video_orig_autosw; +enum video_access_mode { + IBMACPI_VIDEO_NONE =3D 0, + IBMACPI_VIDEO_570, /* 570 */ + IBMACPI_VIDEO_770, /* 600e/x, 770e, 770x */ + IBMACPI_VIDEO_NEW, /* all others */ +}; =20 -#define VIDEO_570 1 -#define VIDEO_770 2 -#define VIDEO_NEW 3 +static enum video_access_mode video_supported; +static int video_orig_autosw; =20 static int video_init(void) { @@ -800,16 +783,16 @@ static int video_init(void) =20 if (!vid_handle) /* video switching not supported on R30, R31 */ - video_supported =3D 0; + video_supported =3D IBMACPI_VIDEO_NONE; else if (acpi_evalf(vid_handle, &video_orig_autosw, "SWIT", "qd")) /* 570 */ - video_supported =3D VIDEO_570; + video_supported =3D IBMACPI_VIDEO_570; else if (acpi_evalf(vid_handle, &video_orig_autosw, "^VADL", "qd")) /* 600e/x, 770e, 770x */ - video_supported =3D VIDEO_770; + video_supported =3D IBMACPI_VIDEO_770; else /* all others */ - video_supported =3D VIDEO_NEW; + video_supported =3D IBMACPI_VIDEO_NEW; =20 return 0; } @@ -819,15 +802,15 @@ static int video_status(void) int status =3D 0; int i; =20 - if (video_supported =3D=3D VIDEO_570) { + if (video_supported =3D=3D IBMACPI_VIDEO_570) { if (acpi_evalf(NULL, &i, "\\_SB.PHS", "dd", 0x87)) status =3D i & 3; - } else if (video_supported =3D=3D VIDEO_770) { + } else if (video_supported =3D=3D IBMACPI_VIDEO_770) { if (acpi_evalf(NULL, &i, "\\VCDL", "d")) status |=3D 0x01 * i; if (acpi_evalf(NULL, &i, "\\VCDC", "d")) status |=3D 0x02 * i; - } else if (video_supported =3D=3D VIDEO_NEW) { + } else if (video_supported =3D=3D IBMACPI_VIDEO_NEW) { acpi_evalf(NULL, NULL, "\\VUPS", "vd", 1); if (acpi_evalf(NULL, &i, "\\VCDC", "d")) status |=3D 0x02 * i; @@ -846,9 +829,10 @@ static int video_autosw(void) { int autosw =3D 0; =20 - if (video_supported =3D=3D VIDEO_570) + if (video_supported =3D=3D IBMACPI_VIDEO_570) acpi_evalf(vid_handle, &autosw, "SWIT", "d"); - else if (video_supported =3D=3D VIDEO_770 || video_supported =3D=3D VID= EO_NEW) + else if (video_supported =3D=3D IBMACPI_VIDEO_770 || + video_supported =3D=3D IBMACPI_VIDEO_NEW) acpi_evalf(vid_handle, &autosw, "^VDEE", "d"); =20 return autosw & 1; @@ -868,12 +852,12 @@ static int video_read(char *p) len +=3D sprintf(p + len, "status:\t\tsupported\n"); len +=3D sprintf(p + len, "lcd:\t\t%s\n", enabled(status, 0)); len +=3D sprintf(p + len, "crt:\t\t%s\n", enabled(status, 1)); - if (video_supported =3D=3D VIDEO_NEW) + if (video_supported =3D=3D IBMACPI_VIDEO_NEW) len +=3D sprintf(p + len, "dvi:\t\t%s\n", enabled(status, 3)); len +=3D sprintf(p + len, "auto:\t\t%s\n", enabled(autosw, 0)); len +=3D sprintf(p + len, "commands:\tlcd_enable, lcd_disable\n"); len +=3D sprintf(p + len, "commands:\tcrt_enable, crt_disable\n"); - if (video_supported =3D=3D VIDEO_NEW) + if (video_supported =3D=3D IBMACPI_VIDEO_NEW) len +=3D sprintf(p + len, "commands:\tdvi_enable, dvi_disable\n"); len +=3D sprintf(p + len, "commands:\tauto_enable, auto_disable\n"); len +=3D sprintf(p + len, "commands:\tvideo_switch, expand_toggle\n"); @@ -888,7 +872,7 @@ static int video_switch(void) =20 if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1)) return -EIO; - ret =3D video_supported =3D=3D VIDEO_570 ? + ret =3D video_supported =3D=3D IBMACPI_VIDEO_570 ? acpi_evalf(ec_handle, NULL, "_Q16", "v") : acpi_evalf(vid_handle, NULL, "VSWT", "v"); acpi_evalf(vid_handle, NULL, "_DOS", "vd", autosw); @@ -898,9 +882,9 @@ static int video_switch(void) =20 static int video_expand(void) { - if (video_supported =3D=3D VIDEO_570) + if (video_supported =3D=3D IBMACPI_VIDEO_570) return acpi_evalf(ec_handle, NULL, "_Q17", "v"); - else if (video_supported =3D=3D VIDEO_770) + else if (video_supported =3D=3D IBMACPI_VIDEO_770) return acpi_evalf(vid_handle, NULL, "VEXP", "v"); else return acpi_evalf(NULL, NULL, "\\VEXP", "v"); @@ -910,10 +894,10 @@ static int video_switch2(int status) { int ret; =20 - if (video_supported =3D=3D VIDEO_570) { + if (video_supported =3D=3D IBMACPI_VIDEO_570) { ret =3D acpi_evalf(NULL, NULL, "\\_SB.PHS2", "vdd", 0x8b, status | 0x80); - } else if (video_supported =3D=3D VIDEO_770) { + } else if (video_supported =3D=3D IBMACPI_VIDEO_770) { int autosw =3D video_autosw(); if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1)) return -EIO; @@ -949,10 +933,10 @@ static int video_write(char *buf) enable |=3D 0x02; } else if (strlencmp(cmd, "crt_disable") =3D=3D 0) { disable |=3D 0x02; - } else if (video_supported =3D=3D VIDEO_NEW && + } else if (video_supported =3D=3D IBMACPI_VIDEO_NEW && strlencmp(cmd, "dvi_enable") =3D=3D 0) { enable |=3D 0x08; - } else if (video_supported =3D=3D VIDEO_NEW && + } else if (video_supported =3D=3D IBMACPI_VIDEO_NEW && strlencmp(cmd, "dvi_disable") =3D=3D 0) { disable |=3D 0x08; } else if (strlencmp(cmd, "auto_enable") =3D=3D 0) { @@ -1248,26 +1232,28 @@ static int cmos_write(char *buf) return 0; } =20 -static int led_supported; - -#define LED_570 1 -#define LED_OLD 2 -#define LED_NEW 3 +enum led_access_mode { + IBMACPI_LED_NONE =3D 0, + IBMACPI_LED_570, /* 570 */ + IBMACPI_LED_OLD, /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */ + IBMACPI_LED_NEW, /* all others */ +}; +static enum led_access_mode led_supported; =20 static int led_init(void) { if (!led_handle) /* led not supported on R30, R31 */ - led_supported =3D 0; + led_supported =3D IBMACPI_LED_NONE; else if (strlencmp(led_path, "SLED") =3D=3D 0) /* 570 */ - led_supported =3D LED_570; + led_supported =3D IBMACPI_LED_570; else if (strlencmp(led_path, "SYSL") =3D=3D 0) /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */ - led_supported =3D LED_OLD; + led_supported =3D IBMACPI_LED_OLD; else /* all others */ - led_supported =3D LED_NEW; + led_supported =3D IBMACPI_LED_NEW; =20 return 0; } @@ -1284,7 +1270,7 @@ static int led_read(char *p) } len +=3D sprintf(p + len, "status:\t\tsupported\n"); =20 - if (led_supported =3D=3D LED_570) { + if (led_supported =3D=3D IBMACPI_LED_570) { /* 570 */ int i, status; for (i =3D 0; i < 8; i++) { @@ -1333,13 +1319,13 @@ static int led_write(char *buf) } else return -EINVAL; =20 - if (led_supported =3D=3D LED_570) { + if (led_supported =3D=3D IBMACPI_LED_570) { /* 570 */ led =3D 1 << led; if (!acpi_evalf(led_handle, NULL, NULL, "vdd", led, led_sled_arg1[ind])) return -EIO; - } else if (led_supported =3D=3D LED_OLD) { + } else if (led_supported =3D=3D IBMACPI_LED_OLD) { /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */ led =3D 1 << led; ret =3D ec_write(EC_HLMS, led); |