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
Version 0.7
23 October 2004
Version 0.8
8 November 2004
Borislav Deianov <borislav@users.sf.net>
http://ibm-acpi.sf.net/
......
......@@ -43,9 +43,11 @@
* 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
* 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/module.h>
......@@ -1130,25 +1132,19 @@ static int ibm_handle_init(char *name,
return 0;
}
*handle = NULL;
if (required) {
printk(IBM_ERR "%s object not found\n", name);
return -1;
}
*handle = NULL;
return 0;
}
#define IBM_HANDLE_INIT_REQ(object) do { \
if (ibm_handle_init(#object, &object##_handle, *object##_parent, \
object##_paths, sizeof(object##_paths)/sizeof(char *), 1) < 0)\
return -ENODEV; \
} while (0)
#define IBM_HANDLE_INIT(object) \
#define IBM_HANDLE_INIT(object, required) \
ibm_handle_init(#object, &object##_handle, *object##_parent, \
object##_paths, sizeof(object##_paths)/sizeof(char *), 0)
object##_paths, sizeof(object##_paths)/sizeof(char*), required)
static void ibm_param(char *feature, char *cmd)
......@@ -1184,35 +1180,33 @@ static int __init acpi_ibm_init(void)
if (acpi_disabled)
return -ENODEV;
proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir);
if (!proc_dir) {
printk(IBM_ERR "unable to create proc dir %s", IBM_DIR);
/* 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;
}
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");
/* 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);
if (!led_handle && !sysl_handle) {
printk(IBM_ERR "neither led nor sysl object found\n");
proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir);
if (!proc_dir) {
printk(IBM_ERR "unable to create proc dir %s", IBM_DIR);
return -ENODEV;
}
proc_dir->owner = THIS_MODULE;
for (i=0; i<NUM_IBMS; i++) {
ret = ibm_init(&ibms[i]);
......
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