Commit 634d6b5f authored by Len Brown's avatar Len Brown Committed by Len Brown

[ACPI] ibm ACPI 0.8 by Chris Wright and Borislav Deianov

Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 51b3e81b
IBM ThinkPad ACPI Extras Driver IBM ThinkPad ACPI Extras Driver
Version 0.7 Version 0.8
23 October 2004 8 November 2004
Borislav Deianov <borislav@users.sf.net> Borislav Deianov <borislav@users.sf.net>
http://ibm-acpi.sf.net/ http://ibm-acpi.sf.net/
......
...@@ -43,9 +43,11 @@ ...@@ -43,9 +43,11 @@
* 2004-10-19 0.6 use acpi_bus_register_driver() to claim HKEY device * 2004-10-19 0.6 use acpi_bus_register_driver() to claim HKEY device
* 2004-10-23 0.7 fix module loading on A21e, A22p, T20, T21, X20 * 2004-10-23 0.7 fix module loading on A21e, A22p, T20, T21, X20
* fix LED control on A21e * fix LED control on A21e
* 2004-11-08 0.8 fix init error case, don't return from a macro
* thanks to Chris Wright <chrisw@osdl.org>
*/ */
#define IBM_VERSION "0.7" #define IBM_VERSION "0.8"
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -1130,25 +1132,19 @@ static int ibm_handle_init(char *name, ...@@ -1130,25 +1132,19 @@ static int ibm_handle_init(char *name,
return 0; return 0;
} }
*handle = NULL;
if (required) { if (required) {
printk(IBM_ERR "%s object not found\n", name); printk(IBM_ERR "%s object not found\n", name);
return -1; return -1;
} }
*handle = NULL;
return 0; return 0;
} }
#define IBM_HANDLE_INIT_REQ(object) do { \ #define IBM_HANDLE_INIT(object, required) \
if (ibm_handle_init(#object, &object##_handle, *object##_parent, \ ibm_handle_init(#object, &object##_handle, *object##_parent, \
object##_paths, sizeof(object##_paths)/sizeof(char *), 1) < 0)\ object##_paths, sizeof(object##_paths)/sizeof(char*), required)
return -ENODEV; \
} while (0)
#define IBM_HANDLE_INIT(object) \
ibm_handle_init(#object, &object##_handle, *object##_parent, \
object##_paths, sizeof(object##_paths)/sizeof(char *), 0)
static void ibm_param(char *feature, char *cmd) static void ibm_param(char *feature, char *cmd)
...@@ -1184,6 +1180,27 @@ static int __init acpi_ibm_init(void) ...@@ -1184,6 +1180,27 @@ static int __init acpi_ibm_init(void)
if (acpi_disabled) if (acpi_disabled)
return -ENODEV; return -ENODEV;
/* these handles are required */
if (IBM_HANDLE_INIT(ec, 1) < 0 ||
IBM_HANDLE_INIT(hkey, 1) < 0 ||
IBM_HANDLE_INIT(vid, 1) < 0 ||
IBM_HANDLE_INIT(beep, 1) < 0)
return -ENODEV;
/* these handles have alternatives */
IBM_HANDLE_INIT(lght, 0);
if (IBM_HANDLE_INIT(cmos, !lght_handle) < 0)
return -ENODEV;
IBM_HANDLE_INIT(sysl, 0);
if (IBM_HANDLE_INIT(led, !sysl_handle) < 0)
return -ENODEV;
/* these handles are not required */
IBM_HANDLE_INIT(dock, 0);
IBM_HANDLE_INIT(bay, 0);
IBM_HANDLE_INIT(bayej, 0);
IBM_HANDLE_INIT(bled, 0);
proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir); proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir);
if (!proc_dir) { if (!proc_dir) {
printk(IBM_ERR "unable to create proc dir %s", IBM_DIR); printk(IBM_ERR "unable to create proc dir %s", IBM_DIR);
...@@ -1191,29 +1208,6 @@ static int __init acpi_ibm_init(void) ...@@ -1191,29 +1208,6 @@ static int __init acpi_ibm_init(void)
} }
proc_dir->owner = THIS_MODULE; proc_dir->owner = THIS_MODULE;
IBM_HANDLE_INIT_REQ(ec);
IBM_HANDLE_INIT_REQ(hkey);
IBM_HANDLE_INIT_REQ(vid);
IBM_HANDLE_INIT(cmos);
IBM_HANDLE_INIT(lght);
IBM_HANDLE_INIT(dock);
IBM_HANDLE_INIT(bay);
IBM_HANDLE_INIT(bayej);
IBM_HANDLE_INIT(led);
IBM_HANDLE_INIT(sysl);
IBM_HANDLE_INIT(bled);
IBM_HANDLE_INIT_REQ(beep);
if (!cmos_handle && !lght_handle) {
printk(IBM_ERR "neither cmos nor lght object found\n");
return -ENODEV;
}
if (!led_handle && !sysl_handle) {
printk(IBM_ERR "neither led nor sysl object found\n");
return -ENODEV;
}
for (i=0; i<NUM_IBMS; i++) { for (i=0; i<NUM_IBMS; i++) {
ret = ibm_init(&ibms[i]); ret = ibm_init(&ibms[i]);
if (ret < 0) { if (ret < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment