Commit b3a026dc authored by Len Brown's avatar Len Brown

Merge intel.com:/home/lenb/src/linux-acpi-test-2.6.5

into intel.com:/home/lenb/src/linux-acpi-test-2.6.6
parents 32f82c01 62560d62
...@@ -605,8 +605,10 @@ static void __init parse_cmdline_early (char ** cmdline_p) ...@@ -605,8 +605,10 @@ static void __init parse_cmdline_early (char ** cmdline_p)
else if (!memcmp(from, "acpi_sci=low", 12)) else if (!memcmp(from, "acpi_sci=low", 12))
acpi_sci_flags.polarity = 3; acpi_sci_flags.polarity = 3;
#ifdef CONFIG_X86_IO_APIC
else if (!memcmp(from, "acpi_skip_timer_override", 24)) else if (!memcmp(from, "acpi_skip_timer_override", 24))
acpi_skip_timer_override = 1; acpi_skip_timer_override = 1;
#endif
#ifdef CONFIG_X86_LOCAL_APIC #ifdef CONFIG_X86_LOCAL_APIC
/* disable IO-APIC */ /* disable IO-APIC */
......
...@@ -158,6 +158,7 @@ acpi_ac_add_fs ( ...@@ -158,6 +158,7 @@ acpi_ac_add_fs (
acpi_ac_dir); acpi_ac_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_device_dir(device)->owner = THIS_MODULE;
} }
/* 'state' [R] */ /* 'state' [R] */
...@@ -170,6 +171,7 @@ acpi_ac_add_fs ( ...@@ -170,6 +171,7 @@ acpi_ac_add_fs (
else { else {
entry->proc_fops = &acpi_ac_fops; entry->proc_fops = &acpi_ac_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
return_VALUE(0); return_VALUE(0);
...@@ -320,6 +322,7 @@ acpi_ac_init (void) ...@@ -320,6 +322,7 @@ acpi_ac_init (void)
acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir); acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
if (!acpi_ac_dir) if (!acpi_ac_dir)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_ac_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_ac_driver); result = acpi_bus_register_driver(&acpi_ac_driver);
if (result < 0) { if (result < 0) {
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include <acpi/acpi_drivers.h> #include <acpi/acpi_drivers.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#define ASUS_ACPI_VERSION "0.27" #define ASUS_ACPI_VERSION "0.28"
#define PROC_ASUS "asus" //the directory #define PROC_ASUS "asus" //the directory
#define PROC_MLED "mled" #define PROC_MLED "mled"
...@@ -125,12 +125,11 @@ struct asus_hotk { ...@@ -125,12 +125,11 @@ struct asus_hotk {
L5x, //L5800C L5x, //L5800C
L8L, //L8400L L8L, //L8400L
M1A, //M1300A M1A, //M1300A
M2E, //M2400E M2E, //M2400E, L4400L
P30, //Samsung P30
S1x, //S1300A, but also L1400B and M2400A (L84F) S1x, //S1300A, but also L1400B and M2400A (L84F)
S2x, //S200 (J1 reported), Victor MP-XP7210 S2x, //S200 (J1 reported), Victor MP-XP7210
//TODO A1370D does not seem to have an ATK device xxN, //M2400N, M3700N, M6800N, S1300N, S5200N (Centrino)
// L8400 model doesn't have ATK
xxN, //M2400N, M3700N, S1300N (Centrino)
END_MODEL END_MODEL
} model; //Models currently supported } model; //Models currently supported
u16 event_count[128]; //count for each event TODO make this better u16 event_count[128]; //count for each event TODO make this better
...@@ -140,6 +139,7 @@ struct asus_hotk { ...@@ -140,6 +139,7 @@ struct asus_hotk {
#define A1x_PREFIX "\\_SB.PCI0.ISA.EC0." #define A1x_PREFIX "\\_SB.PCI0.ISA.EC0."
#define L3C_PREFIX "\\_SB.PCI0.PX40.ECD0." #define L3C_PREFIX "\\_SB.PCI0.PX40.ECD0."
#define M1A_PREFIX "\\_SB.PCI0.PX40.EC0." #define M1A_PREFIX "\\_SB.PCI0.PX40.EC0."
#define P30_PREFIX "\\_SB.PCI0.LPCB.EC0."
#define S1x_PREFIX "\\_SB.PCI0.PX40." #define S1x_PREFIX "\\_SB.PCI0.PX40."
#define S2x_PREFIX A1x_PREFIX #define S2x_PREFIX A1x_PREFIX
#define xxN_PREFIX "\\_SB.PCI0.SBRG.EC0." #define xxN_PREFIX "\\_SB.PCI0.SBRG.EC0."
...@@ -166,7 +166,7 @@ static struct model_data model_conf[END_MODEL] = { ...@@ -166,7 +166,7 @@ static struct model_data model_conf[END_MODEL] = {
.mt_lcd_switch = A1x_PREFIX "_Q10", .mt_lcd_switch = A1x_PREFIX "_Q10",
.lcd_status = "\\BKLI", .lcd_status = "\\BKLI",
.brightness_up = A1x_PREFIX "_Q0E", .brightness_up = A1x_PREFIX "_Q0E",
.brightness_down = A1x_PREFIX "_Q0F", .brightness_down = A1x_PREFIX "_Q0F"
}, },
{ {
...@@ -176,11 +176,8 @@ static struct model_data model_conf[END_MODEL] = { ...@@ -176,11 +176,8 @@ static struct model_data model_conf[END_MODEL] = {
.wled_status = "\\SG66", .wled_status = "\\SG66",
.mt_lcd_switch = "\\Q10", .mt_lcd_switch = "\\Q10",
.lcd_status = "\\BAOF", .lcd_status = "\\BAOF",
.brightness_up = "\\Q0E",
.brightness_down = "\\Q0F",
.brightness_set = "SPLV", .brightness_set = "SPLV",
.brightness_get = "GPLV", .brightness_get = "GPLV",
.brightness_status = "\\CMOD",
.display_set = "SDSP", .display_set = "SDSP",
.display_get = "\\INFB" .display_get = "\\INFB"
}, },
...@@ -217,11 +214,8 @@ static struct model_data model_conf[END_MODEL] = { ...@@ -217,11 +214,8 @@ static struct model_data model_conf[END_MODEL] = {
.mt_wled = "WLED", .mt_wled = "WLED",
.mt_lcd_switch = L3C_PREFIX "_Q10", .mt_lcd_switch = L3C_PREFIX "_Q10",
.lcd_status = "\\GL32", .lcd_status = "\\GL32",
.brightness_up = L3C_PREFIX "_Q0F",
.brightness_down = L3C_PREFIX "_Q0E",
.brightness_set = "SPLV", .brightness_set = "SPLV",
.brightness_get = "GPLV", .brightness_get = "GPLV",
.brightness_status = "\\BLVL",
.display_set = "SDSP", .display_set = "SDSP",
.display_get = "\\_SB.PCI0.PCI1.VGAC.NMAP" .display_get = "\\_SB.PCI0.PCI1.VGAC.NMAP"
}, },
...@@ -233,11 +227,8 @@ static struct model_data model_conf[END_MODEL] = { ...@@ -233,11 +227,8 @@ static struct model_data model_conf[END_MODEL] = {
.mt_wled = "WLED", .mt_wled = "WLED",
.mt_lcd_switch = "\\Q10", .mt_lcd_switch = "\\Q10",
.lcd_status = "\\BKLG", .lcd_status = "\\BKLG",
.brightness_up = "\\Q0E",
.brightness_down = "\\Q0F",
.brightness_set = "SPLV", .brightness_set = "SPLV",
.brightness_get = "GPLV", .brightness_get = "GPLV",
.brightness_status = "\\BLVL",
.display_set = "SDSP", .display_set = "SDSP",
.display_get = "\\INFB" .display_get = "\\INFB"
}, },
...@@ -257,14 +248,10 @@ static struct model_data model_conf[END_MODEL] = { ...@@ -257,14 +248,10 @@ static struct model_data model_conf[END_MODEL] = {
{ {
.name = "L5x", .name = "L5x",
.mt_mled = "MLED", .mt_mled = "MLED",
// .mt_wled = "WLED", /* WLED present, but not controlled by ACPI */
// .wled_status = "\\WRED",
/* Present, but not controlled by ACPI */
.mt_tled = "TLED", .mt_tled = "TLED",
.mt_lcd_switch = "\\Q0D", .mt_lcd_switch = "\\Q0D",
.lcd_status = "\\BAOF", .lcd_status = "\\BAOF",
.brightness_up = "\\Q0C",
.brightness_down = "\\Q0B",
.brightness_set = "SPLV", .brightness_set = "SPLV",
.brightness_get = "GPLV", .brightness_get = "GPLV",
.display_set = "SDSP", .display_set = "SDSP",
...@@ -294,14 +281,24 @@ static struct model_data model_conf[END_MODEL] = { ...@@ -294,14 +281,24 @@ static struct model_data model_conf[END_MODEL] = {
.mt_wled = "WLED", .mt_wled = "WLED",
.mt_lcd_switch = "\\Q10", .mt_lcd_switch = "\\Q10",
.lcd_status = "\\GP06", .lcd_status = "\\GP06",
.brightness_up = "\\Q0E",
.brightness_down = "\\Q0F",
.brightness_set = "SPLV", .brightness_set = "SPLV",
.brightness_get = "GPLV", .brightness_get = "GPLV",
.display_set = "SDSP", .display_set = "SDSP",
.display_get = "\\INFB" .display_get = "\\INFB"
}, },
{
.name = "P30",
.mt_wled = "WLED",
.mt_lcd_switch = P30_PREFIX "_Q0E",
.lcd_status = "\\BKLT",
.brightness_up = P30_PREFIX "_Q68",
.brightness_down = P30_PREFIX "_Q69",
.brightness_get = "GPLV",
.display_set = "SDSP",
.display_get = "\\DNXT"
},
{ {
.name = "S1x", .name = "S1x",
.mt_mled = "MLED", .mt_mled = "MLED",
...@@ -309,11 +306,8 @@ static struct model_data model_conf[END_MODEL] = { ...@@ -309,11 +306,8 @@ static struct model_data model_conf[END_MODEL] = {
.mt_wled = "WLED", .mt_wled = "WLED",
.mt_lcd_switch = S1x_PREFIX "Q10" , .mt_lcd_switch = S1x_PREFIX "Q10" ,
.lcd_status = "\\PNOF", .lcd_status = "\\PNOF",
.brightness_up = S1x_PREFIX "Q0F",
.brightness_down = S1x_PREFIX "Q0E",
.brightness_set = "SPLV", .brightness_set = "SPLV",
.brightness_get = "GPLV", .brightness_get = "GPLV"
.brightness_status = "\\BRIT",
}, },
{ {
...@@ -323,22 +317,17 @@ static struct model_data model_conf[END_MODEL] = { ...@@ -323,22 +317,17 @@ static struct model_data model_conf[END_MODEL] = {
.mt_lcd_switch = S2x_PREFIX "_Q10", .mt_lcd_switch = S2x_PREFIX "_Q10",
.lcd_status = "\\BKLI", .lcd_status = "\\BKLI",
.brightness_up = S2x_PREFIX "_Q0B", .brightness_up = S2x_PREFIX "_Q0B",
.brightness_down = S2x_PREFIX "_Q0A", .brightness_down = S2x_PREFIX "_Q0A"
}, },
{ {
.name = "xxN", .name = "xxN",
.mt_mled = "MLED", .mt_mled = "MLED",
// .mt_wled = "WLED", /* WLED present, but not controlled by ACPI */
// .wled_status = "\\PO33",
/* Present, but not controlled by ACPI */
.mt_lcd_switch = xxN_PREFIX "_Q10", .mt_lcd_switch = xxN_PREFIX "_Q10",
.lcd_status = "\\BKLT", .lcd_status = "\\BKLT",
.brightness_up = xxN_PREFIX "_Q0F",
.brightness_down = xxN_PREFIX "_Q0E",
.brightness_set = "SPLV", .brightness_set = "SPLV",
.brightness_get = "GPLV", .brightness_get = "GPLV",
.brightness_status = "\\LBTN",
.display_set = "SDSP", .display_set = "SDSP",
.display_get = "\\ADVG" .display_get = "\\ADVG"
} }
...@@ -663,6 +652,23 @@ proc_write_lcd(struct file *file, const char *buffer, ...@@ -663,6 +652,23 @@ proc_write_lcd(struct file *file, const char *buffer,
} }
static int read_brightness(struct asus_hotk *hotk)
{
int value;
if(hotk->methods->brightness_get) { /* SPLV/GPLV laptop */
if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get,
&value))
printk(KERN_WARNING "Asus ACPI: Error reading brightness\n");
} else if (hotk->methods->brightness_status) { /* For D1 for example */
if (!read_acpi_int(NULL, hotk->methods->brightness_status,
&value))
printk(KERN_WARNING "Asus ACPI: Error reading brightness\n");
} else /* No GPLV method */
value = hotk->brightness;
return value;
}
/* /*
* Change the brightness level * Change the brightness level
*/ */
...@@ -679,7 +685,7 @@ static void set_brightness(int value, struct asus_hotk *hotk) ...@@ -679,7 +685,7 @@ static void set_brightness(int value, struct asus_hotk *hotk)
} }
/* No SPLV method if we are here, act as appropriate */ /* No SPLV method if we are here, act as appropriate */
value -= hotk->brightness; value -= read_brightness(hotk);
while (value != 0) { while (value != 0) {
status = acpi_evaluate_object(NULL, (value > 0) ? status = acpi_evaluate_object(NULL, (value > 0) ?
hotk->methods->brightness_up : hotk->methods->brightness_up :
...@@ -692,23 +698,6 @@ static void set_brightness(int value, struct asus_hotk *hotk) ...@@ -692,23 +698,6 @@ static void set_brightness(int value, struct asus_hotk *hotk)
return; return;
} }
static int read_brightness(struct asus_hotk *hotk)
{
int value;
if(hotk->methods->brightness_get) { /* SPLV/GPLV laptop */
if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get,
&value))
printk(KERN_WARNING "Asus ACPI: Error reading brightness\n");
} else if (hotk->methods->brightness_status) { /* For D1 for example */
if (!read_acpi_int(NULL, hotk->methods->brightness_status,
&value))
printk(KERN_WARNING "Asus ACPI: Error reading brightness\n");
} else /* No GPLV method */
value = hotk->brightness;
return value;
}
static int static int
proc_read_brn(char *page, char **start, off_t off, int count, int *eof, proc_read_brn(char *page, char **start, off_t off, int count, int *eof,
void *data) void *data)
...@@ -929,12 +918,29 @@ static int __init asus_hotk_get_info(struct asus_hotk *hotk) ...@@ -929,12 +918,29 @@ static int __init asus_hotk_get_info(struct asus_hotk *hotk)
return -ENODEV; return -ENODEV;
} }
/* For testing purposes */ /* This needs to be called for some laptops to init properly */
if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result)) if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result))
printk(KERN_WARNING " Error calling BSTS\n"); printk(KERN_WARNING " Error calling BSTS\n");
else if (bsts_result) else if (bsts_result)
printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", bsts_result); printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", bsts_result);
/* Samsung P30 has a device with a valid _HID whose INIT does not
* return anything. Catch this one and any similar here */
if (buffer.pointer == NULL) {
if (asus_info && /* Samsung P30 */
strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) {
hotk->model = P30;
printk(KERN_NOTICE " Samsung P30 detected, supported\n");
} else {
hotk->model = M2E;
printk(KERN_WARNING " no string returned by INIT\n");
printk(KERN_WARNING " trying default values, supply "
"the developers with your DSDT\n");
}
hotk->methods = &model_conf[hotk->model];
return AE_OK;
}
model = (union acpi_object *) buffer.pointer; model = (union acpi_object *) buffer.pointer;
if (model->type == ACPI_TYPE_STRING) { if (model->type == ACPI_TYPE_STRING) {
printk(KERN_NOTICE " %s model detected, ", model->string.pointer); printk(KERN_NOTICE " %s model detected, ", model->string.pointer);
...@@ -953,12 +959,14 @@ static int __init asus_hotk_get_info(struct asus_hotk *hotk) ...@@ -953,12 +959,14 @@ static int __init asus_hotk_get_info(struct asus_hotk *hotk)
hotk->model = L8L; hotk->model = L8L;
else if (strncmp(model->string.pointer, "M2N", 3) == 0 || else if (strncmp(model->string.pointer, "M2N", 3) == 0 ||
strncmp(model->string.pointer, "M3N", 3) == 0 || strncmp(model->string.pointer, "M3N", 3) == 0 ||
strncmp(model->string.pointer, "M6N", 3) == 0 ||
strncmp(model->string.pointer, "S1N", 3) == 0 || strncmp(model->string.pointer, "S1N", 3) == 0 ||
strncmp(model->string.pointer, "S5N", 3) == 0) strncmp(model->string.pointer, "S5N", 3) == 0)
hotk->model = xxN; hotk->model = xxN;
else if (strncmp(model->string.pointer, "M1", 2) == 0) else if (strncmp(model->string.pointer, "M1", 2) == 0)
hotk->model = M1A; hotk->model = M1A;
else if (strncmp(model->string.pointer, "M2", 2) == 0) else if (strncmp(model->string.pointer, "M2", 2) == 0 ||
strncmp(model->string.pointer, "L4E", 3) == 0)
hotk->model = M2E; hotk->model = M2E;
else if (strncmp(model->string.pointer, "L2", 2) == 0) else if (strncmp(model->string.pointer, "L2", 2) == 0)
hotk->model = L2D; hotk->model = L2D;
...@@ -994,6 +1002,13 @@ static int __init asus_hotk_get_info(struct asus_hotk *hotk) ...@@ -994,6 +1002,13 @@ static int __init asus_hotk_get_info(struct asus_hotk *hotk)
else if (strncmp(model->string.pointer, "S5N", 3) == 0) else if (strncmp(model->string.pointer, "S5N", 3) == 0)
hotk->methods->mt_mled = NULL; hotk->methods->mt_mled = NULL;
/* S5N has no MLED */ /* S5N has no MLED */
else if (strncmp(model->string.pointer, "M6N", 3) == 0) {
hotk->methods->display_get = NULL; //TODO
hotk->methods->lcd_status = "\\_SB.BKLT";
hotk->methods->mt_wled = "WLED";
hotk->methods->wled_status = "\\_SB.PCI0.SBRG.SG13";
/* M6N differs slightly and has a usable WLED */
}
else if (asus_info) { else if (asus_info) {
if (strncmp(asus_info->oem_table_id, "L1", 2) == 0) if (strncmp(asus_info->oem_table_id, "L1", 2) == 0)
hotk->methods->mled_status = NULL; hotk->methods->mled_status = NULL;
......
...@@ -486,14 +486,18 @@ acpi_battery_read_state ( ...@@ -486,14 +486,18 @@ acpi_battery_read_state (
else else
p += sprintf(p, "capacity state: critical\n"); p += sprintf(p, "capacity state: critical\n");
if ((bst->state & 0x01) && (bst->state & 0x02)) if ((bst->state & 0x01) && (bst->state & 0x02)){
p += sprintf(p, "charging state: charging/discharging\n"); p += sprintf(p, "charging state: charging/discharging\n");
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Battery Charging and Discharging?\n"));
}
else if (bst->state & 0x01) else if (bst->state & 0x01)
p += sprintf(p, "charging state: discharging\n"); p += sprintf(p, "charging state: discharging\n");
else if (bst->state & 0x02) else if (bst->state & 0x02)
p += sprintf(p, "charging state: charging\n"); p += sprintf(p, "charging state: charging\n");
else else {
p += sprintf(p, "charging state: unknown\n"); p += sprintf(p, "charging state: charged\n");
}
if (bst->present_rate == ACPI_BATTERY_VALUE_UNKNOWN) if (bst->present_rate == ACPI_BATTERY_VALUE_UNKNOWN)
p += sprintf(p, "present rate: unknown\n"); p += sprintf(p, "present rate: unknown\n");
...@@ -621,6 +625,7 @@ acpi_battery_add_fs ( ...@@ -621,6 +625,7 @@ acpi_battery_add_fs (
acpi_battery_dir); acpi_battery_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_device_dir(device)->owner = THIS_MODULE;
} }
/* 'info' [R] */ /* 'info' [R] */
...@@ -633,6 +638,7 @@ acpi_battery_add_fs ( ...@@ -633,6 +638,7 @@ acpi_battery_add_fs (
else { else {
entry->read_proc = acpi_battery_read_info; entry->read_proc = acpi_battery_read_info;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'status' [R] */ /* 'status' [R] */
...@@ -645,6 +651,7 @@ acpi_battery_add_fs ( ...@@ -645,6 +651,7 @@ acpi_battery_add_fs (
else { else {
entry->read_proc = acpi_battery_read_state; entry->read_proc = acpi_battery_read_state;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'alarm' [R/W] */ /* 'alarm' [R/W] */
...@@ -658,6 +665,7 @@ acpi_battery_add_fs ( ...@@ -658,6 +665,7 @@ acpi_battery_add_fs (
entry->read_proc = acpi_battery_read_alarm; entry->read_proc = acpi_battery_read_alarm;
entry->write_proc = acpi_battery_write_alarm; entry->write_proc = acpi_battery_write_alarm;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
return_VALUE(0); return_VALUE(0);
...@@ -809,6 +817,7 @@ acpi_battery_init (void) ...@@ -809,6 +817,7 @@ acpi_battery_init (void)
acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir); acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
if (!acpi_battery_dir) if (!acpi_battery_dir)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_battery_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_battery_driver); result = acpi_bus_register_driver(&acpi_battery_driver);
if (result < 0) { if (result < 0) {
......
...@@ -187,9 +187,14 @@ acpi_button_add_fs ( ...@@ -187,9 +187,14 @@ acpi_button_add_fs (
break; break;
} }
if (!entry)
return_VALUE(-ENODEV);
entry->owner = THIS_MODULE;
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_device_dir(device)->owner = THIS_MODULE;
/* 'info' [R] */ /* 'info' [R] */
entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
...@@ -201,6 +206,7 @@ acpi_button_add_fs ( ...@@ -201,6 +206,7 @@ acpi_button_add_fs (
else { else {
entry->proc_fops = &acpi_button_info_fops; entry->proc_fops = &acpi_button_info_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* show lid state [R] */ /* show lid state [R] */
...@@ -214,6 +220,7 @@ acpi_button_add_fs ( ...@@ -214,6 +220,7 @@ acpi_button_add_fs (
else { else {
entry->proc_fops = &acpi_button_state_fops; entry->proc_fops = &acpi_button_state_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
} }
...@@ -225,10 +232,28 @@ static int ...@@ -225,10 +232,28 @@ static int
acpi_button_remove_fs ( acpi_button_remove_fs (
struct acpi_device *device) struct acpi_device *device)
{ {
struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_remove_fs"); ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
button = acpi_driver_data(device);
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(acpi_device_bid(device), acpi_button_dir); switch (button->type) {
case ACPI_BUTTON_TYPE_POWER:
case ACPI_BUTTON_TYPE_POWERF:
remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER,
acpi_button_dir);
break;
case ACPI_BUTTON_TYPE_SLEEP:
case ACPI_BUTTON_TYPE_SLEEPF:
remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP,
acpi_button_dir);
break;
case ACPI_BUTTON_TYPE_LID:
remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID,
acpi_button_dir);
break;
}
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
...@@ -485,6 +510,7 @@ acpi_button_init (void) ...@@ -485,6 +510,7 @@ acpi_button_init (void)
acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
if (!acpi_button_dir) if (!acpi_button_dir)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_button_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_button_driver); result = acpi_bus_register_driver(&acpi_button_driver);
if (result < 0) { if (result < 0) {
......
...@@ -157,6 +157,7 @@ acpi_fan_add_fs ( ...@@ -157,6 +157,7 @@ acpi_fan_add_fs (
acpi_fan_dir); acpi_fan_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_device_dir(device)->owner = THIS_MODULE;
} }
/* 'status' [R/W] */ /* 'status' [R/W] */
...@@ -170,6 +171,7 @@ acpi_fan_add_fs ( ...@@ -170,6 +171,7 @@ acpi_fan_add_fs (
entry->read_proc = acpi_fan_read_state; entry->read_proc = acpi_fan_read_state;
entry->write_proc = acpi_fan_write_state; entry->write_proc = acpi_fan_write_state;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
return_VALUE(0); return_VALUE(0);
...@@ -273,6 +275,7 @@ acpi_fan_init (void) ...@@ -273,6 +275,7 @@ acpi_fan_init (void)
acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir);
if (!acpi_fan_dir) if (!acpi_fan_dir)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_fan_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_fan_driver); result = acpi_bus_register_driver(&acpi_fan_driver);
if (result < 0) { if (result < 0) {
......
...@@ -371,6 +371,10 @@ acpi_pci_link_set ( ...@@ -371,6 +371,10 @@ acpi_pci_link_set (
resource.res.length = sizeof(struct acpi_resource); resource.res.length = sizeof(struct acpi_resource);
resource.res.data.irq.edge_level = link->irq.edge_level; resource.res.data.irq.edge_level = link->irq.edge_level;
resource.res.data.irq.active_high_low = link->irq.active_high_low; resource.res.data.irq.active_high_low = link->irq.active_high_low;
if (link->irq.edge_level == ACPI_EDGE_SENSITIVE)
resource.res.data.irq.shared_exclusive = ACPI_EXCLUSIVE;
else
resource.res.data.irq.shared_exclusive = ACPI_SHARED;
resource.res.data.irq.number_of_interrupts = 1; resource.res.data.irq.number_of_interrupts = 1;
resource.res.data.irq.interrupts[0] = irq; resource.res.data.irq.interrupts[0] = irq;
break; break;
...@@ -381,6 +385,10 @@ acpi_pci_link_set ( ...@@ -381,6 +385,10 @@ acpi_pci_link_set (
resource.res.data.extended_irq.producer_consumer = ACPI_CONSUMER; resource.res.data.extended_irq.producer_consumer = ACPI_CONSUMER;
resource.res.data.extended_irq.edge_level = link->irq.edge_level; resource.res.data.extended_irq.edge_level = link->irq.edge_level;
resource.res.data.extended_irq.active_high_low = link->irq.active_high_low; resource.res.data.extended_irq.active_high_low = link->irq.active_high_low;
if (link->irq.edge_level == ACPI_EDGE_SENSITIVE)
resource.res.data.irq.shared_exclusive = ACPI_EXCLUSIVE;
else
resource.res.data.irq.shared_exclusive = ACPI_SHARED;
resource.res.data.extended_irq.number_of_interrupts = 1; resource.res.data.extended_irq.number_of_interrupts = 1;
resource.res.data.extended_irq.interrupts[0] = irq; resource.res.data.extended_irq.interrupts[0] = irq;
/* ignore resource_source, it's optional */ /* ignore resource_source, it's optional */
......
...@@ -1190,6 +1190,7 @@ acpi_cpufreq_add_file ( ...@@ -1190,6 +1190,7 @@ acpi_cpufreq_add_file (
entry->proc_fops = &acpi_processor_perf_fops; entry->proc_fops = &acpi_processor_perf_fops;
entry->proc_fops->write = acpi_processor_write_performance; entry->proc_fops->write = acpi_processor_write_performance;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
return_VOID; return_VOID;
} }
...@@ -2066,6 +2067,7 @@ acpi_processor_add_fs ( ...@@ -2066,6 +2067,7 @@ acpi_processor_add_fs (
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
} }
acpi_device_dir(device)->owner = THIS_MODULE;
/* 'info' [R] */ /* 'info' [R] */
entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO,
...@@ -2077,6 +2079,7 @@ acpi_processor_add_fs ( ...@@ -2077,6 +2079,7 @@ acpi_processor_add_fs (
else { else {
entry->proc_fops = &acpi_processor_info_fops; entry->proc_fops = &acpi_processor_info_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'power' [R] */ /* 'power' [R] */
...@@ -2089,6 +2092,7 @@ acpi_processor_add_fs ( ...@@ -2089,6 +2092,7 @@ acpi_processor_add_fs (
else { else {
entry->proc_fops = &acpi_processor_power_fops; entry->proc_fops = &acpi_processor_power_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'throttling' [R/W] */ /* 'throttling' [R/W] */
...@@ -2102,6 +2106,7 @@ acpi_processor_add_fs ( ...@@ -2102,6 +2106,7 @@ acpi_processor_add_fs (
entry->proc_fops = &acpi_processor_throttling_fops; entry->proc_fops = &acpi_processor_throttling_fops;
entry->proc_fops->write = acpi_processor_write_throttling; entry->proc_fops->write = acpi_processor_write_throttling;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'limit' [R/W] */ /* 'limit' [R/W] */
...@@ -2115,6 +2120,7 @@ acpi_processor_add_fs ( ...@@ -2115,6 +2120,7 @@ acpi_processor_add_fs (
entry->proc_fops = &acpi_processor_limit_fops; entry->proc_fops = &acpi_processor_limit_fops;
entry->proc_fops->write = acpi_processor_write_limit; entry->proc_fops->write = acpi_processor_write_limit;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
return_VALUE(0); return_VALUE(0);
...@@ -2128,6 +2134,11 @@ acpi_processor_remove_fs ( ...@@ -2128,6 +2134,11 @@ acpi_processor_remove_fs (
ACPI_FUNCTION_TRACE("acpi_processor_remove_fs"); ACPI_FUNCTION_TRACE("acpi_processor_remove_fs");
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_PROCESSOR_FILE_INFO,acpi_device_dir(device));
remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,acpi_device_dir(device));
remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING,
acpi_device_dir(device));
remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT,acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), acpi_processor_dir); remove_proc_entry(acpi_device_bid(device), acpi_processor_dir);
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
...@@ -2385,6 +2396,7 @@ acpi_processor_init (void) ...@@ -2385,6 +2396,7 @@ acpi_processor_init (void)
acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
if (!acpi_processor_dir) if (!acpi_processor_dir)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_processor_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_processor_driver); result = acpi_bus_register_driver(&acpi_processor_driver);
if (result < 0) { if (result < 0) {
......
...@@ -1060,6 +1060,7 @@ acpi_thermal_add_fs ( ...@@ -1060,6 +1060,7 @@ acpi_thermal_add_fs (
acpi_thermal_dir); acpi_thermal_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_device_dir(device)->owner = THIS_MODULE;
} }
/* 'state' [R] */ /* 'state' [R] */
...@@ -1072,6 +1073,7 @@ acpi_thermal_add_fs ( ...@@ -1072,6 +1073,7 @@ acpi_thermal_add_fs (
else { else {
entry->proc_fops = &acpi_thermal_state_fops; entry->proc_fops = &acpi_thermal_state_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'temperature' [R] */ /* 'temperature' [R] */
...@@ -1084,6 +1086,7 @@ acpi_thermal_add_fs ( ...@@ -1084,6 +1086,7 @@ acpi_thermal_add_fs (
else { else {
entry->proc_fops = &acpi_thermal_temp_fops; entry->proc_fops = &acpi_thermal_temp_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'trip_points' [R/W] */ /* 'trip_points' [R/W] */
...@@ -1096,6 +1099,7 @@ acpi_thermal_add_fs ( ...@@ -1096,6 +1099,7 @@ acpi_thermal_add_fs (
else { else {
entry->proc_fops = &acpi_thermal_trip_fops; entry->proc_fops = &acpi_thermal_trip_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'cooling_mode' [R/W] */ /* 'cooling_mode' [R/W] */
...@@ -1108,6 +1112,7 @@ acpi_thermal_add_fs ( ...@@ -1108,6 +1112,7 @@ acpi_thermal_add_fs (
else { else {
entry->proc_fops = &acpi_thermal_cooling_fops; entry->proc_fops = &acpi_thermal_cooling_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'polling_frequency' [R/W] */ /* 'polling_frequency' [R/W] */
...@@ -1120,6 +1125,7 @@ acpi_thermal_add_fs ( ...@@ -1120,6 +1125,7 @@ acpi_thermal_add_fs (
else { else {
entry->proc_fops = &acpi_thermal_polling_fops; entry->proc_fops = &acpi_thermal_polling_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
return_VALUE(0); return_VALUE(0);
...@@ -1338,6 +1344,7 @@ acpi_thermal_init (void) ...@@ -1338,6 +1344,7 @@ acpi_thermal_init (void)
acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir);
if (!acpi_thermal_dir) if (!acpi_thermal_dir)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_thermal_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_thermal_driver); result = acpi_bus_register_driver(&acpi_thermal_driver);
if (result < 0) { if (result < 0) {
......
...@@ -502,6 +502,8 @@ add_device(void) ...@@ -502,6 +502,8 @@ add_device(void)
proc = create_proc_read_entry(item->name, proc = create_proc_read_entry(item->name,
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
toshiba_proc_dir, (read_proc_t*)dispatch_read, item); toshiba_proc_dir, (read_proc_t*)dispatch_read, item);
if (proc)
proc->owner = THIS_MODULE;
if (proc && item->write_func) if (proc && item->write_func)
proc->write_proc = (write_proc_t*)dispatch_write; proc->write_proc = (write_proc_t*)dispatch_write;
} }
...@@ -525,6 +527,8 @@ toshiba_acpi_init(void) ...@@ -525,6 +527,8 @@ toshiba_acpi_init(void)
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 hci_result; u32 hci_result;
if (acpi_disabled)
return -ENODEV;
/* simple device detection: look for HCI method */ /* simple device detection: look for HCI method */
if (is_valid_acpi_path(METHOD_HCI_1)) if (is_valid_acpi_path(METHOD_HCI_1))
method_hci = METHOD_HCI_1; method_hci = METHOD_HCI_1;
...@@ -547,6 +551,7 @@ toshiba_acpi_init(void) ...@@ -547,6 +551,7 @@ toshiba_acpi_init(void)
if (!toshiba_proc_dir) { if (!toshiba_proc_dir) {
status = AE_ERROR; status = AE_ERROR;
} else { } else {
toshiba_proc_dir->owner = THIS_MODULE;
status = add_device(); status = add_device();
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
remove_proc_entry(PROC_TOSHIBA, acpi_root_dir); remove_proc_entry(PROC_TOSHIBA, acpi_root_dir);
......
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