aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-25 10:54:38 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-25 10:54:38 -0400
commit0b887d037bf4b76eec1c960e5feecd6a5a806971 (patch)
tree8d4bd6b0f8d33684758f573db0de986616b5daa2
parentd1caeb02b17c6bc215a9a40a98a1beb92dcbd310 (diff)
parent136c4bbfe69336cd1d0b076cfc0ef6b92d576a19 (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (30 commits) ACPI: work around duplicate name "VID" problem on T61 acpiphp_ibm: add missing '\n' to error message ACPI: add dump_stack() to trace acpi_format_exception programming errors make drivers/acpi/scan.c:create_modalias() static ACPI: Fix a warning of discarding qualifiers from pointer target type ACPI: "ACPI handle has no context!" should be KERN_DEBUG ACPI video hotkey: export missing ACPI video hotkey events via input layer ACPI: Validate XSDT, use RSDT if XSDT fails ACPI: /proc/acpi/thermal_zone trip points are now read-only, mark them as such ACPI: fix ia64 allnoconfig build PNP: remove null pointer checks PNP: remove MODULE infrastructure ISAPNP: removed unused isapnp_detected and ISAPNP_DEBUG PNPACPI: remove unnecessary casts of "void *" PNPACPI: simplify irq_flags() PNP: fix up after Lindent ACPI: enable GPEs before calling _WAK on resume asus-laptop: Fix rmmod of asus_laptop sony-laptop: call sonypi_compat_init earlier sony-laptop: enable Vaio FZ events ...
-rw-r--r--Documentation/feature-removal-schedule.txt8
-rw-r--r--Documentation/kernel-parameters.txt19
-rw-r--r--arch/i386/kernel/io_apic.c8
-rw-r--r--arch/x86_64/kernel/io_apic.c8
-rw-r--r--drivers/acpi/Kconfig14
-rw-r--r--drivers/acpi/ac.c5
-rw-r--r--drivers/acpi/asus_acpi.c2
-rw-r--r--drivers/acpi/battery.c52
-rw-r--r--drivers/acpi/bus.c10
-rw-r--r--drivers/acpi/button.c2
-rw-r--r--drivers/acpi/ec.c47
-rw-r--r--drivers/acpi/event.c22
-rw-r--r--drivers/acpi/hardware/hwsleep.c19
-rw-r--r--drivers/acpi/namespace/nsxfeval.c2
-rw-r--r--drivers/acpi/processor_core.c13
-rw-r--r--drivers/acpi/sbs.c3
-rw-r--r--drivers/acpi/scan.c5
-rw-r--r--drivers/acpi/sleep/main.c2
-rw-r--r--drivers/acpi/tables/tbutils.c71
-rw-r--r--drivers/acpi/thermal.c67
-rw-r--r--drivers/acpi/utilities/utglobal.c1
-rw-r--r--drivers/acpi/video.c109
-rw-r--r--drivers/char/sonypi.c2
-rw-r--r--drivers/misc/asus-laptop.c5
-rw-r--r--drivers/misc/sony-laptop.c28
-rw-r--r--drivers/misc/thinkpad_acpi.c26
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c7
-rw-r--r--drivers/pnp/card.c16
-rw-r--r--drivers/pnp/core.c7
-rw-r--r--drivers/pnp/driver.c6
-rw-r--r--drivers/pnp/interface.c9
-rw-r--r--drivers/pnp/isapnp/core.c24
-rw-r--r--drivers/pnp/isapnp/proc.c45
-rw-r--r--drivers/pnp/manager.c27
-rw-r--r--drivers/pnp/pnpacpi/core.c4
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c23
-rw-r--r--drivers/pnp/pnpbios/core.c44
-rw-r--r--drivers/pnp/pnpbios/proc.c2
-rw-r--r--drivers/pnp/pnpbios/rsparser.c9
-rw-r--r--drivers/pnp/resource.c26
-rw-r--r--include/acpi/acpi_bus.h10
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/acpi/acstruct.h2
-rw-r--r--include/asm-i386/io_apic.h1
-rw-r--r--include/asm-x86_64/io_apic.h6
-rw-r--r--include/linux/input.h6
-rw-r--r--init/main.c12
47 files changed, 502 insertions, 336 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index a43d2878a4ef..b9a3fdc1cc5a 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -197,6 +197,14 @@ Who: Len Brown <len.brown@intel.com>
197 197
198--------------------------- 198---------------------------
199 199
200What: /proc/acpi/event
201When: February 2008
202Why: /proc/acpi/event has been replaced by events via the input layer
203 and netlink since 2.6.23.
204Who: Len Brown <len.brown@intel.com>
205
206---------------------------
207
200What: Compaq touchscreen device emulation 208What: Compaq touchscreen device emulation
201When: Oct 2007 209When: Oct 2007
202Files: drivers/input/tsdev.c 210Files: drivers/input/tsdev.c
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 975f029be25c..b41cde31d112 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -952,14 +952,10 @@ and is between 256 and 4096 characters. It is defined in the file
952 Format: <1-256> 952 Format: <1-256>
953 953
954 maxcpus= [SMP] Maximum number of processors that an SMP kernel 954 maxcpus= [SMP] Maximum number of processors that an SMP kernel
955 should make use of. 955 should make use of. maxcpus=n : n >= 0 limits the
956 Using "nosmp" or "maxcpus=0" will disable SMP 956 kernel to using 'n' processors. n=0 is a special case,
957 entirely (the MPS table probe still happens, though). 957 it is equivalent to "nosmp", which also disables
958 A command-line option of "maxcpus=<NUM>", where <NUM> 958 the IO APIC.
959 is an integer greater than 0, limits the maximum number
960 of CPUs activated in SMP mode to <NUM>.
961 Using "maxcpus=1" on an SMP kernel is the trivial
962 case of an SMP kernel with only one CPU.
963 959
964 max_addr=[KMG] [KNL,BOOT,ia64] All physical memory greater than or 960 max_addr=[KMG] [KNL,BOOT,ia64] All physical memory greater than or
965 equal to this physical address is ignored. 961 equal to this physical address is ignored.
@@ -1184,7 +1180,8 @@ and is between 256 and 4096 characters. It is defined in the file
1184 1180
1185 nosep [BUGS=X86-32] Disables x86 SYSENTER/SYSEXIT support. 1181 nosep [BUGS=X86-32] Disables x86 SYSENTER/SYSEXIT support.
1186 1182
1187 nosmp [SMP] Tells an SMP kernel to act as a UP kernel. 1183 nosmp [SMP] Tells an SMP kernel to act as a UP kernel,
1184 and disable the IO APIC. legacy for "maxcpus=0".
1188 1185
1189 nosoftlockup [KNL] Disable the soft-lockup detector. 1186 nosoftlockup [KNL] Disable the soft-lockup detector.
1190 1187
@@ -1826,6 +1823,10 @@ and is between 256 and 4096 characters. It is defined in the file
1826 -1: disable all active trip points in all thermal zones 1823 -1: disable all active trip points in all thermal zones
1827 <degrees C>: override all lowest active trip points 1824 <degrees C>: override all lowest active trip points
1828 1825
1826 thermal.crt= [HW,ACPI]
1827 -1: disable all critical trip points in all thermal zones
1828 <degrees C>: lower all critical trip points
1829
1829 thermal.nocrt= [HW,ACPI] 1830 thermal.nocrt= [HW,ACPI]
1830 Set to disable actions on ACPI thermal zone 1831 Set to disable actions on ACPI thermal zone
1831 critical and hot trip points. 1832 critical and hot trip points.
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 4b8a8da4b2e0..e2f4a1c68547 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -754,14 +754,6 @@ static int pirq_entries [MAX_PIRQS];
754static int pirqs_enabled; 754static int pirqs_enabled;
755int skip_ioapic_setup; 755int skip_ioapic_setup;
756 756
757static int __init ioapic_setup(char *str)
758{
759 skip_ioapic_setup = 1;
760 return 1;
761}
762
763__setup("noapic", ioapic_setup);
764
765static int __init ioapic_pirq_setup(char *str) 757static int __init ioapic_pirq_setup(char *str)
766{ 758{
767 int i, max; 759 int i, max;
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index f57f8b901912..966fa1062491 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -397,14 +397,12 @@ static void clear_IO_APIC (void)
397int skip_ioapic_setup; 397int skip_ioapic_setup;
398int ioapic_force; 398int ioapic_force;
399 399
400/* dummy parsing: see setup.c */ 400static int __init parse_noapic(char *str)
401
402static int __init disable_ioapic_setup(char *str)
403{ 401{
404 skip_ioapic_setup = 1; 402 disable_ioapic_setup();
405 return 0; 403 return 0;
406} 404}
407early_param("noapic", disable_ioapic_setup); 405early_param("noapic", parse_noapic);
408 406
409/* Actually the next is obsolete, but keep it for paranoid reasons -AK */ 407/* Actually the next is obsolete, but keep it for paranoid reasons -AK */
410static int __init disable_timer_pin_setup(char *arg) 408static int __init disable_timer_pin_setup(char *arg)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index f1372de4ce79..574259476fbf 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -68,6 +68,20 @@ config ACPI_PROCFS
68 68
69 Say N to delete /proc/acpi/ files that have moved to /sys/ 69 Say N to delete /proc/acpi/ files that have moved to /sys/
70 70
71config ACPI_PROC_EVENT
72 bool "Deprecated /proc/acpi/event support"
73 depends on PROC_FS
74 ---help---
75 A user-space daemon, acpi, typically read /proc/acpi/event
76 and handled all ACPI sub-system generated events.
77
78 These events are now delivered to user-space via
79 either the input layer, or as netlink events.
80
81 This build option enables the old code for for legacy
82 user-space implementation. After some time, this will
83 be moved under CONFIG_ACPI_PROCFS, and then deleted.
84
71config ACPI_AC 85config ACPI_AC
72 tristate "AC Adapter" 86 tristate "AC Adapter"
73 depends on X86 87 depends on X86
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index d8b35093527a..26d70702b313 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -204,7 +204,10 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
204 case ACPI_NOTIFY_BUS_CHECK: 204 case ACPI_NOTIFY_BUS_CHECK:
205 case ACPI_NOTIFY_DEVICE_CHECK: 205 case ACPI_NOTIFY_DEVICE_CHECK:
206 acpi_ac_get_state(ac); 206 acpi_ac_get_state(ac);
207 acpi_bus_generate_event(device, event, (u32) ac->state); 207 acpi_bus_generate_proc_event(device, event, (u32) ac->state);
208 acpi_bus_generate_netlink_event(device->pnp.device_class,
209 device->dev.bus_id, event,
210 (u32) ac->state);
208 break; 211 break;
209 default: 212 default:
210 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 213 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index 86fd142f4bf3..d915fec9bf63 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -1069,7 +1069,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
1069 hotk->brightness = (event & ~((u32) BR_DOWN)); 1069 hotk->brightness = (event & ~((u32) BR_DOWN));
1070 } 1070 }
1071 1071
1072 acpi_bus_generate_event(hotk->device, event, 1072 acpi_bus_generate_proc_event(hotk->device, event,
1073 hotk->event_count[event % 128]++); 1073 hotk->event_count[event % 128]++);
1074 1074
1075 return; 1075 return;
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index d7b499fe0cd9..9b2c0f74f869 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -113,7 +113,7 @@ struct acpi_battery_info {
113 acpi_string oem_info; 113 acpi_string oem_info;
114}; 114};
115 115
116enum acpi_battery_files { 116enum acpi_battery_files{
117 ACPI_BATTERY_INFO = 0, 117 ACPI_BATTERY_INFO = 0,
118 ACPI_BATTERY_STATE, 118 ACPI_BATTERY_STATE,
119 ACPI_BATTERY_ALARM, 119 ACPI_BATTERY_ALARM,
@@ -129,14 +129,13 @@ struct acpi_battery_flags {
129}; 129};
130 130
131struct acpi_battery { 131struct acpi_battery {
132 struct mutex mutex;
132 struct acpi_device *device; 133 struct acpi_device *device;
133 struct acpi_battery_flags flags; 134 struct acpi_battery_flags flags;
134 struct acpi_buffer bif_data; 135 struct acpi_buffer bif_data;
135 struct acpi_buffer bst_data; 136 struct acpi_buffer bst_data;
136 struct mutex lock;
137 unsigned long alarm; 137 unsigned long alarm;
138 unsigned long update_time[ACPI_BATTERY_NUMFILES]; 138 unsigned long update_time[ACPI_BATTERY_NUMFILES];
139
140}; 139};
141 140
142inline int acpi_battery_present(struct acpi_battery *battery) 141inline int acpi_battery_present(struct acpi_battery *battery)
@@ -236,10 +235,10 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
236 return 0; 235 return 0;
237 236
238 /* Evaluate _BIF */ 237 /* Evaluate _BIF */
239 mutex_lock(&battery->lock); 238
240 status = acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", 239 status =
241 NULL, &buffer); 240 acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL,
242 mutex_unlock(&battery->lock); 241 &buffer);
243 if (ACPI_FAILURE(status)) { 242 if (ACPI_FAILURE(status)) {
244 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); 243 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
245 return -ENODEV; 244 return -ENODEV;
@@ -286,10 +285,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
286 return 0; 285 return 0;
287 286
288 /* Evaluate _BST */ 287 /* Evaluate _BST */
289 mutex_lock(&battery->lock); 288
290 status = acpi_evaluate_object(acpi_battery_handle(battery), "_BST", 289 status =
291 NULL, &buffer); 290 acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL,
292 mutex_unlock(&battery->lock); 291 &buffer);
293 if (ACPI_FAILURE(status)) { 292 if (ACPI_FAILURE(status)) {
294 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); 293 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
295 return -ENODEV; 294 return -ENODEV;
@@ -337,10 +336,9 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery,
337 336
338 arg0.integer.value = alarm; 337 arg0.integer.value = alarm;
339 338
340 mutex_lock(&battery->lock); 339 status =
341 status = acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", 340 acpi_evaluate_object(acpi_battery_handle(battery), "_BTP",
342 &arg_list, NULL); 341 &arg_list, NULL);
343 mutex_unlock(&battery->lock);
344 if (ACPI_FAILURE(status)) 342 if (ACPI_FAILURE(status))
345 return -ENODEV; 343 return -ENODEV;
346 344
@@ -660,6 +658,8 @@ acpi_battery_write_alarm(struct file *file,
660 if (!battery || (count > sizeof(alarm_string) - 1)) 658 if (!battery || (count > sizeof(alarm_string) - 1))
661 return -EINVAL; 659 return -EINVAL;
662 660
661 mutex_lock(&battery->mutex);
662
663 result = acpi_battery_update(battery, 1, &update_result); 663 result = acpi_battery_update(battery, 1, &update_result);
664 if (result) { 664 if (result) {
665 result = -ENODEV; 665 result = -ENODEV;
@@ -688,7 +688,9 @@ acpi_battery_write_alarm(struct file *file,
688 acpi_battery_check_result(battery, result); 688 acpi_battery_check_result(battery, result);
689 689
690 if (!result) 690 if (!result)
691 return count; 691 result = count;
692
693 mutex_unlock(&battery->mutex);
692 694
693 return result; 695 return result;
694} 696}
@@ -712,6 +714,8 @@ static int acpi_battery_read(int fid, struct seq_file *seq)
712 int update_result = ACPI_BATTERY_NONE_UPDATE; 714 int update_result = ACPI_BATTERY_NONE_UPDATE;
713 int update = 0; 715 int update = 0;
714 716
717 mutex_lock(&battery->mutex);
718
715 update = (get_seconds() - battery->update_time[fid] >= update_time); 719 update = (get_seconds() - battery->update_time[fid] >= update_time);
716 update = (update | battery->flags.update[fid]); 720 update = (update | battery->flags.update[fid]);
717 721
@@ -729,6 +733,7 @@ static int acpi_battery_read(int fid, struct seq_file *seq)
729 result = acpi_read_funcs[fid].print(seq, result); 733 result = acpi_read_funcs[fid].print(seq, result);
730 acpi_battery_check_result(battery, result); 734 acpi_battery_check_result(battery, result);
731 battery->flags.update[fid] = result; 735 battery->flags.update[fid] = result;
736 mutex_unlock(&battery->mutex);
732 return result; 737 return result;
733} 738}
734 739
@@ -867,8 +872,11 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
867 case ACPI_NOTIFY_DEVICE_CHECK: 872 case ACPI_NOTIFY_DEVICE_CHECK:
868 device = battery->device; 873 device = battery->device;
869 acpi_battery_notify_update(battery); 874 acpi_battery_notify_update(battery);
870 acpi_bus_generate_event(device, event, 875 acpi_bus_generate_proc_event(device, event,
871 acpi_battery_present(battery)); 876 acpi_battery_present(battery));
877 acpi_bus_generate_netlink_event(device->pnp.device_class,
878 device->dev.bus_id, event,
879 acpi_battery_present(battery));
872 break; 880 break;
873 default: 881 default:
874 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 882 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -892,7 +900,10 @@ static int acpi_battery_add(struct acpi_device *device)
892 if (!battery) 900 if (!battery)
893 return -ENOMEM; 901 return -ENOMEM;
894 902
895 mutex_init(&battery->lock); 903 mutex_init(&battery->mutex);
904
905 mutex_lock(&battery->mutex);
906
896 battery->device = device; 907 battery->device = device;
897 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); 908 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
898 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); 909 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
@@ -928,6 +939,7 @@ static int acpi_battery_add(struct acpi_device *device)
928 kfree(battery); 939 kfree(battery);
929 } 940 }
930 941
942 mutex_unlock(&battery->mutex);
931 943
932 return result; 944 return result;
933} 945}
@@ -942,6 +954,8 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
942 954
943 battery = acpi_driver_data(device); 955 battery = acpi_driver_data(device);
944 956
957 mutex_lock(&battery->mutex);
958
945 status = acpi_remove_notify_handler(device->handle, 959 status = acpi_remove_notify_handler(device->handle,
946 ACPI_ALL_NOTIFY, 960 ACPI_ALL_NOTIFY,
947 acpi_battery_notify); 961 acpi_battery_notify);
@@ -952,7 +966,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
952 966
953 kfree(battery->bst_data.pointer); 967 kfree(battery->bst_data.pointer);
954 968
955 mutex_destroy(&battery->lock); 969 mutex_unlock(&battery->mutex);
970
971 mutex_destroy(&battery->mutex);
956 972
957 kfree(battery); 973 kfree(battery);
958 974
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 6b2658c96242..9ba778a2b484 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -276,6 +276,7 @@ EXPORT_SYMBOL(acpi_bus_set_power);
276 Event Management 276 Event Management
277 -------------------------------------------------------------------------- */ 277 -------------------------------------------------------------------------- */
278 278
279#ifdef CONFIG_ACPI_PROC_EVENT
279static DEFINE_SPINLOCK(acpi_bus_event_lock); 280static DEFINE_SPINLOCK(acpi_bus_event_lock);
280 281
281LIST_HEAD(acpi_bus_event_list); 282LIST_HEAD(acpi_bus_event_list);
@@ -283,7 +284,7 @@ DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
283 284
284extern int event_is_open; 285extern int event_is_open;
285 286
286int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data) 287int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
287{ 288{
288 struct acpi_bus_event *event = NULL; 289 struct acpi_bus_event *event = NULL;
289 unsigned long flags = 0; 290 unsigned long flags = 0;
@@ -292,10 +293,6 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
292 if (!device) 293 if (!device)
293 return -EINVAL; 294 return -EINVAL;
294 295
295 if (acpi_bus_generate_genetlink_event(device, type, data))
296 printk(KERN_WARNING PREFIX
297 "Failed to generate an ACPI event via genetlink!\n");
298
299 /* drop event on the floor if no one's listening */ 296 /* drop event on the floor if no one's listening */
300 if (!event_is_open) 297 if (!event_is_open)
301 return 0; 298 return 0;
@@ -318,7 +315,7 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
318 return 0; 315 return 0;
319} 316}
320 317
321EXPORT_SYMBOL(acpi_bus_generate_event); 318EXPORT_SYMBOL(acpi_bus_generate_proc_event);
322 319
323int acpi_bus_receive_event(struct acpi_bus_event *event) 320int acpi_bus_receive_event(struct acpi_bus_event *event)
324{ 321{
@@ -364,6 +361,7 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
364} 361}
365 362
366EXPORT_SYMBOL(acpi_bus_receive_event); 363EXPORT_SYMBOL(acpi_bus_receive_event);
364#endif /* CONFIG_ACPI_PROC_EVENT */
367 365
368/* -------------------------------------------------------------------------- 366/* --------------------------------------------------------------------------
369 Notification Handling 367 Notification Handling
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 540581338ef5..2e79a3395ecf 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -284,7 +284,7 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
284 } 284 }
285 input_sync(input); 285 input_sync(input);
286 286
287 acpi_bus_generate_event(button->device, event, 287 acpi_bus_generate_proc_event(button->device, event,
288 ++button->pushed); 288 ++button->pushed);
289 break; 289 break;
290 default: 290 default:
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 56bee9e065cf..43749c86861f 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -696,14 +696,6 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
696 return AE_CTRL_TERMINATE; 696 return AE_CTRL_TERMINATE;
697} 697}
698 698
699static void ec_remove_handlers(struct acpi_ec *ec)
700{
701 acpi_remove_address_space_handler(ec->handle,
702 ACPI_ADR_SPACE_EC,
703 &acpi_ec_space_handler);
704 acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
705}
706
707static int acpi_ec_add(struct acpi_device *device) 699static int acpi_ec_add(struct acpi_device *device)
708{ 700{
709 struct acpi_ec *ec = NULL; 701 struct acpi_ec *ec = NULL;
@@ -727,13 +719,16 @@ static int acpi_ec_add(struct acpi_device *device)
727 /* Check if we found the boot EC */ 719 /* Check if we found the boot EC */
728 if (boot_ec) { 720 if (boot_ec) {
729 if (boot_ec->gpe == ec->gpe) { 721 if (boot_ec->gpe == ec->gpe) {
730 ec_remove_handlers(boot_ec); 722 /* We might have incorrect info for GL at boot time */
731 mutex_destroy(&boot_ec->lock); 723 mutex_lock(&boot_ec->lock);
732 kfree(boot_ec); 724 boot_ec->global_lock = ec->global_lock;
733 first_ec = boot_ec = NULL; 725 /* Copy handlers from new ec into boot ec */
726 list_splice(&ec->list, &boot_ec->list);
727 mutex_unlock(&boot_ec->lock);
728 kfree(ec);
729 ec = boot_ec;
734 } 730 }
735 } 731 } else
736 if (!first_ec)
737 first_ec = ec; 732 first_ec = ec;
738 ec->handle = device->handle; 733 ec->handle = device->handle;
739 acpi_driver_data(device) = ec; 734 acpi_driver_data(device) = ec;
@@ -762,6 +757,9 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
762 if (ec == first_ec) 757 if (ec == first_ec)
763 first_ec = NULL; 758 first_ec = NULL;
764 759
760 /* Don't touch boot EC */
761 if (boot_ec != ec)
762 kfree(ec);
765 return 0; 763 return 0;
766} 764}
767 765
@@ -825,7 +823,9 @@ static int acpi_ec_start(struct acpi_device *device)
825 if (!ec) 823 if (!ec)
826 return -EINVAL; 824 return -EINVAL;
827 825
828 ret = ec_install_handlers(ec); 826 /* Boot EC is already working */
827 if (ec != boot_ec)
828 ret = ec_install_handlers(ec);
829 829
830 /* EC is fully operational, allow queries */ 830 /* EC is fully operational, allow queries */
831 atomic_set(&ec->query_pending, 0); 831 atomic_set(&ec->query_pending, 0);
@@ -835,6 +835,7 @@ static int acpi_ec_start(struct acpi_device *device)
835 835
836static int acpi_ec_stop(struct acpi_device *device, int type) 836static int acpi_ec_stop(struct acpi_device *device, int type)
837{ 837{
838 acpi_status status;
838 struct acpi_ec *ec; 839 struct acpi_ec *ec;
839 840
840 if (!device) 841 if (!device)
@@ -843,7 +844,21 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
843 ec = acpi_driver_data(device); 844 ec = acpi_driver_data(device);
844 if (!ec) 845 if (!ec)
845 return -EINVAL; 846 return -EINVAL;
846 ec_remove_handlers(ec); 847
848 /* Don't touch boot EC */
849 if (ec == boot_ec)
850 return 0;
851
852 status = acpi_remove_address_space_handler(ec->handle,
853 ACPI_ADR_SPACE_EC,
854 &acpi_ec_space_handler);
855 if (ACPI_FAILURE(status))
856 return -ENODEV;
857
858 status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
859 if (ACPI_FAILURE(status))
860 return -ENODEV;
861
847 return 0; 862 return 0;
848} 863}
849 864
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c
index 95637a4ff782..a2b9304596ce 100644
--- a/drivers/acpi/event.c
+++ b/drivers/acpi/event.c
@@ -17,6 +17,7 @@
17#define _COMPONENT ACPI_SYSTEM_COMPONENT 17#define _COMPONENT ACPI_SYSTEM_COMPONENT
18ACPI_MODULE_NAME("event"); 18ACPI_MODULE_NAME("event");
19 19
20#ifdef CONFIG_ACPI_PROC_EVENT
20/* Global vars for handling event proc entry */ 21/* Global vars for handling event proc entry */
21static DEFINE_SPINLOCK(acpi_system_event_lock); 22static DEFINE_SPINLOCK(acpi_system_event_lock);
22int event_is_open = 0; 23int event_is_open = 0;
@@ -106,6 +107,7 @@ static const struct file_operations acpi_system_event_ops = {
106 .release = acpi_system_close_event, 107 .release = acpi_system_close_event,
107 .poll = acpi_system_poll_event, 108 .poll = acpi_system_poll_event,
108}; 109};
110#endif /* CONFIG_ACPI_PROC_EVENT */
109 111
110#ifdef CONFIG_NET 112#ifdef CONFIG_NET
111static unsigned int acpi_event_seqnum; 113static unsigned int acpi_event_seqnum;
@@ -147,7 +149,8 @@ static struct genl_multicast_group acpi_event_mcgrp = {
147 .name = ACPI_GENL_MCAST_GROUP_NAME, 149 .name = ACPI_GENL_MCAST_GROUP_NAME,
148}; 150};
149 151
150int acpi_bus_generate_genetlink_event(struct acpi_device *device, 152int acpi_bus_generate_netlink_event(const char *device_class,
153 const char *bus_id,
151 u8 type, int data) 154 u8 type, int data)
152{ 155{
153 struct sk_buff *skb; 156 struct sk_buff *skb;
@@ -191,8 +194,8 @@ int acpi_bus_generate_genetlink_event(struct acpi_device *device,
191 194
192 memset(event, 0, sizeof(struct acpi_genl_event)); 195 memset(event, 0, sizeof(struct acpi_genl_event));
193 196
194 strcpy(event->device_class, device->pnp.device_class); 197 strcpy(event->device_class, device_class);
195 strcpy(event->bus_id, device->dev.bus_id); 198 strcpy(event->bus_id, bus_id);
196 event->type = type; 199 event->type = type;
197 event->data = data; 200 event->data = data;
198 201
@@ -211,6 +214,8 @@ int acpi_bus_generate_genetlink_event(struct acpi_device *device,
211 return 0; 214 return 0;
212} 215}
213 216
217EXPORT_SYMBOL(acpi_bus_generate_netlink_event);
218
214static int acpi_event_genetlink_init(void) 219static int acpi_event_genetlink_init(void)
215{ 220{
216 int result; 221 int result;
@@ -228,12 +233,15 @@ static int acpi_event_genetlink_init(void)
228} 233}
229 234
230#else 235#else
231int acpi_bus_generate_genetlink_event(struct acpi_device *device, u8 type, 236int acpi_bus_generate_netlink_event(const char *device_class,
232 int data) 237 const char *bus_id,
238 u8 type, int data)
233{ 239{
234 return 0; 240 return 0;
235} 241}
236 242
243EXPORT_SYMBOL(acpi_generate_netlink_event);
244
237static int acpi_event_genetlink_init(void) 245static int acpi_event_genetlink_init(void)
238{ 246{
239 return -ENODEV; 247 return -ENODEV;
@@ -242,7 +250,9 @@ static int acpi_event_genetlink_init(void)
242 250
243static int __init acpi_event_init(void) 251static int __init acpi_event_init(void)
244{ 252{
253#ifdef CONFIG_ACPI_PROC_EVENT
245 struct proc_dir_entry *entry; 254 struct proc_dir_entry *entry;
255#endif
246 int error = 0; 256 int error = 0;
247 257
248 if (acpi_disabled) 258 if (acpi_disabled)
@@ -254,12 +264,14 @@ static int __init acpi_event_init(void)
254 printk(KERN_WARNING PREFIX 264 printk(KERN_WARNING PREFIX
255 "Failed to create genetlink family for ACPI event\n"); 265 "Failed to create genetlink family for ACPI event\n");
256 266
267#ifdef CONFIG_ACPI_PROC_EVENT
257 /* 'event' [R] */ 268 /* 'event' [R] */
258 entry = create_proc_entry("event", S_IRUSR, acpi_root_dir); 269 entry = create_proc_entry("event", S_IRUSR, acpi_root_dir);
259 if (entry) 270 if (entry)
260 entry->proc_fops = &acpi_system_event_ops; 271 entry->proc_fops = &acpi_system_event_ops;
261 else 272 else
262 return -ENODEV; 273 return -ENODEV;
274#endif
263 275
264 return 0; 276 return 0;
265} 277}
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 76c525dc590b..cf69c0040a39 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -576,13 +576,10 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
576 ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); 576 ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
577 } 577 }
578 578
579 status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL);
580 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
581 ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK"));
582 }
583 /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
584
585 /* 579 /*
580 * GPEs must be enabled before _WAK is called as GPEs
581 * might get fired there
582 *
586 * Restore the GPEs: 583 * Restore the GPEs:
587 * 1) Disable/Clear all GPEs 584 * 1) Disable/Clear all GPEs
588 * 2) Enable all runtime GPEs 585 * 2) Enable all runtime GPEs
@@ -591,13 +588,19 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
591 if (ACPI_FAILURE(status)) { 588 if (ACPI_FAILURE(status)) {
592 return_ACPI_STATUS(status); 589 return_ACPI_STATUS(status);
593 } 590 }
594 acpi_gbl_system_awake_and_running = TRUE;
595
596 status = acpi_hw_enable_all_runtime_gpes(); 591 status = acpi_hw_enable_all_runtime_gpes();
597 if (ACPI_FAILURE(status)) { 592 if (ACPI_FAILURE(status)) {
598 return_ACPI_STATUS(status); 593 return_ACPI_STATUS(status);
599 } 594 }
600 595
596 status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL);
597 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
598 ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK"));
599 }
600 /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
601
602 acpi_gbl_system_awake_and_running = TRUE;
603
601 /* Enable power button */ 604 /* Enable power button */
602 605
603 (void) 606 (void)
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c
index ab65b2c2560e..f39fbc6b9237 100644
--- a/drivers/acpi/namespace/nsxfeval.c
+++ b/drivers/acpi/namespace/nsxfeval.c
@@ -540,7 +540,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
540 ******************************************************************************/ 540 ******************************************************************************/
541 541
542acpi_status 542acpi_status
543acpi_get_devices(char *HID, 543acpi_get_devices(const char *HID,
544 acpi_walk_callback user_function, 544 acpi_walk_callback user_function,
545 void *context, void **return_value) 545 void *context, void **return_value)
546{ 546{
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 498422343f38..e944aaee4e06 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -698,16 +698,23 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
698 switch (event) { 698 switch (event) {
699 case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: 699 case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
700 acpi_processor_ppc_has_changed(pr); 700 acpi_processor_ppc_has_changed(pr);
701 acpi_bus_generate_event(device, event, 701 acpi_bus_generate_proc_event(device, event,
702 pr->performance_platform_limit); 702 pr->performance_platform_limit);
703 acpi_bus_generate_netlink_event(device->pnp.device_class,
704 device->dev.bus_id, event,
705 pr->performance_platform_limit);
703 break; 706 break;
704 case ACPI_PROCESSOR_NOTIFY_POWER: 707 case ACPI_PROCESSOR_NOTIFY_POWER:
705 acpi_processor_cst_has_changed(pr); 708 acpi_processor_cst_has_changed(pr);
706 acpi_bus_generate_event(device, event, 0); 709 acpi_bus_generate_proc_event(device, event, 0);
710 acpi_bus_generate_netlink_event(device->pnp.device_class,
711 device->dev.bus_id, event, 0);
707 break; 712 break;
708 case ACPI_PROCESSOR_NOTIFY_THROTTLING: 713 case ACPI_PROCESSOR_NOTIFY_THROTTLING:
709 acpi_processor_tstate_has_changed(pr); 714 acpi_processor_tstate_has_changed(pr);
710 acpi_bus_generate_event(device, event, 0); 715 acpi_bus_generate_proc_event(device, event, 0);
716 acpi_bus_generate_netlink_event(device->pnp.device_class,
717 device->dev.bus_id, event, 0);
711 default: 718 default:
712 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 719 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
713 "Unsupported event [0x%x]\n", event)); 720 "Unsupported event [0x%x]\n", event));
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 82c3a550016d..a578986e3214 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -440,11 +440,12 @@ static int acpi_sbs_generate_event(struct acpi_device *device,
440 strcpy(acpi_device_bid(device), bid); 440 strcpy(acpi_device_bid(device), bid);
441 strcpy(acpi_device_class(device), class); 441 strcpy(acpi_device_class(device), class);
442 442
443 result = acpi_bus_generate_event(device, event, state); 443 result = acpi_bus_generate_proc_event(device, event, state);
444 444
445 strcpy(acpi_device_bid(device), bid_saved); 445 strcpy(acpi_device_bid(device), bid_saved);
446 strcpy(acpi_device_class(device), class_saved); 446 strcpy(acpi_device_class(device), class_saved);
447 447
448 acpi_bus_generate_netlink_event(class, bid, event, state);
448 return result; 449 return result;
449} 450}
450 451
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index be74347d1354..64620d668742 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -35,8 +35,9 @@ struct acpi_device_bus_id{
35 * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get: 35 * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get:
36 * char *modalias: "acpi:IBM0001:ACPI0001" 36 * char *modalias: "acpi:IBM0001:ACPI0001"
37*/ 37*/
38int create_modalias(struct acpi_device *acpi_dev, char *modalias, int size){ 38static int create_modalias(struct acpi_device *acpi_dev, char *modalias,
39 39 int size)
40{
40 int len; 41 int len;
41 42
42 if (!acpi_dev->flags.hardware_id) 43 if (!acpi_dev->flags.hardware_id)
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index e8cff5dd4cbc..c52ade816fb4 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -305,7 +305,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p)
305 unsigned long d_min, d_max; 305 unsigned long d_min, d_max;
306 306
307 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { 307 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) {
308 printk(KERN_ERR "ACPI handle has no context!\n"); 308 printk(KERN_DEBUG "ACPI handle has no context!\n");
309 return -ENODEV; 309 return -ENODEV;
310 } 310 }
311 311
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 1da64b4518c0..8cc9492ffbf2 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -51,6 +51,65 @@ ACPI_MODULE_NAME("tbutils")
51static acpi_physical_address 51static acpi_physical_address
52acpi_tb_get_root_table_entry(u8 * table_entry, 52acpi_tb_get_root_table_entry(u8 * table_entry,
53 acpi_native_uint table_entry_size); 53 acpi_native_uint table_entry_size);
54/*******************************************************************************
55 *
56 * FUNCTION: acpi_tb_check_xsdt
57 *
58 * PARAMETERS: address - Pointer to the XSDT
59 *
60 * RETURN: status
61 * AE_OK - XSDT is okay
62 * AE_NO_MEMORY - can't map XSDT
63 * AE_INVALID_TABLE_LENGTH - invalid table length
64 * AE_NULL_ENTRY - XSDT has NULL entry
65 *
66 * DESCRIPTION: validate XSDT
67******************************************************************************/
68
69static acpi_status
70acpi_tb_check_xsdt(acpi_physical_address address)
71{
72 struct acpi_table_header *table;
73 u32 length;
74 u64 xsdt_entry_address;
75 u8 *table_entry;
76 u32 table_count;
77 int i;
78
79 table = acpi_os_map_memory(address, sizeof(struct acpi_table_header));
80 if (!table)
81 return AE_NO_MEMORY;
82
83 length = table->length;
84 acpi_os_unmap_memory(table, sizeof(struct acpi_table_header));
85 if (length < sizeof(struct acpi_table_header))
86 return AE_INVALID_TABLE_LENGTH;
87
88 table = acpi_os_map_memory(address, length);
89 if (!table)
90 return AE_NO_MEMORY;
91
92 /* Calculate the number of tables described in XSDT */
93 table_count =
94 (u32) ((table->length -
95 sizeof(struct acpi_table_header)) / sizeof(u64));
96 table_entry =
97 ACPI_CAST_PTR(u8, table) + sizeof(struct acpi_table_header);
98 for (i = 0; i < table_count; i++) {
99 ACPI_MOVE_64_TO_64(&xsdt_entry_address, table_entry);
100 if (!xsdt_entry_address) {
101 /* XSDT has NULL entry */
102 break;
103 }
104 table_entry += sizeof(u64);
105 }
106 acpi_os_unmap_memory(table, length);
107
108 if (i < table_count)
109 return AE_NULL_ENTRY;
110 else
111 return AE_OK;
112}
54 113
55/******************************************************************************* 114/*******************************************************************************
56 * 115 *
@@ -341,6 +400,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
341 u32 table_count; 400 u32 table_count;
342 struct acpi_table_header *table; 401 struct acpi_table_header *table;
343 acpi_physical_address address; 402 acpi_physical_address address;
403 acpi_physical_address rsdt_address;
344 u32 length; 404 u32 length;
345 u8 *table_entry; 405 u8 *table_entry;
346 acpi_status status; 406 acpi_status status;
@@ -369,6 +429,8 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
369 */ 429 */
370 address = (acpi_physical_address) rsdp->xsdt_physical_address; 430 address = (acpi_physical_address) rsdp->xsdt_physical_address;
371 table_entry_size = sizeof(u64); 431 table_entry_size = sizeof(u64);
432 rsdt_address = (acpi_physical_address)
433 rsdp->rsdt_physical_address;
372 } else { 434 } else {
373 /* Root table is an RSDT (32-bit physical addresses) */ 435 /* Root table is an RSDT (32-bit physical addresses) */
374 436
@@ -382,6 +444,15 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
382 */ 444 */
383 acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp)); 445 acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp));
384 446
447 if (table_entry_size == sizeof(u64)) {
448 if (acpi_tb_check_xsdt(address) == AE_NULL_ENTRY) {
449 /* XSDT has NULL entry, RSDT is used */
450 address = rsdt_address;
451 table_entry_size = sizeof(u32);
452 ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry,"
453 "using RSDT"));
454 }
455 }
385 /* Map the RSDT/XSDT table header to get the full table length */ 456 /* Map the RSDT/XSDT table header to get the full table length */
386 457
387 table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); 458 table = acpi_os_map_memory(address, sizeof(struct acpi_table_header));
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 1e06159fd9c4..bc6d5866ef98 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -77,23 +77,27 @@ MODULE_LICENSE("GPL");
77 77
78static int act; 78static int act;
79module_param(act, int, 0644); 79module_param(act, int, 0644);
80MODULE_PARM_DESC(act, "Disable or override all lowest active trip points.\n"); 80MODULE_PARM_DESC(act, "Disable or override all lowest active trip points.");
81
82static int crt;
83module_param(crt, int, 0644);
84MODULE_PARM_DESC(crt, "Disable or lower all critical trip points.");
81 85
82static int tzp; 86static int tzp;
83module_param(tzp, int, 0444); 87module_param(tzp, int, 0444);
84MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n"); 88MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.");
85 89
86static int nocrt; 90static int nocrt;
87module_param(nocrt, int, 0); 91module_param(nocrt, int, 0);
88MODULE_PARM_DESC(nocrt, "Set to disable action on ACPI thermal zone critical and hot trips.\n"); 92MODULE_PARM_DESC(nocrt, "Set to take no action upon ACPI thermal zone critical trips points.");
89 93
90static int off; 94static int off;
91module_param(off, int, 0); 95module_param(off, int, 0);
92MODULE_PARM_DESC(off, "Set to disable ACPI thermal support.\n"); 96MODULE_PARM_DESC(off, "Set to disable ACPI thermal support.");
93 97
94static int psv; 98static int psv;
95module_param(psv, int, 0644); 99module_param(psv, int, 0644);
96MODULE_PARM_DESC(psv, "Disable or override all passive trip points.\n"); 100MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
97 101
98static int acpi_thermal_add(struct acpi_device *device); 102static int acpi_thermal_add(struct acpi_device *device);
99static int acpi_thermal_remove(struct acpi_device *device, int type); 103static int acpi_thermal_remove(struct acpi_device *device, int type);
@@ -340,6 +344,20 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
340 tz->trips.critical.temperature)); 344 tz->trips.critical.temperature));
341 } 345 }
342 346
347 if (tz->trips.critical.flags.valid == 1) {
348 if (crt == -1) {
349 tz->trips.critical.flags.valid = 0;
350 } else if (crt > 0) {
351 unsigned long crt_k = CELSIUS_TO_KELVIN(crt);
352
353 /*
354 * Allow override to lower critical threshold
355 */
356 if (crt_k < tz->trips.critical.temperature)
357 tz->trips.critical.temperature = crt_k;
358 }
359 }
360
343 /* Critical Sleep (optional) */ 361 /* Critical Sleep (optional) */
344 362
345 status = 363 status =
@@ -485,8 +503,12 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
485 printk(KERN_EMERG 503 printk(KERN_EMERG
486 "Critical temperature reached (%ld C), shutting down.\n", 504 "Critical temperature reached (%ld C), shutting down.\n",
487 KELVIN_TO_CELSIUS(tz->temperature)); 505 KELVIN_TO_CELSIUS(tz->temperature));
488 acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, 506 acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL,
489 tz->trips.critical.flags.enabled); 507 tz->trips.critical.flags.enabled);
508 acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
509 tz->device->dev.bus_id,
510 ACPI_THERMAL_NOTIFY_CRITICAL,
511 tz->trips.critical.flags.enabled);
490 512
491 orderly_poweroff(true); 513 orderly_poweroff(true);
492 514
@@ -504,8 +526,12 @@ static int acpi_thermal_hot(struct acpi_thermal *tz)
504 } else if (tz->trips.hot.flags.enabled) 526 } else if (tz->trips.hot.flags.enabled)
505 tz->trips.hot.flags.enabled = 0; 527 tz->trips.hot.flags.enabled = 0;
506 528
507 acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, 529 acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_HOT,
508 tz->trips.hot.flags.enabled); 530 tz->trips.hot.flags.enabled);
531 acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
532 tz->device->dev.bus_id,
533 ACPI_THERMAL_NOTIFY_HOT,
534 tz->trips.hot.flags.enabled);
509 535
510 /* TBD: Call user-mode "sleep(S4)" function */ 536 /* TBD: Call user-mode "sleep(S4)" function */
511 537
@@ -1067,9 +1093,9 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1067 entry->owner = THIS_MODULE; 1093 entry->owner = THIS_MODULE;
1068 } 1094 }
1069 1095
1070 /* 'trip_points' [R/W] */ 1096 /* 'trip_points' [R] */
1071 entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, 1097 entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS,
1072 S_IFREG | S_IRUGO | S_IWUSR, 1098 S_IRUGO,
1073 acpi_device_dir(device)); 1099 acpi_device_dir(device));
1074 if (!entry) 1100 if (!entry)
1075 return -ENODEV; 1101 return -ENODEV;
@@ -1149,12 +1175,16 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
1149 case ACPI_THERMAL_NOTIFY_THRESHOLDS: 1175 case ACPI_THERMAL_NOTIFY_THRESHOLDS:
1150 acpi_thermal_get_trip_points(tz); 1176 acpi_thermal_get_trip_points(tz);
1151 acpi_thermal_check(tz); 1177 acpi_thermal_check(tz);
1152 acpi_bus_generate_event(device, event, 0); 1178 acpi_bus_generate_proc_event(device, event, 0);
1179 acpi_bus_generate_netlink_event(device->pnp.device_class,
1180 device->dev.bus_id, event, 0);
1153 break; 1181 break;
1154 case ACPI_THERMAL_NOTIFY_DEVICES: 1182 case ACPI_THERMAL_NOTIFY_DEVICES:
1155 if (tz->flags.devices) 1183 if (tz->flags.devices)
1156 acpi_thermal_get_devices(tz); 1184 acpi_thermal_get_devices(tz);
1157 acpi_bus_generate_event(device, event, 0); 1185 acpi_bus_generate_proc_event(device, event, 0);
1186 acpi_bus_generate_netlink_event(device->pnp.device_class,
1187 device->dev.bus_id, event, 0);
1158 break; 1188 break;
1159 default: 1189 default:
1160 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 1190 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -1339,6 +1369,13 @@ static int thermal_act(struct dmi_system_id *d) {
1339 } 1369 }
1340 return 0; 1370 return 0;
1341} 1371}
1372static int thermal_nocrt(struct dmi_system_id *d) {
1373
1374 printk(KERN_NOTICE "ACPI: %s detected: "
1375 "disabling all critical thermal trip point actions.\n", d->ident);
1376 nocrt = 1;
1377 return 0;
1378}
1342static int thermal_tzp(struct dmi_system_id *d) { 1379static int thermal_tzp(struct dmi_system_id *d) {
1343 1380
1344 if (tzp == 0) { 1381 if (tzp == 0) {
@@ -1387,6 +1424,14 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = {
1387 DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), 1424 DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
1388 }, 1425 },
1389 }, 1426 },
1427 {
1428 .callback = thermal_nocrt,
1429 .ident = "Gigabyte GA-7ZX",
1430 .matches = {
1431 DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."),
1432 DMI_MATCH(DMI_BOARD_NAME, "7ZX"),
1433 },
1434 },
1390 {} 1435 {}
1391}; 1436};
1392#endif /* CONFIG_DMI */ 1437#endif /* CONFIG_DMI */
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 1621655d6e2b..93ea8290b4f7 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -126,6 +126,7 @@ const char *acpi_format_exception(acpi_status status)
126 "Unknown exception code: 0x%8.8X", status)); 126 "Unknown exception code: 0x%8.8X", status));
127 127
128 exception = "UNKNOWN_STATUS_CODE"; 128 exception = "UNKNOWN_STATUS_CODE";
129 dump_stack();
129 } 130 }
130 131
131 return (ACPI_CAST_PTR(const char, exception)); 132 return (ACPI_CAST_PTR(const char, exception));
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index d98701941981..3c9bb85a6a93 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -31,7 +31,7 @@
31#include <linux/list.h> 31#include <linux/list.h>
32#include <linux/proc_fs.h> 32#include <linux/proc_fs.h>
33#include <linux/seq_file.h> 33#include <linux/seq_file.h>
34 34#include <linux/input.h>
35#include <linux/backlight.h> 35#include <linux/backlight.h>
36#include <linux/video_output.h> 36#include <linux/video_output.h>
37#include <asm/uaccess.h> 37#include <asm/uaccess.h>
@@ -138,6 +138,8 @@ struct acpi_video_bus {
138 struct semaphore sem; 138 struct semaphore sem;
139 struct list_head video_device_list; 139 struct list_head video_device_list;
140 struct proc_dir_entry *dir; 140 struct proc_dir_entry *dir;
141 struct input_dev *input;
142 char phys[32]; /* for input device */
141}; 143};
142 144
143struct acpi_video_device_flags { 145struct acpi_video_device_flags {
@@ -1764,6 +1766,9 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1764{ 1766{
1765 struct acpi_video_bus *video = data; 1767 struct acpi_video_bus *video = data;
1766 struct acpi_device *device = NULL; 1768 struct acpi_device *device = NULL;
1769 struct input_dev *input;
1770 int keycode;
1771
1767 1772
1768 printk("video bus notify\n"); 1773 printk("video bus notify\n");
1769 1774
@@ -1771,11 +1776,13 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1771 return; 1776 return;
1772 1777
1773 device = video->device; 1778 device = video->device;
1779 input = video->input;
1774 1780
1775 switch (event) { 1781 switch (event) {
1776 case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch, 1782 case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch,
1777 * most likely via hotkey. */ 1783 * most likely via hotkey. */
1778 acpi_bus_generate_event(device, event, 0); 1784 acpi_bus_generate_proc_event(device, event, 0);
1785 keycode = KEY_SWITCHVIDEOMODE;
1779 break; 1786 break;
1780 1787
1781 case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video 1788 case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video
@@ -1783,22 +1790,38 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1783 acpi_video_device_enumerate(video); 1790 acpi_video_device_enumerate(video);
1784 acpi_video_device_rebind(video); 1791 acpi_video_device_rebind(video);
1785 acpi_video_switch_output(video, event); 1792 acpi_video_switch_output(video, event);
1786 acpi_bus_generate_event(device, event, 0); 1793 acpi_bus_generate_proc_event(device, event, 0);
1794 keycode = KEY_SWITCHVIDEOMODE;
1787 break; 1795 break;
1788 1796
1789 case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */ 1797 case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */
1798 acpi_video_switch_output(video, event);
1799 acpi_bus_generate_proc_event(device, event, 0);
1800 keycode = KEY_SWITCHVIDEOMODE;
1801 break;
1790 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */ 1802 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */
1803 acpi_video_switch_output(video, event);
1804 acpi_bus_generate_proc_event(device, event, 0);
1805 keycode = KEY_VIDEO_NEXT;
1806 break;
1791 case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */ 1807 case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */
1792 acpi_video_switch_output(video, event); 1808 acpi_video_switch_output(video, event);
1793 acpi_bus_generate_event(device, event, 0); 1809 acpi_bus_generate_proc_event(device, event, 0);
1810 keycode = KEY_VIDEO_PREV;
1794 break; 1811 break;
1795 1812
1796 default: 1813 default:
1814 keycode = KEY_UNKNOWN;
1797 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 1815 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
1798 "Unsupported event [0x%x]\n", event)); 1816 "Unsupported event [0x%x]\n", event));
1799 break; 1817 break;
1800 } 1818 }
1801 1819
1820 input_report_key(input, keycode, 1);
1821 input_sync(input);
1822 input_report_key(input, keycode, 0);
1823 input_sync(input);
1824
1802 return; 1825 return;
1803} 1826}
1804 1827
@@ -1806,38 +1829,65 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
1806{ 1829{
1807 struct acpi_video_device *video_device = data; 1830 struct acpi_video_device *video_device = data;
1808 struct acpi_device *device = NULL; 1831 struct acpi_device *device = NULL;
1832 struct acpi_video_bus *bus;
1833 struct input_dev *input;
1834 int keycode;
1809 1835
1810 if (!video_device) 1836 if (!video_device)
1811 return; 1837 return;
1812 1838
1813 device = video_device->dev; 1839 device = video_device->dev;
1840 bus = video_device->video;
1841 input = bus->input;
1814 1842
1815 switch (event) { 1843 switch (event) {
1816 case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */
1817 case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */
1818 acpi_bus_generate_event(device, event, 0);
1819 break;
1820 case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ 1844 case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */
1845 acpi_video_switch_brightness(video_device, event);
1846 acpi_bus_generate_proc_event(device, event, 0);
1847 keycode = KEY_BRIGHTNESS_CYCLE;
1848 break;
1821 case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */ 1849 case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */
1850 acpi_video_switch_brightness(video_device, event);
1851 acpi_bus_generate_proc_event(device, event, 0);
1852 keycode = KEY_BRIGHTNESSUP;
1853 break;
1822 case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */ 1854 case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */
1855 acpi_video_switch_brightness(video_device, event);
1856 acpi_bus_generate_proc_event(device, event, 0);
1857 keycode = KEY_BRIGHTNESSDOWN;
1858 break;
1823 case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */ 1859 case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */
1860 acpi_video_switch_brightness(video_device, event);
1861 acpi_bus_generate_proc_event(device, event, 0);
1862 keycode = KEY_BRIGHTNESS_ZERO;
1863 break;
1824 case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */ 1864 case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */
1825 acpi_video_switch_brightness(video_device, event); 1865 acpi_video_switch_brightness(video_device, event);
1826 acpi_bus_generate_event(device, event, 0); 1866 acpi_bus_generate_proc_event(device, event, 0);
1867 keycode = KEY_DISPLAY_OFF;
1827 break; 1868 break;
1828 default: 1869 default:
1870 keycode = KEY_UNKNOWN;
1829 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 1871 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
1830 "Unsupported event [0x%x]\n", event)); 1872 "Unsupported event [0x%x]\n", event));
1831 break; 1873 break;
1832 } 1874 }
1875
1876 input_report_key(input, keycode, 1);
1877 input_sync(input);
1878 input_report_key(input, keycode, 0);
1879 input_sync(input);
1880
1833 return; 1881 return;
1834} 1882}
1835 1883
1884static int instance;
1836static int acpi_video_bus_add(struct acpi_device *device) 1885static int acpi_video_bus_add(struct acpi_device *device)
1837{ 1886{
1838 int result = 0; 1887 int result = 0;
1839 acpi_status status = 0; 1888 acpi_status status = 0;
1840 struct acpi_video_bus *video = NULL; 1889 struct acpi_video_bus *video = NULL;
1890 struct input_dev *input;
1841 1891
1842 1892
1843 if (!device) 1893 if (!device)
@@ -1847,6 +1897,13 @@ static int acpi_video_bus_add(struct acpi_device *device)
1847 if (!video) 1897 if (!video)
1848 return -ENOMEM; 1898 return -ENOMEM;
1849 1899
1900 /* a hack to fix the duplicate name "VID" problem on T61 */
1901 if (!strcmp(device->pnp.bus_id, "VID")) {
1902 if (instance)
1903 device->pnp.bus_id[3] = '0' + instance;
1904 instance ++;
1905 }
1906
1850 video->device = device; 1907 video->device = device;
1851 strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME); 1908 strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
1852 strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); 1909 strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
@@ -1881,6 +1938,39 @@ static int acpi_video_bus_add(struct acpi_device *device)
1881 goto end; 1938 goto end;
1882 } 1939 }
1883 1940
1941
1942 video->input = input = input_allocate_device();
1943
1944 snprintf(video->phys, sizeof(video->phys),
1945 "%s/video/input0", acpi_device_hid(video->device));
1946
1947 input->name = acpi_device_name(video->device);
1948 input->phys = video->phys;
1949 input->id.bustype = BUS_HOST;
1950 input->id.product = 0x06;
1951 input->evbit[0] = BIT(EV_KEY);
1952 set_bit(KEY_SWITCHVIDEOMODE, input->keybit);
1953 set_bit(KEY_VIDEO_NEXT, input->keybit);
1954 set_bit(KEY_VIDEO_PREV, input->keybit);
1955 set_bit(KEY_BRIGHTNESS_CYCLE, input->keybit);
1956 set_bit(KEY_BRIGHTNESSUP, input->keybit);
1957 set_bit(KEY_BRIGHTNESSDOWN, input->keybit);
1958 set_bit(KEY_BRIGHTNESS_ZERO, input->keybit);
1959 set_bit(KEY_DISPLAY_OFF, input->keybit);
1960 set_bit(KEY_UNKNOWN, input->keybit);
1961 result = input_register_device(input);
1962 if (result) {
1963 acpi_remove_notify_handler(video->device->handle,
1964 ACPI_DEVICE_NOTIFY,
1965 acpi_video_bus_notify);
1966 acpi_video_bus_stop_devices(video);
1967 acpi_video_bus_put_devices(video);
1968 kfree(video->attached_array);
1969 acpi_video_bus_remove_fs(device);
1970 goto end;
1971 }
1972
1973
1884 printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", 1974 printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n",
1885 ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), 1975 ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
1886 video->flags.multihead ? "yes" : "no", 1976 video->flags.multihead ? "yes" : "no",
@@ -1914,6 +2004,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
1914 acpi_video_bus_put_devices(video); 2004 acpi_video_bus_put_devices(video);
1915 acpi_video_bus_remove_fs(device); 2005 acpi_video_bus_remove_fs(device);
1916 2006
2007 input_unregister_device(video->input);
1917 kfree(video->attached_array); 2008 kfree(video->attached_array);
1918 kfree(video); 2009 kfree(video);
1919 2010
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index aeec67e27264..859858561ab6 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -875,7 +875,7 @@ found:
875 875
876#ifdef CONFIG_ACPI 876#ifdef CONFIG_ACPI
877 if (sonypi_acpi_device) 877 if (sonypi_acpi_device)
878 acpi_bus_generate_event(sonypi_acpi_device, 1, event); 878 acpi_bus_generate_proc_event(sonypi_acpi_device, 1, event);
879#endif 879#endif
880 880
881 kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event)); 881 kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event));
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index d0fc4fd212e6..7dce318df1bd 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -732,7 +732,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
732 lcd_blank(FB_BLANK_POWERDOWN); 732 lcd_blank(FB_BLANK_POWERDOWN);
733 } 733 }
734 734
735 acpi_bus_generate_event(hotk->device, event, 735 acpi_bus_generate_proc_event(hotk->device, event,
736 hotk->event_count[event % 128]++); 736 hotk->event_count[event % 128]++);
737 737
738 return; 738 return;
@@ -1072,7 +1072,8 @@ static void asus_backlight_exit(void)
1072} 1072}
1073 1073
1074#define ASUS_LED_UNREGISTER(object) \ 1074#define ASUS_LED_UNREGISTER(object) \
1075 led_classdev_unregister(&object##_led) 1075 if (object##_led.dev) \
1076 led_classdev_unregister(&object##_led)
1076 1077
1077static void asus_led_exit(void) 1078static void asus_led_exit(void)
1078{ 1079{
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 91da6880ae93..d38ddce592c0 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -856,6 +856,15 @@ static struct dmi_system_id sony_nc_ids[] = {
856 }, 856 },
857 }, 857 },
858 { 858 {
859 .ident = "Sony Vaio FZ Series",
860 .callback = sony_nc_C_enable,
861 .driver_data = sony_C_events,
862 .matches = {
863 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
864 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ"),
865 },
866 },
867 {
859 .ident = "Sony Vaio C Series", 868 .ident = "Sony Vaio C Series",
860 .callback = sony_nc_C_enable, 869 .callback = sony_nc_C_enable,
861 .driver_data = sony_C_events, 870 .driver_data = sony_C_events,
@@ -904,7 +913,7 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)
904 913
905 dprintk("sony_acpi_notify, event: 0x%.2x\n", ev); 914 dprintk("sony_acpi_notify, event: 0x%.2x\n", ev);
906 sony_laptop_report_input_event(ev); 915 sony_laptop_report_input_event(ev);
907 acpi_bus_generate_event(sony_nc_acpi_device, 1, ev); 916 acpi_bus_generate_proc_event(sony_nc_acpi_device, 1, ev);
908} 917}
909 918
910static acpi_status sony_walk_callback(acpi_handle handle, u32 level, 919static acpi_status sony_walk_callback(acpi_handle handle, u32 level,
@@ -2292,7 +2301,7 @@ static irqreturn_t sony_pic_irq(int irq, void *dev_id)
2292 2301
2293found: 2302found:
2294 sony_laptop_report_input_event(device_event); 2303 sony_laptop_report_input_event(device_event);
2295 acpi_bus_generate_event(spic_dev.acpi_dev, 1, device_event); 2304 acpi_bus_generate_proc_event(spic_dev.acpi_dev, 1, device_event);
2296 sonypi_compat_report_event(device_event); 2305 sonypi_compat_report_event(device_event);
2297 2306
2298 return IRQ_HANDLED; 2307 return IRQ_HANDLED;
@@ -2308,8 +2317,6 @@ static int sony_pic_remove(struct acpi_device *device, int type)
2308 struct sony_pic_ioport *io, *tmp_io; 2317 struct sony_pic_ioport *io, *tmp_io;
2309 struct sony_pic_irq *irq, *tmp_irq; 2318 struct sony_pic_irq *irq, *tmp_irq;
2310 2319
2311 sonypi_compat_exit();
2312
2313 if (sony_pic_disable(device)) { 2320 if (sony_pic_disable(device)) {
2314 printk(KERN_ERR DRV_PFX "Couldn't disable device.\n"); 2321 printk(KERN_ERR DRV_PFX "Couldn't disable device.\n");
2315 return -ENXIO; 2322 return -ENXIO;
@@ -2319,6 +2326,8 @@ static int sony_pic_remove(struct acpi_device *device, int type)
2319 release_region(spic_dev.cur_ioport->io.minimum, 2326 release_region(spic_dev.cur_ioport->io.minimum,
2320 spic_dev.cur_ioport->io.address_length); 2327 spic_dev.cur_ioport->io.address_length);
2321 2328
2329 sonypi_compat_exit();
2330
2322 sony_laptop_remove_input(); 2331 sony_laptop_remove_input();
2323 2332
2324 /* pf attrs */ 2333 /* pf attrs */
@@ -2384,6 +2393,9 @@ static int sony_pic_add(struct acpi_device *device)
2384 goto err_free_resources; 2393 goto err_free_resources;
2385 } 2394 }
2386 2395
2396 if (sonypi_compat_init())
2397 goto err_remove_input;
2398
2387 /* request io port */ 2399 /* request io port */
2388 list_for_each_entry(io, &spic_dev.ioports, list) { 2400 list_for_each_entry(io, &spic_dev.ioports, list) {
2389 if (request_region(io->io.minimum, io->io.address_length, 2401 if (request_region(io->io.minimum, io->io.address_length,
@@ -2398,7 +2410,7 @@ static int sony_pic_add(struct acpi_device *device)
2398 if (!spic_dev.cur_ioport) { 2410 if (!spic_dev.cur_ioport) {
2399 printk(KERN_ERR DRV_PFX "Failed to request_region.\n"); 2411 printk(KERN_ERR DRV_PFX "Failed to request_region.\n");
2400 result = -ENODEV; 2412 result = -ENODEV;
2401 goto err_remove_input; 2413 goto err_remove_compat;
2402 } 2414 }
2403 2415
2404 /* request IRQ */ 2416 /* request IRQ */
@@ -2438,9 +2450,6 @@ static int sony_pic_add(struct acpi_device *device)
2438 if (result) 2450 if (result)
2439 goto err_remove_pf; 2451 goto err_remove_pf;
2440 2452
2441 if (sonypi_compat_init())
2442 goto err_remove_pf;
2443
2444 return 0; 2453 return 0;
2445 2454
2446err_remove_pf: 2455err_remove_pf:
@@ -2456,6 +2465,9 @@ err_release_region:
2456 release_region(spic_dev.cur_ioport->io.minimum, 2465 release_region(spic_dev.cur_ioport->io.minimum,
2457 spic_dev.cur_ioport->io.address_length); 2466 spic_dev.cur_ioport->io.address_length);
2458 2467
2468err_remove_compat:
2469 sonypi_compat_exit();
2470
2459err_remove_input: 2471err_remove_input:
2460 sony_laptop_remove_input(); 2472 sony_laptop_remove_input();
2461 2473
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index f6cd34a3dbac..bb8956d0c104 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -1190,10 +1190,10 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1190 } 1190 }
1191 1191
1192 if (sendacpi) 1192 if (sendacpi)
1193 acpi_bus_generate_event(ibm->acpi->device, event, hkey); 1193 acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey);
1194 } else { 1194 } else {
1195 printk(IBM_ERR "unknown hotkey notification event %d\n", event); 1195 printk(IBM_ERR "unknown hotkey notification event %d\n", event);
1196 acpi_bus_generate_event(ibm->acpi->device, event, 0); 1196 acpi_bus_generate_proc_event(ibm->acpi->device, event, 0);
1197 } 1197 }
1198} 1198}
1199 1199
@@ -2162,22 +2162,27 @@ static void dock_notify(struct ibm_struct *ibm, u32 event)
2162 int docked = dock_docked(); 2162 int docked = dock_docked();
2163 int pci = ibm->acpi->hid && ibm->acpi->device && 2163 int pci = ibm->acpi->hid && ibm->acpi->device &&
2164 acpi_match_device_ids(ibm->acpi->device, ibm_pci_device_ids); 2164 acpi_match_device_ids(ibm->acpi->device, ibm_pci_device_ids);
2165 int data;
2165 2166
2166 if (event == 1 && !pci) /* 570 */ 2167 if (event == 1 && !pci) /* 570 */
2167 acpi_bus_generate_event(ibm->acpi->device, event, 1); /* button */ 2168 data = 1; /* button */
2168 else if (event == 1 && pci) /* 570 */ 2169 else if (event == 1 && pci) /* 570 */
2169 acpi_bus_generate_event(ibm->acpi->device, event, 3); /* dock */ 2170 data = 3; /* dock */
2170 else if (event == 3 && docked) 2171 else if (event == 3 && docked)
2171 acpi_bus_generate_event(ibm->acpi->device, event, 1); /* button */ 2172 data = 1; /* button */
2172 else if (event == 3 && !docked) 2173 else if (event == 3 && !docked)
2173 acpi_bus_generate_event(ibm->acpi->device, event, 2); /* undock */ 2174 data = 2; /* undock */
2174 else if (event == 0 && docked) 2175 else if (event == 0 && docked)
2175 acpi_bus_generate_event(ibm->acpi->device, event, 3); /* dock */ 2176 data = 3; /* dock */
2176 else { 2177 else {
2177 printk(IBM_ERR "unknown dock event %d, status %d\n", 2178 printk(IBM_ERR "unknown dock event %d, status %d\n",
2178 event, _sta(dock_handle)); 2179 event, _sta(dock_handle));
2179 acpi_bus_generate_event(ibm->acpi->device, event, 0); /* unknown */ 2180 data = 0; /* unknown */
2180 } 2181 }
2182 acpi_bus_generate_proc_event(ibm->acpi->device, event, data);
2183 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
2184 ibm->acpi->device->dev.bus_id,
2185 event, data);
2181} 2186}
2182 2187
2183static int dock_read(char *p) 2188static int dock_read(char *p)
@@ -2275,7 +2280,10 @@ static int __init bay_init(struct ibm_init_struct *iibm)
2275 2280
2276static void bay_notify(struct ibm_struct *ibm, u32 event) 2281static void bay_notify(struct ibm_struct *ibm, u32 event)
2277{ 2282{
2278 acpi_bus_generate_event(ibm->acpi->device, event, 0); 2283 acpi_bus_generate_proc_event(ibm->acpi->device, event, 0);
2284 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
2285 ibm->acpi->device->dev.bus_id,
2286 event, 0);
2279} 2287}
2280 2288
2281#define bay_occupied(b) (_sta(b##_handle) & 1) 2289#define bay_occupied(b) (_sta(b##_handle) & 1)
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index 70db38c0ced9..56829f82be4a 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -267,7 +267,10 @@ static void ibm_handle_events(acpi_handle handle, u32 event, void *context)
267 267
268 if (subevent == 0x80) { 268 if (subevent == 0x80) {
269 dbg("%s: generationg bus event\n", __FUNCTION__); 269 dbg("%s: generationg bus event\n", __FUNCTION__);
270 acpi_bus_generate_event(note->device, note->event, detail); 270 acpi_bus_generate_proc_event(note->device, note->event, detail);
271 acpi_bus_generate_netlink_event(note->device->pnp.device_class,
272 note->device->dev.bus_id,
273 note->event, detail);
271 } else 274 } else
272 note->event = event; 275 note->event = event;
273} 276}
@@ -399,7 +402,7 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
399 402
400 status = acpi_get_object_info(handle, &info_buffer); 403 status = acpi_get_object_info(handle, &info_buffer);
401 if (ACPI_FAILURE(status)) { 404 if (ACPI_FAILURE(status)) {
402 err("%s: Failed to get device information", __FUNCTION__); 405 err("%s: Failed to get device information\n", __FUNCTION__);
403 return 0; 406 return 0;
404 } 407 }
405 info.hardware_id.value[sizeof(info.hardware_id.value) - 1] = '\0'; 408 info.hardware_id.value[sizeof(info.hardware_id.value) - 1] = '\0';
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index b6a4f02b01d1..6c0440c20e31 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -25,13 +25,13 @@ static const struct pnp_card_device_id *match_card(struct pnp_card_driver *drv,
25 int found; 25 int found;
26 struct pnp_dev *dev; 26 struct pnp_dev *dev;
27 27
28 if (i == PNP_MAX_DEVICES 28 if (i == PNP_MAX_DEVICES ||
29 || !*drv_id->devs[i].id) 29 !*drv_id->devs[i].id)
30 return drv_id; 30 return drv_id;
31 found = 0; 31 found = 0;
32 card_for_each_dev(card, dev) { 32 card_for_each_dev(card, dev) {
33 if (compare_pnp_id 33 if (compare_pnp_id(dev->id,
34 (dev->id, drv_id->devs[i].id)) { 34 drv_id->devs[i].id)) {
35 found = 1; 35 found = 1;
36 break; 36 break;
37 } 37 }
@@ -183,7 +183,7 @@ static int pnp_interface_attach_card(struct pnp_card *card)
183 183
184 return 0; 184 return 0;
185 185
186 err_name: 186err_name:
187 device_remove_file(&card->dev, &dev_attr_name); 187 device_remove_file(&card->dev, &dev_attr_name);
188 return rc; 188 return rc;
189} 189}
@@ -321,10 +321,10 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
321 pos = pos->next; 321 pos = pos->next;
322 } 322 }
323 323
324 done: 324done:
325 return NULL; 325 return NULL;
326 326
327 found: 327found:
328 dev->card_link = clink; 328 dev->card_link = clink;
329 dev->dev.driver = &drv->link.driver; 329 dev->dev.driver = &drv->link.driver;
330 if (pnp_bus_type.probe(&dev->dev)) 330 if (pnp_bus_type.probe(&dev->dev))
@@ -334,7 +334,7 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
334 334
335 return dev; 335 return dev;
336 336
337 err_out: 337err_out:
338 dev->dev.driver = NULL; 338 dev->dev.driver = NULL;
339 dev->card_link = NULL; 339 dev->card_link = NULL;
340 return NULL; 340 return NULL;
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index 61066fdb9e6d..d5964feb14de 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -52,9 +52,6 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
52 int nodenum; 52 int nodenum;
53 struct list_head *pos; 53 struct list_head *pos;
54 54
55 if (!protocol)
56 return -EINVAL;
57
58 INIT_LIST_HEAD(&protocol->devices); 55 INIT_LIST_HEAD(&protocol->devices);
59 INIT_LIST_HEAD(&protocol->cards); 56 INIT_LIST_HEAD(&protocol->cards);
60 nodenum = 0; 57 nodenum = 0;
@@ -94,8 +91,6 @@ static void pnp_free_ids(struct pnp_dev *dev)
94 struct pnp_id *id; 91 struct pnp_id *id;
95 struct pnp_id *next; 92 struct pnp_id *next;
96 93
97 if (!dev)
98 return;
99 id = dev->id; 94 id = dev->id;
100 while (id) { 95 while (id) {
101 next = id->next; 96 next = id->next;
@@ -143,7 +138,7 @@ int __pnp_add_device(struct pnp_dev *dev)
143 */ 138 */
144int pnp_add_device(struct pnp_dev *dev) 139int pnp_add_device(struct pnp_dev *dev)
145{ 140{
146 if (!dev || !dev->protocol || dev->card) 141 if (dev->card)
147 return -EINVAL; 142 return -EINVAL;
148 dev->dev.parent = &dev->protocol->dev; 143 dev->dev.parent = &dev->protocol->dev;
149 sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, 144 sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number,
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 30b8f6f3258a..2fa64a6b25c8 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -118,7 +118,7 @@ static int pnp_device_probe(struct device *dev)
118 goto fail; 118 goto fail;
119 return error; 119 return error;
120 120
121 fail: 121fail:
122 pnp_device_detach(pnp_dev); 122 pnp_device_detach(pnp_dev);
123 return error; 123 return error;
124} 124}
@@ -232,10 +232,6 @@ int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev)
232{ 232{
233 struct pnp_id *ptr; 233 struct pnp_id *ptr;
234 234
235 if (!id)
236 return -EINVAL;
237 if (!dev)
238 return -EINVAL;
239 id->next = NULL; 235 id->next = NULL;
240 ptr = dev->id; 236 ptr = dev->id;
241 while (ptr && ptr->next) 237 while (ptr && ptr->next)
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index fe6684e13e82..a0cfb75bbb8d 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -459,7 +459,8 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
459 up(&pnp_res_mutex); 459 up(&pnp_res_mutex);
460 goto done; 460 goto done;
461 } 461 }
462 done: 462
463done:
463 if (retval < 0) 464 if (retval < 0)
464 return retval; 465 return retval;
465 return count; 466 return count;
@@ -499,10 +500,10 @@ int pnp_interface_attach_device(struct pnp_dev *dev)
499 500
500 return 0; 501 return 0;
501 502
502 err_res: 503err_res:
503 device_remove_file(&dev->dev, &dev_attr_resources); 504 device_remove_file(&dev->dev, &dev_attr_resources);
504 err_opt: 505err_opt:
505 device_remove_file(&dev->dev, &dev_attr_options); 506 device_remove_file(&dev->dev, &dev_attr_options);
506 err: 507err:
507 return rc; 508 return rc;
508} 509}
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index b4e2aa995b53..b035d60a1dcc 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -47,9 +47,6 @@
47#if 0 47#if 0
48#define ISAPNP_REGION_OK 48#define ISAPNP_REGION_OK
49#endif 49#endif
50#if 0
51#define ISAPNP_DEBUG
52#endif
53 50
54int isapnp_disable; /* Disable ISA PnP */ 51int isapnp_disable; /* Disable ISA PnP */
55static int isapnp_rdp; /* Read Data Port */ 52static int isapnp_rdp; /* Read Data Port */
@@ -93,7 +90,6 @@ MODULE_LICENSE("GPL");
93 90
94static unsigned char isapnp_checksum_value; 91static unsigned char isapnp_checksum_value;
95static DEFINE_MUTEX(isapnp_cfg_mutex); 92static DEFINE_MUTEX(isapnp_cfg_mutex);
96static int isapnp_detected;
97static int isapnp_csn_count; 93static int isapnp_csn_count;
98 94
99/* some prototypes */ 95/* some prototypes */
@@ -335,7 +331,7 @@ static int __init isapnp_isolate(void)
335 } else if (iteration > 1) { 331 } else if (iteration > 1) {
336 break; 332 break;
337 } 333 }
338 __next: 334__next:
339 if (csn == 255) 335 if (csn == 255)
340 break; 336 break;
341 checksum = 0x6a; 337 checksum = 0x6a;
@@ -733,7 +729,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
733 "isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n", 729 "isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n",
734 type, dev->number, card->number); 730 type, dev->number, card->number);
735 } 731 }
736 __skip: 732__skip:
737 if (size > 0) 733 if (size > 0)
738 isapnp_skip_bytes(size); 734 isapnp_skip_bytes(size);
739 } 735 }
@@ -788,7 +784,7 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card)
788 "isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n", 784 "isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n",
789 type, card->number); 785 type, card->number);
790 } 786 }
791 __skip: 787__skip:
792 if (size > 0) 788 if (size > 0)
793 isapnp_skip_bytes(size); 789 isapnp_skip_bytes(size);
794 } 790 }
@@ -940,9 +936,6 @@ EXPORT_SYMBOL(isapnp_protocol);
940EXPORT_SYMBOL(isapnp_present); 936EXPORT_SYMBOL(isapnp_present);
941EXPORT_SYMBOL(isapnp_cfg_begin); 937EXPORT_SYMBOL(isapnp_cfg_begin);
942EXPORT_SYMBOL(isapnp_cfg_end); 938EXPORT_SYMBOL(isapnp_cfg_end);
943#if 0
944EXPORT_SYMBOL(isapnp_read_byte);
945#endif
946EXPORT_SYMBOL(isapnp_write_byte); 939EXPORT_SYMBOL(isapnp_write_byte);
947 940
948static int isapnp_read_resources(struct pnp_dev *dev, 941static int isapnp_read_resources(struct pnp_dev *dev,
@@ -993,6 +986,7 @@ static int isapnp_get_resources(struct pnp_dev *dev,
993 struct pnp_resource_table *res) 986 struct pnp_resource_table *res)
994{ 987{
995 int ret; 988 int ret;
989
996 pnp_init_resource_table(res); 990 pnp_init_resource_table(res);
997 isapnp_cfg_begin(dev->card->number, dev->number); 991 isapnp_cfg_begin(dev->card->number, dev->number);
998 ret = isapnp_read_resources(dev, res); 992 ret = isapnp_read_resources(dev, res);
@@ -1046,7 +1040,7 @@ static int isapnp_set_resources(struct pnp_dev *dev,
1046 1040
1047static int isapnp_disable_resources(struct pnp_dev *dev) 1041static int isapnp_disable_resources(struct pnp_dev *dev)
1048{ 1042{
1049 if (!dev || !dev->active) 1043 if (!dev->active)
1050 return -EINVAL; 1044 return -EINVAL;
1051 isapnp_cfg_begin(dev->card->number, dev->number); 1045 isapnp_cfg_begin(dev->card->number, dev->number);
1052 isapnp_deactivate(dev->number); 1046 isapnp_deactivate(dev->number);
@@ -1069,7 +1063,6 @@ static int __init isapnp_init(void)
1069 struct pnp_dev *dev; 1063 struct pnp_dev *dev;
1070 1064
1071 if (isapnp_disable) { 1065 if (isapnp_disable) {
1072 isapnp_detected = 0;
1073 printk(KERN_INFO "isapnp: ISA Plug & Play support disabled\n"); 1066 printk(KERN_INFO "isapnp: ISA Plug & Play support disabled\n");
1074 return 0; 1067 return 0;
1075 } 1068 }
@@ -1117,7 +1110,6 @@ static int __init isapnp_init(void)
1117 } 1110 }
1118 isapnp_set_rdp(); 1111 isapnp_set_rdp();
1119 } 1112 }
1120 isapnp_detected = 1;
1121 if (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff) { 1113 if (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff) {
1122 cards = isapnp_isolate(); 1114 cards = isapnp_isolate();
1123 if (cards < 0 || (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff)) { 1115 if (cards < 0 || (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff)) {
@@ -1125,7 +1117,6 @@ static int __init isapnp_init(void)
1125 release_region(_PIDXR, 1); 1117 release_region(_PIDXR, 1);
1126#endif 1118#endif
1127 release_region(_PNPWRP, 1); 1119 release_region(_PNPWRP, 1);
1128 isapnp_detected = 0;
1129 printk(KERN_INFO 1120 printk(KERN_INFO
1130 "isapnp: No Plug & Play device found\n"); 1121 "isapnp: No Plug & Play device found\n");
1131 return 0; 1122 return 0;
@@ -1148,13 +1139,12 @@ static int __init isapnp_init(void)
1148 } 1139 }
1149 } 1140 }
1150 } 1141 }
1151 if (cards) { 1142 if (cards)
1152 printk(KERN_INFO 1143 printk(KERN_INFO
1153 "isapnp: %i Plug & Play card%s detected total\n", cards, 1144 "isapnp: %i Plug & Play card%s detected total\n", cards,
1154 cards > 1 ? "s" : ""); 1145 cards > 1 ? "s" : "");
1155 } else { 1146 else
1156 printk(KERN_INFO "isapnp: No Plug & Play card found\n"); 1147 printk(KERN_INFO "isapnp: No Plug & Play card found\n");
1157 }
1158 1148
1159 isapnp_proc_init(); 1149 isapnp_proc_init();
1160 return 0; 1150 return 0;
diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c
index 3fbc0f9ffc26..560ccb640816 100644
--- a/drivers/pnp/isapnp/proc.c
+++ b/drivers/pnp/isapnp/proc.c
@@ -112,33 +112,6 @@ static int isapnp_proc_attach_device(struct pnp_dev *dev)
112 return 0; 112 return 0;
113} 113}
114 114
115#ifdef MODULE
116static int __exit isapnp_proc_detach_device(struct pnp_dev *dev)
117{
118 struct pnp_card *bus = dev->card;
119 struct proc_dir_entry *de;
120 char name[16];
121
122 if (!(de = bus->procdir))
123 return -EINVAL;
124 sprintf(name, "%02x", dev->number);
125 remove_proc_entry(name, de);
126 return 0;
127}
128
129static int __exit isapnp_proc_detach_bus(struct pnp_card *bus)
130{
131 struct proc_dir_entry *de;
132 char name[16];
133
134 if (!(de = bus->procdir))
135 return -EINVAL;
136 sprintf(name, "%02x", bus->number);
137 remove_proc_entry(name, isapnp_proc_bus_dir);
138 return 0;
139}
140#endif /* MODULE */
141
142int __init isapnp_proc_init(void) 115int __init isapnp_proc_init(void)
143{ 116{
144 struct pnp_dev *dev; 117 struct pnp_dev *dev;
@@ -149,21 +122,3 @@ int __init isapnp_proc_init(void)
149 } 122 }
150 return 0; 123 return 0;
151} 124}
152
153#ifdef MODULE
154int __exit isapnp_proc_done(void)
155{
156 struct pnp_dev *dev;
157 struct pnp_bus *card;
158
159 isapnp_for_each_dev(dev) {
160 isapnp_proc_detach_device(dev);
161 }
162 isapnp_for_each_card(card) {
163 isapnp_proc_detach_bus(card);
164 }
165 if (isapnp_proc_bus_dir)
166 remove_proc_entry("isapnp", proc_bus);
167 return 0;
168}
169#endif /* MODULE */
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index 3bda513a6bd3..0826287eef53 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -21,9 +21,6 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
21 resource_size_t *start, *end; 21 resource_size_t *start, *end;
22 unsigned long *flags; 22 unsigned long *flags;
23 23
24 if (!dev || !rule)
25 return -EINVAL;
26
27 if (idx >= PNP_MAX_PORT) { 24 if (idx >= PNP_MAX_PORT) {
28 pnp_err 25 pnp_err
29 ("More than 4 ports is incompatible with pnp specifications."); 26 ("More than 4 ports is incompatible with pnp specifications.");
@@ -66,9 +63,6 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
66 resource_size_t *start, *end; 63 resource_size_t *start, *end;
67 unsigned long *flags; 64 unsigned long *flags;
68 65
69 if (!dev || !rule)
70 return -EINVAL;
71
72 if (idx >= PNP_MAX_MEM) { 66 if (idx >= PNP_MAX_MEM) {
73 pnp_err 67 pnp_err
74 ("More than 8 mems is incompatible with pnp specifications."); 68 ("More than 8 mems is incompatible with pnp specifications.");
@@ -127,9 +121,6 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
127 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2 121 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2
128 }; 122 };
129 123
130 if (!dev || !rule)
131 return -EINVAL;
132
133 if (idx >= PNP_MAX_IRQ) { 124 if (idx >= PNP_MAX_IRQ) {
134 pnp_err 125 pnp_err
135 ("More than 2 irqs is incompatible with pnp specifications."); 126 ("More than 2 irqs is incompatible with pnp specifications.");
@@ -181,9 +172,6 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
181 1, 3, 5, 6, 7, 0, 2, 4 172 1, 3, 5, 6, 7, 0, 2, 4
182 }; 173 };
183 174
184 if (!dev || !rule)
185 return -EINVAL;
186
187 if (idx >= PNP_MAX_DMA) { 175 if (idx >= PNP_MAX_DMA) {
188 pnp_err 176 pnp_err
189 ("More than 2 dmas is incompatible with pnp specifications."); 177 ("More than 2 dmas is incompatible with pnp specifications.");
@@ -390,7 +378,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
390 up(&pnp_res_mutex); 378 up(&pnp_res_mutex);
391 return 1; 379 return 1;
392 380
393 fail: 381fail:
394 pnp_clean_resource_table(&dev->res); 382 pnp_clean_resource_table(&dev->res);
395 up(&pnp_res_mutex); 383 up(&pnp_res_mutex);
396 return 0; 384 return 0;
@@ -410,8 +398,6 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
410 int i; 398 int i;
411 struct pnp_resource_table *bak; 399 struct pnp_resource_table *bak;
412 400
413 if (!dev || !res)
414 return -EINVAL;
415 if (!pnp_can_configure(dev)) 401 if (!pnp_can_configure(dev))
416 return -ENODEV; 402 return -ENODEV;
417 bak = pnp_alloc(sizeof(struct pnp_resource_table)); 403 bak = pnp_alloc(sizeof(struct pnp_resource_table));
@@ -444,7 +430,7 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
444 kfree(bak); 430 kfree(bak);
445 return 0; 431 return 0;
446 432
447 fail: 433fail:
448 dev->res = *bak; 434 dev->res = *bak;
449 up(&pnp_res_mutex); 435 up(&pnp_res_mutex);
450 kfree(bak); 436 kfree(bak);
@@ -460,9 +446,6 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
460 struct pnp_option *dep; 446 struct pnp_option *dep;
461 int i = 1; 447 int i = 1;
462 448
463 if (!dev)
464 return -EINVAL;
465
466 if (!pnp_can_configure(dev)) { 449 if (!pnp_can_configure(dev)) {
467 pnp_dbg("Device %s does not support resource configuration.", 450 pnp_dbg("Device %s does not support resource configuration.",
468 dev->dev.bus_id); 451 dev->dev.bus_id);
@@ -541,8 +524,6 @@ int pnp_activate_dev(struct pnp_dev *dev)
541{ 524{
542 int error; 525 int error;
543 526
544 if (!dev)
545 return -EINVAL;
546 if (dev->active) 527 if (dev->active)
547 return 0; /* the device is already active */ 528 return 0; /* the device is already active */
548 529
@@ -568,8 +549,6 @@ int pnp_disable_dev(struct pnp_dev *dev)
568{ 549{
569 int error; 550 int error;
570 551
571 if (!dev)
572 return -EINVAL;
573 if (!dev->active) 552 if (!dev->active)
574 return 0; /* the device is already disabled */ 553 return 0; /* the device is already disabled */
575 554
@@ -596,8 +575,6 @@ int pnp_disable_dev(struct pnp_dev *dev)
596void pnp_resource_change(struct resource *resource, resource_size_t start, 575void pnp_resource_change(struct resource *resource, resource_size_t start,
597 resource_size_t size) 576 resource_size_t size)
598{ 577{
599 if (resource == NULL)
600 return;
601 resource->flags &= ~(IORESOURCE_AUTO | IORESOURCE_UNSET); 578 resource->flags &= ~(IORESOURCE_AUTO | IORESOURCE_UNSET);
602 resource->start = start; 579 resource->start = start;
603 resource->end = start + size - 1; 580 resource->end = start + size - 1;
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 616fc72190bf..a5a372222d69 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -248,9 +248,9 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
248 num++; 248 num++;
249 249
250 return AE_OK; 250 return AE_OK;
251 err1: 251err1:
252 kfree(dev_id); 252 kfree(dev_id);
253 err: 253err:
254 kfree(dev); 254 kfree(dev);
255 return -EINVAL; 255 return -EINVAL;
256} 256}
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index ce5027feb3da..0e3b8d0ff06b 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -34,19 +34,17 @@
34 */ 34 */
35static int irq_flags(int triggering, int polarity) 35static int irq_flags(int triggering, int polarity)
36{ 36{
37 int flag;
38 if (triggering == ACPI_LEVEL_SENSITIVE) { 37 if (triggering == ACPI_LEVEL_SENSITIVE) {
39 if (polarity == ACPI_ACTIVE_LOW) 38 if (polarity == ACPI_ACTIVE_LOW)
40 flag = IORESOURCE_IRQ_LOWLEVEL; 39 return IORESOURCE_IRQ_LOWLEVEL;
41 else 40 else
42 flag = IORESOURCE_IRQ_HIGHLEVEL; 41 return IORESOURCE_IRQ_HIGHLEVEL;
43 } else { 42 } else {
44 if (polarity == ACPI_ACTIVE_LOW) 43 if (polarity == ACPI_ACTIVE_LOW)
45 flag = IORESOURCE_IRQ_LOWEDGE; 44 return IORESOURCE_IRQ_LOWEDGE;
46 else 45 else
47 flag = IORESOURCE_IRQ_HIGHEDGE; 46 return IORESOURCE_IRQ_HIGHEDGE;
48 } 47 }
49 return flag;
50} 48}
51 49
52static void decode_irq_flags(int flag, int *triggering, int *polarity) 50static void decode_irq_flags(int flag, int *triggering, int *polarity)
@@ -242,8 +240,7 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res
242static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, 240static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
243 void *data) 241 void *data)
244{ 242{
245 struct pnp_resource_table *res_table = 243 struct pnp_resource_table *res_table = data;
246 (struct pnp_resource_table *)data;
247 int i; 244 int i;
248 245
249 switch (res->type) { 246 switch (res->type) {
@@ -566,8 +563,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
566 void *data) 563 void *data)
567{ 564{
568 int priority = 0; 565 int priority = 0;
569 struct acpipnp_parse_option_s *parse_data = 566 struct acpipnp_parse_option_s *parse_data = data;
570 (struct acpipnp_parse_option_s *)data;
571 struct pnp_dev *dev = parse_data->dev; 567 struct pnp_dev *dev = parse_data->dev;
572 struct pnp_option *option = parse_data->option; 568 struct pnp_option *option = parse_data->option;
573 569
@@ -705,7 +701,7 @@ static int pnpacpi_supported_resource(struct acpi_resource *res)
705static acpi_status pnpacpi_count_resources(struct acpi_resource *res, 701static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
706 void *data) 702 void *data)
707{ 703{
708 int *res_cnt = (int *)data; 704 int *res_cnt = data;
709 705
710 if (pnpacpi_supported_resource(res)) 706 if (pnpacpi_supported_resource(res))
711 (*res_cnt)++; 707 (*res_cnt)++;
@@ -714,7 +710,7 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
714 710
715static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) 711static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data)
716{ 712{
717 struct acpi_resource **resource = (struct acpi_resource **)data; 713 struct acpi_resource **resource = data;
718 714
719 if (pnpacpi_supported_resource(res)) { 715 if (pnpacpi_supported_resource(res)) {
720 (*resource)->type = res->type; 716 (*resource)->type = res->type;
@@ -886,8 +882,7 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
886 int i = 0; 882 int i = 0;
887 /* pnpacpi_build_resource_template allocates extra mem */ 883 /* pnpacpi_build_resource_template allocates extra mem */
888 int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1; 884 int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1;
889 struct acpi_resource *resource = 885 struct acpi_resource *resource = buffer->pointer;
890 (struct acpi_resource *)buffer->pointer;
891 int port = 0, irq = 0, dma = 0, mem = 0; 886 int port = 0, irq = 0, dma = 0, mem = 0;
892 887
893 pnp_dbg("res cnt %d", res_cnt); 888 pnp_dbg("res cnt %d", res_cnt);
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 3692a099b45f..0691f473e9d4 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -419,7 +419,6 @@ static void __init build_devlist(void)
419static int pnpbios_disabled; 419static int pnpbios_disabled;
420int pnpbios_dont_use_current_config; 420int pnpbios_dont_use_current_config;
421 421
422#ifndef MODULE
423static int __init pnpbios_setup(char *str) 422static int __init pnpbios_setup(char *str)
424{ 423{
425 int invert; 424 int invert;
@@ -443,7 +442,6 @@ static int __init pnpbios_setup(char *str)
443} 442}
444 443
445__setup("pnpbios=", pnpbios_setup); 444__setup("pnpbios=", pnpbios_setup);
446#endif
447 445
448/* PnP BIOS signature: "$PnP" */ 446/* PnP BIOS signature: "$PnP" */
449#define PNP_SIGNATURE (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24)) 447#define PNP_SIGNATURE (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24))
@@ -591,6 +589,7 @@ subsys_initcall(pnpbios_init);
591static int __init pnpbios_thread_init(void) 589static int __init pnpbios_thread_init(void)
592{ 590{
593 struct task_struct *task; 591 struct task_struct *task;
592
594#if defined(CONFIG_PPC_MERGE) 593#if defined(CONFIG_PPC_MERGE)
595 if (check_legacy_ioport(PNPBIOS_BASE)) 594 if (check_legacy_ioport(PNPBIOS_BASE))
596 return 0; 595 return 0;
@@ -606,48 +605,7 @@ static int __init pnpbios_thread_init(void)
606 return 0; 605 return 0;
607} 606}
608 607
609#ifndef MODULE
610
611/* init/main.c calls pnpbios_init early */
612
613/* Start the kernel thread later: */ 608/* Start the kernel thread later: */
614module_init(pnpbios_thread_init); 609module_init(pnpbios_thread_init);
615 610
616#else
617
618/*
619 * N.B.: Building pnpbios as a module hasn't been fully implemented
620 */
621
622MODULE_LICENSE("GPL");
623
624static int __init pnpbios_init_all(void)
625{
626 int r;
627
628 r = pnpbios_init();
629 if (r)
630 return r;
631 r = pnpbios_thread_init();
632 if (r)
633 return r;
634 return 0;
635}
636
637static void __exit pnpbios_exit(void)
638{
639#ifdef CONFIG_HOTPLUG
640 unloading = 1;
641 wait_for_completion(&unload_sem);
642#endif
643 pnpbios_proc_exit();
644 /* We ought to free resources here */
645 return;
646}
647
648module_init(pnpbios_init_all);
649module_exit(pnpbios_exit);
650
651#endif
652
653EXPORT_SYMBOL(pnpbios_protocol); 611EXPORT_SYMBOL(pnpbios_protocol);
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c
index 9c8c07701b65..9d9841f24a85 100644
--- a/drivers/pnp/pnpbios/proc.c
+++ b/drivers/pnp/pnpbios/proc.c
@@ -212,7 +212,7 @@ static int proc_write_node(struct file *file, const char __user * buf,
212 goto out; 212 goto out;
213 } 213 }
214 ret = count; 214 ret = count;
215 out: 215out:
216 kfree(node); 216 kfree(node);
217 return ret; 217 return ret;
218} 218}
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index 04ecd7b67230..3fabf11b0027 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -238,7 +238,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
238 break; 238 break;
239 239
240 default: /* an unkown tag */ 240 default: /* an unkown tag */
241 len_err: 241len_err:
242 printk(KERN_ERR 242 printk(KERN_ERR
243 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", 243 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
244 tag, len); 244 tag, len);
@@ -298,6 +298,7 @@ static void pnpbios_parse_fixed_mem32_option(unsigned char *p, int size,
298 struct pnp_option *option) 298 struct pnp_option *option)
299{ 299{
300 struct pnp_mem *mem; 300 struct pnp_mem *mem;
301
301 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); 302 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL);
302 if (!mem) 303 if (!mem)
303 return; 304 return;
@@ -468,7 +469,7 @@ static unsigned char *pnpbios_parse_resource_option_data(unsigned char *p,
468 return p + 2; 469 return p + 2;
469 470
470 default: /* an unkown tag */ 471 default: /* an unkown tag */
471 len_err: 472len_err:
472 printk(KERN_ERR 473 printk(KERN_ERR
473 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", 474 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
474 tag, len); 475 tag, len);
@@ -562,7 +563,7 @@ static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p,
562 break; 563 break;
563 564
564 default: /* an unkown tag */ 565 default: /* an unkown tag */
565 len_err: 566len_err:
566 printk(KERN_ERR 567 printk(KERN_ERR
567 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", 568 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
568 tag, len); 569 tag, len);
@@ -756,7 +757,7 @@ static unsigned char *pnpbios_encode_allocated_resource_data(unsigned char *p,
756 break; 757 break;
757 758
758 default: /* an unkown tag */ 759 default: /* an unkown tag */
759 len_err: 760len_err:
760 printk(KERN_ERR 761 printk(KERN_ERR
761 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", 762 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
762 tag, len); 763 tag, len);
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index ea6ec14a0559..ef1286900db3 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -47,9 +47,6 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
47{ 47{
48 struct pnp_option *option; 48 struct pnp_option *option;
49 49
50 if (!dev)
51 return NULL;
52
53 option = pnp_build_option(PNP_RES_PRIORITY_PREFERRED); 50 option = pnp_build_option(PNP_RES_PRIORITY_PREFERRED);
54 51
55 /* this should never happen but if it does we'll try to continue */ 52 /* this should never happen but if it does we'll try to continue */
@@ -64,9 +61,6 @@ struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
64{ 61{
65 struct pnp_option *option; 62 struct pnp_option *option;
66 63
67 if (!dev)
68 return NULL;
69
70 option = pnp_build_option(priority); 64 option = pnp_build_option(priority);
71 65
72 if (dev->dependent) { 66 if (dev->dependent) {
@@ -83,11 +77,6 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data)
83{ 77{
84 struct pnp_irq *ptr; 78 struct pnp_irq *ptr;
85 79
86 if (!option)
87 return -EINVAL;
88 if (!data)
89 return -EINVAL;
90
91 ptr = option->irq; 80 ptr = option->irq;
92 while (ptr && ptr->next) 81 while (ptr && ptr->next)
93 ptr = ptr->next; 82 ptr = ptr->next;
@@ -112,11 +101,6 @@ int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data)
112{ 101{
113 struct pnp_dma *ptr; 102 struct pnp_dma *ptr;
114 103
115 if (!option)
116 return -EINVAL;
117 if (!data)
118 return -EINVAL;
119
120 ptr = option->dma; 104 ptr = option->dma;
121 while (ptr && ptr->next) 105 while (ptr && ptr->next)
122 ptr = ptr->next; 106 ptr = ptr->next;
@@ -132,11 +116,6 @@ int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data)
132{ 116{
133 struct pnp_port *ptr; 117 struct pnp_port *ptr;
134 118
135 if (!option)
136 return -EINVAL;
137 if (!data)
138 return -EINVAL;
139
140 ptr = option->port; 119 ptr = option->port;
141 while (ptr && ptr->next) 120 while (ptr && ptr->next)
142 ptr = ptr->next; 121 ptr = ptr->next;
@@ -152,11 +131,6 @@ int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data)
152{ 131{
153 struct pnp_mem *ptr; 132 struct pnp_mem *ptr;
154 133
155 if (!option)
156 return -EINVAL;
157 if (!data)
158 return -EINVAL;
159
160 ptr = option->mem; 134 ptr = option->mem;
161 while (ptr && ptr->next) 135 while (ptr && ptr->next)
162 ptr = ptr->next; 136 ptr = ptr->next;
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 3d0fea235bf3..86aea44ce6d4 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -321,8 +321,7 @@ struct acpi_bus_event {
321}; 321};
322 322
323extern struct kset acpi_subsys; 323extern struct kset acpi_subsys;
324extern int acpi_bus_generate_genetlink_event(struct acpi_device *device, 324extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
325 u8 type, int data);
326/* 325/*
327 * External Functions 326 * External Functions
328 */ 327 */
@@ -332,8 +331,13 @@ void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context);
332int acpi_bus_get_status(struct acpi_device *device); 331int acpi_bus_get_status(struct acpi_device *device);
333int acpi_bus_get_power(acpi_handle handle, int *state); 332int acpi_bus_get_power(acpi_handle handle, int *state);
334int acpi_bus_set_power(acpi_handle handle, int state); 333int acpi_bus_set_power(acpi_handle handle, int state);
335int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); 334#ifdef CONFIG_ACPI_PROC_EVENT
335int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);
336int acpi_bus_receive_event(struct acpi_bus_event *event); 336int acpi_bus_receive_event(struct acpi_bus_event *event);
337#else
338static inline int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
339 { return 0; }
340#endif
337int acpi_bus_register_driver(struct acpi_driver *driver); 341int acpi_bus_register_driver(struct acpi_driver *driver);
338void acpi_bus_unregister_driver(struct acpi_driver *driver); 342void acpi_bus_unregister_driver(struct acpi_driver *driver);
339int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, 343int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index b5cca5daa348..3d7ab9e0c9fe 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -130,7 +130,7 @@ acpi_walk_namespace(acpi_object_type type,
130 void *context, void **return_value); 130 void *context, void **return_value);
131 131
132acpi_status 132acpi_status
133acpi_get_devices(char *HID, 133acpi_get_devices(const char *HID,
134 acpi_walk_callback user_function, 134 acpi_walk_callback user_function,
135 void *context, void **return_value); 135 void *context, void **return_value);
136 136
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h
index aeb4498e5e06..88482655407f 100644
--- a/include/acpi/acstruct.h
+++ b/include/acpi/acstruct.h
@@ -146,7 +146,7 @@ struct acpi_init_walk_info {
146struct acpi_get_devices_info { 146struct acpi_get_devices_info {
147 acpi_walk_callback user_function; 147 acpi_walk_callback user_function;
148 void *context; 148 void *context;
149 char *hid; 149 const char *hid;
150}; 150};
151 151
152union acpi_aml_operands { 152union acpi_aml_operands {
diff --git a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h
index 340764076d5f..dbe734ddf2af 100644
--- a/include/asm-i386/io_apic.h
+++ b/include/asm-i386/io_apic.h
@@ -150,7 +150,6 @@ extern int (*ioapic_renumber_irq)(int ioapic, int irq);
150 150
151#else /* !CONFIG_X86_IO_APIC */ 151#else /* !CONFIG_X86_IO_APIC */
152#define io_apic_assign_pci_irqs 0 152#define io_apic_assign_pci_irqs 0
153static inline void disable_ioapic_setup(void) { }
154#endif 153#endif
155 154
156#endif 155#endif
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h
index 969d225a9350..d9f2e54324d5 100644
--- a/include/asm-x86_64/io_apic.h
+++ b/include/asm-x86_64/io_apic.h
@@ -109,6 +109,12 @@ extern int mpc_default_type;
109/* 1 if "noapic" boot option passed */ 109/* 1 if "noapic" boot option passed */
110extern int skip_ioapic_setup; 110extern int skip_ioapic_setup;
111 111
112static inline void disable_ioapic_setup(void)
113{
114 skip_ioapic_setup = 1;
115}
116
117
112/* 118/*
113 * If we use the IO-APIC for IRQ routing, disable automatic 119 * If we use the IO-APIC for IRQ routing, disable automatic
114 * assignment of PCI IRQ's. 120 * assignment of PCI IRQ's.
diff --git a/include/linux/input.h b/include/linux/input.h
index e02c6a66b2ba..cf2b5619aa13 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -363,6 +363,12 @@ struct input_absinfo {
363 363
364#define KEY_UNKNOWN 240 364#define KEY_UNKNOWN 240
365 365
366#define KEY_VIDEO_NEXT 241 /* drive next video source */
367#define KEY_VIDEO_PREV 242 /* drive previous video source */
368#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
369#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
370#define KEY_DISPLAY_OFF 245 /* display device to off state */
371
366#define BTN_MISC 0x100 372#define BTN_MISC 0x100
367#define BTN_0 0x100 373#define BTN_0 0x100
368#define BTN_1 0x101 374#define BTN_1 0x101
diff --git a/init/main.c b/init/main.c
index d3bcb3b11620..cc0653ec081d 100644
--- a/init/main.c
+++ b/init/main.c
@@ -146,9 +146,14 @@ static unsigned int __initdata max_cpus = NR_CPUS;
146 * greater than 0, limits the maximum number of CPUs activated in 146 * greater than 0, limits the maximum number of CPUs activated in
147 * SMP mode to <NUM>. 147 * SMP mode to <NUM>.
148 */ 148 */
149#ifndef CONFIG_X86_IO_APIC
150static inline void disable_ioapic_setup(void) {};
151#endif
152
149static int __init nosmp(char *str) 153static int __init nosmp(char *str)
150{ 154{
151 max_cpus = 0; 155 max_cpus = 0;
156 disable_ioapic_setup();
152 return 0; 157 return 0;
153} 158}
154 159
@@ -157,10 +162,13 @@ early_param("nosmp", nosmp);
157static int __init maxcpus(char *str) 162static int __init maxcpus(char *str)
158{ 163{
159 get_option(&str, &max_cpus); 164 get_option(&str, &max_cpus);
160 return 1; 165 if (max_cpus == 0)
166 disable_ioapic_setup();
167
168 return 0;
161} 169}
162 170
163__setup("maxcpus=", maxcpus); 171early_param("maxcpus=", maxcpus);
164#else 172#else
165#define max_cpus NR_CPUS 173#define max_cpus NR_CPUS
166#endif 174#endif