diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-08 18:32:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-08 18:32:06 -0400 |
commit | 7b85a88ca7760d6d5f34bdaa793c71d921a3e853 (patch) | |
tree | 821b9860f85ca49bc6fc7a58642b7d1faff8f2fb | |
parent | 139ef17a464a222aadf7b543d734a4001d06b720 (diff) | |
parent | 8897c1859521cf33077256725b2377164b130c75 (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:
x86 ACPI: Add support for Always Running APIC timer
ACPI x86: Make aperf/mperf MSR access in acpi_cpufreq read_only
ACPI x86: Cleanup acpi_cpufreq structures related to aperf/mperf
ACPICA: delete check for AML access to port 0x81-83
ACPI: WMI: use .notify method instead of installing handler directly
sony-laptop: use .notify method instead of installing handler directly
panasonic-laptop: use .notify method instead of installing handler directly
fujitsu-laptop: use .notify method instead of installing hotkey handler directly
fujitsu-laptop: use .notify method instead of installing handler directly
ACPI: video: use .notify method instead of installing handler directly
ACPI: thermal: use .notify method instead of installing handler directly
ACPI battery: fix async boot oops
ACPI: delete acpi_device.g_list
NULL noise: drivers/platform/x86/panasonic-laptop.c
ACPI: cpufreq: remove dupilcated #include
ACPI: Adjust Kelvin offset to match local implementation
ACPI: convert acpi_device_lock spinlock to mutex
-rw-r--r-- | arch/x86/include/asm/cpufeature.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/addon_cpuid_features.c | 1 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 55 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/longhaul.c | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwvalid.c | 1 | ||||
-rw-r--r-- | drivers/acpi/battery.c | 2 | ||||
-rw-r--r-- | drivers/acpi/proc.c | 13 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 3 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 31 | ||||
-rw-r--r-- | drivers/acpi/sleep.h | 3 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 68 | ||||
-rw-r--r-- | drivers/acpi/video.c | 30 | ||||
-rw-r--r-- | drivers/acpi/wakeup.c | 30 | ||||
-rw-r--r-- | drivers/platform/x86/fujitsu-laptop.c | 60 | ||||
-rw-r--r-- | drivers/platform/x86/panasonic-laptop.c | 28 | ||||
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 30 | ||||
-rw-r--r-- | drivers/platform/x86/wmi.c | 15 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 1 |
19 files changed, 131 insertions, 248 deletions
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 0beba0d1468d..bb83b1c397aa 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -154,6 +154,7 @@ | |||
154 | * CPUID levels like 0x6, 0xA etc | 154 | * CPUID levels like 0x6, 0xA etc |
155 | */ | 155 | */ |
156 | #define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ | 156 | #define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ |
157 | #define X86_FEATURE_ARAT (7*32+ 1) /* Always Running APIC Timer */ | ||
157 | 158 | ||
158 | /* Virtualization flags: Linux defined */ | 159 | /* Virtualization flags: Linux defined */ |
159 | #define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */ | 160 | #define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */ |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 098ec84b8c00..f2870920f246 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -431,6 +431,12 @@ static void __cpuinit setup_APIC_timer(void) | |||
431 | { | 431 | { |
432 | struct clock_event_device *levt = &__get_cpu_var(lapic_events); | 432 | struct clock_event_device *levt = &__get_cpu_var(lapic_events); |
433 | 433 | ||
434 | if (cpu_has(¤t_cpu_data, X86_FEATURE_ARAT)) { | ||
435 | lapic_clockevent.features &= ~CLOCK_EVT_FEAT_C3STOP; | ||
436 | /* Make LAPIC timer preferrable over percpu HPET */ | ||
437 | lapic_clockevent.rating = 150; | ||
438 | } | ||
439 | |||
434 | memcpy(levt, &lapic_clockevent, sizeof(*levt)); | 440 | memcpy(levt, &lapic_clockevent, sizeof(*levt)); |
435 | levt->cpumask = cpumask_of(smp_processor_id()); | 441 | levt->cpumask = cpumask_of(smp_processor_id()); |
436 | 442 | ||
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index 8220ae69849d..c965e5212714 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
@@ -31,6 +31,7 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) | |||
31 | 31 | ||
32 | static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { | 32 | static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { |
33 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 }, | 33 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 }, |
34 | { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006 }, | ||
34 | { 0, 0, 0, 0 } | 35 | { 0, 0, 0, 0 } |
35 | }; | 36 | }; |
36 | 37 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 19f6b9d27e83..9d3af380c6bd 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -68,6 +68,7 @@ struct acpi_cpufreq_data { | |||
68 | unsigned int max_freq; | 68 | unsigned int max_freq; |
69 | unsigned int resume; | 69 | unsigned int resume; |
70 | unsigned int cpu_feature; | 70 | unsigned int cpu_feature; |
71 | u64 saved_aperf, saved_mperf; | ||
71 | }; | 72 | }; |
72 | 73 | ||
73 | static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data); | 74 | static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data); |
@@ -241,26 +242,23 @@ static u32 get_cur_val(const struct cpumask *mask) | |||
241 | return cmd.val; | 242 | return cmd.val; |
242 | } | 243 | } |
243 | 244 | ||
244 | struct perf_cur { | 245 | struct perf_pair { |
245 | union { | 246 | union { |
246 | struct { | 247 | struct { |
247 | u32 lo; | 248 | u32 lo; |
248 | u32 hi; | 249 | u32 hi; |
249 | } split; | 250 | } split; |
250 | u64 whole; | 251 | u64 whole; |
251 | } aperf_cur, mperf_cur; | 252 | } aperf, mperf; |
252 | }; | 253 | }; |
253 | 254 | ||
254 | 255 | ||
255 | static long read_measured_perf_ctrs(void *_cur) | 256 | static long read_measured_perf_ctrs(void *_cur) |
256 | { | 257 | { |
257 | struct perf_cur *cur = _cur; | 258 | struct perf_pair *cur = _cur; |
258 | 259 | ||
259 | rdmsr(MSR_IA32_APERF, cur->aperf_cur.split.lo, cur->aperf_cur.split.hi); | 260 | rdmsr(MSR_IA32_APERF, cur->aperf.split.lo, cur->aperf.split.hi); |
260 | rdmsr(MSR_IA32_MPERF, cur->mperf_cur.split.lo, cur->mperf_cur.split.hi); | 261 | rdmsr(MSR_IA32_MPERF, cur->mperf.split.lo, cur->mperf.split.hi); |
261 | |||
262 | wrmsr(MSR_IA32_APERF, 0, 0); | ||
263 | wrmsr(MSR_IA32_MPERF, 0, 0); | ||
264 | 262 | ||
265 | return 0; | 263 | return 0; |
266 | } | 264 | } |
@@ -281,52 +279,57 @@ static long read_measured_perf_ctrs(void *_cur) | |||
281 | static unsigned int get_measured_perf(struct cpufreq_policy *policy, | 279 | static unsigned int get_measured_perf(struct cpufreq_policy *policy, |
282 | unsigned int cpu) | 280 | unsigned int cpu) |
283 | { | 281 | { |
284 | struct perf_cur cur; | 282 | struct perf_pair readin, cur; |
285 | unsigned int perf_percent; | 283 | unsigned int perf_percent; |
286 | unsigned int retval; | 284 | unsigned int retval; |
287 | 285 | ||
288 | if (!work_on_cpu(cpu, read_measured_perf_ctrs, &cur)) | 286 | if (!work_on_cpu(cpu, read_measured_perf_ctrs, &readin)) |
289 | return 0; | 287 | return 0; |
290 | 288 | ||
289 | cur.aperf.whole = readin.aperf.whole - | ||
290 | per_cpu(drv_data, cpu)->saved_aperf; | ||
291 | cur.mperf.whole = readin.mperf.whole - | ||
292 | per_cpu(drv_data, cpu)->saved_mperf; | ||
293 | per_cpu(drv_data, cpu)->saved_aperf = readin.aperf.whole; | ||
294 | per_cpu(drv_data, cpu)->saved_mperf = readin.mperf.whole; | ||
295 | |||
291 | #ifdef __i386__ | 296 | #ifdef __i386__ |
292 | /* | 297 | /* |
293 | * We dont want to do 64 bit divide with 32 bit kernel | 298 | * We dont want to do 64 bit divide with 32 bit kernel |
294 | * Get an approximate value. Return failure in case we cannot get | 299 | * Get an approximate value. Return failure in case we cannot get |
295 | * an approximate value. | 300 | * an approximate value. |
296 | */ | 301 | */ |
297 | if (unlikely(cur.aperf_cur.split.hi || cur.mperf_cur.split.hi)) { | 302 | if (unlikely(cur.aperf.split.hi || cur.mperf.split.hi)) { |
298 | int shift_count; | 303 | int shift_count; |
299 | u32 h; | 304 | u32 h; |
300 | 305 | ||
301 | h = max_t(u32, cur.aperf_cur.split.hi, cur.mperf_cur.split.hi); | 306 | h = max_t(u32, cur.aperf.split.hi, cur.mperf.split.hi); |
302 | shift_count = fls(h); | 307 | shift_count = fls(h); |
303 | 308 | ||
304 | cur.aperf_cur.whole >>= shift_count; | 309 | cur.aperf.whole >>= shift_count; |
305 | cur.mperf_cur.whole >>= shift_count; | 310 | cur.mperf.whole >>= shift_count; |
306 | } | 311 | } |
307 | 312 | ||
308 | if (((unsigned long)(-1) / 100) < cur.aperf_cur.split.lo) { | 313 | if (((unsigned long)(-1) / 100) < cur.aperf.split.lo) { |
309 | int shift_count = 7; | 314 | int shift_count = 7; |
310 | cur.aperf_cur.split.lo >>= shift_count; | 315 | cur.aperf.split.lo >>= shift_count; |
311 | cur.mperf_cur.split.lo >>= shift_count; | 316 | cur.mperf.split.lo >>= shift_count; |
312 | } | 317 | } |
313 | 318 | ||
314 | if (cur.aperf_cur.split.lo && cur.mperf_cur.split.lo) | 319 | if (cur.aperf.split.lo && cur.mperf.split.lo) |
315 | perf_percent = (cur.aperf_cur.split.lo * 100) / | 320 | perf_percent = (cur.aperf.split.lo * 100) / cur.mperf.split.lo; |
316 | cur.mperf_cur.split.lo; | ||
317 | else | 321 | else |
318 | perf_percent = 0; | 322 | perf_percent = 0; |
319 | 323 | ||
320 | #else | 324 | #else |
321 | if (unlikely(((unsigned long)(-1) / 100) < cur.aperf_cur.whole)) { | 325 | if (unlikely(((unsigned long)(-1) / 100) < cur.aperf.whole)) { |
322 | int shift_count = 7; | 326 | int shift_count = 7; |
323 | cur.aperf_cur.whole >>= shift_count; | 327 | cur.aperf.whole >>= shift_count; |
324 | cur.mperf_cur.whole >>= shift_count; | 328 | cur.mperf.whole >>= shift_count; |
325 | } | 329 | } |
326 | 330 | ||
327 | if (cur.aperf_cur.whole && cur.mperf_cur.whole) | 331 | if (cur.aperf.whole && cur.mperf.whole) |
328 | perf_percent = (cur.aperf_cur.whole * 100) / | 332 | perf_percent = (cur.aperf.whole * 100) / cur.mperf.whole; |
329 | cur.mperf_cur.whole; | ||
330 | else | 333 | else |
331 | perf_percent = 0; | 334 | perf_percent = 0; |
332 | 335 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/longhaul.c b/arch/x86/kernel/cpu/cpufreq/longhaul.c index 0bd48e65a0ca..ce2ed3e4aad9 100644 --- a/arch/x86/kernel/cpu/cpufreq/longhaul.c +++ b/arch/x86/kernel/cpu/cpufreq/longhaul.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/timex.h> | 33 | #include <linux/timex.h> |
34 | #include <linux/io.h> | 34 | #include <linux/io.h> |
35 | #include <linux/acpi.h> | 35 | #include <linux/acpi.h> |
36 | #include <linux/kernel.h> | ||
37 | 36 | ||
38 | #include <asm/msr.h> | 37 | #include <asm/msr.h> |
39 | #include <acpi/processor.h> | 38 | #include <acpi/processor.h> |
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c index bd3c937b0ac0..7737afb157c3 100644 --- a/drivers/acpi/acpica/hwvalid.c +++ b/drivers/acpi/acpica/hwvalid.c | |||
@@ -90,7 +90,6 @@ static const struct acpi_port_info acpi_protected_ports[] = { | |||
90 | {"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP}, | 90 | {"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP}, |
91 | {"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP}, | 91 | {"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP}, |
92 | {"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP}, | 92 | {"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP}, |
93 | {"DMA1", 0x0081, 0x0083, ACPI_OSI_WIN_XP}, | ||
94 | {"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP}, | 93 | {"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP}, |
95 | {"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP}, | 94 | {"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP}, |
96 | {"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP}, | 95 | {"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP}, |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index b0de6312919a..3c7d8942f23b 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -903,7 +903,7 @@ static struct acpi_driver acpi_battery_driver = { | |||
903 | }, | 903 | }, |
904 | }; | 904 | }; |
905 | 905 | ||
906 | static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) | 906 | static void acpi_battery_init_async(void *unused, async_cookie_t cookie) |
907 | { | 907 | { |
908 | if (acpi_disabled) | 908 | if (acpi_disabled) |
909 | return; | 909 | return; |
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index 05dfdc96802e..d0d550d22a6d 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
@@ -343,9 +343,6 @@ acpi_system_write_alarm(struct file *file, | |||
343 | } | 343 | } |
344 | #endif /* HAVE_ACPI_LEGACY_ALARM */ | 344 | #endif /* HAVE_ACPI_LEGACY_ALARM */ |
345 | 345 | ||
346 | extern struct list_head acpi_wakeup_device_list; | ||
347 | extern spinlock_t acpi_device_lock; | ||
348 | |||
349 | static int | 346 | static int |
350 | acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | 347 | acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) |
351 | { | 348 | { |
@@ -353,7 +350,7 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
353 | 350 | ||
354 | seq_printf(seq, "Device\tS-state\t Status Sysfs node\n"); | 351 | seq_printf(seq, "Device\tS-state\t Status Sysfs node\n"); |
355 | 352 | ||
356 | spin_lock(&acpi_device_lock); | 353 | mutex_lock(&acpi_device_lock); |
357 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 354 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
358 | struct acpi_device *dev = | 355 | struct acpi_device *dev = |
359 | container_of(node, struct acpi_device, wakeup_list); | 356 | container_of(node, struct acpi_device, wakeup_list); |
@@ -361,7 +358,6 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
361 | 358 | ||
362 | if (!dev->wakeup.flags.valid) | 359 | if (!dev->wakeup.flags.valid) |
363 | continue; | 360 | continue; |
364 | spin_unlock(&acpi_device_lock); | ||
365 | 361 | ||
366 | ldev = acpi_get_physical_device(dev->handle); | 362 | ldev = acpi_get_physical_device(dev->handle); |
367 | seq_printf(seq, "%s\t S%d\t%c%-8s ", | 363 | seq_printf(seq, "%s\t S%d\t%c%-8s ", |
@@ -376,9 +372,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
376 | seq_printf(seq, "\n"); | 372 | seq_printf(seq, "\n"); |
377 | put_device(ldev); | 373 | put_device(ldev); |
378 | 374 | ||
379 | spin_lock(&acpi_device_lock); | ||
380 | } | 375 | } |
381 | spin_unlock(&acpi_device_lock); | 376 | mutex_unlock(&acpi_device_lock); |
382 | return 0; | 377 | return 0; |
383 | } | 378 | } |
384 | 379 | ||
@@ -409,7 +404,7 @@ acpi_system_write_wakeup_device(struct file *file, | |||
409 | strbuf[len] = '\0'; | 404 | strbuf[len] = '\0'; |
410 | sscanf(strbuf, "%s", str); | 405 | sscanf(strbuf, "%s", str); |
411 | 406 | ||
412 | spin_lock(&acpi_device_lock); | 407 | mutex_lock(&acpi_device_lock); |
413 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 408 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
414 | struct acpi_device *dev = | 409 | struct acpi_device *dev = |
415 | container_of(node, struct acpi_device, wakeup_list); | 410 | container_of(node, struct acpi_device, wakeup_list); |
@@ -446,7 +441,7 @@ acpi_system_write_wakeup_device(struct file *file, | |||
446 | } | 441 | } |
447 | } | 442 | } |
448 | } | 443 | } |
449 | spin_unlock(&acpi_device_lock); | 444 | mutex_unlock(&acpi_device_lock); |
450 | return count; | 445 | return count; |
451 | } | 446 | } |
452 | 447 | ||
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 4e6e758bd397..6fe121434ffb 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -145,6 +145,9 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr, | |||
145 | struct acpi_processor_power *pwr = &pr->power; | 145 | struct acpi_processor_power *pwr = &pr->power; |
146 | u8 type = local_apic_timer_c2_ok ? ACPI_STATE_C3 : ACPI_STATE_C2; | 146 | u8 type = local_apic_timer_c2_ok ? ACPI_STATE_C3 : ACPI_STATE_C2; |
147 | 147 | ||
148 | if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT)) | ||
149 | return; | ||
150 | |||
148 | /* | 151 | /* |
149 | * Check, if one of the previous states already marked the lapic | 152 | * Check, if one of the previous states already marked the lapic |
150 | * unstable | 153 | * unstable |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 20c23c049207..8ff510b91d88 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -24,7 +24,7 @@ extern struct acpi_device *acpi_root; | |||
24 | 24 | ||
25 | static LIST_HEAD(acpi_device_list); | 25 | static LIST_HEAD(acpi_device_list); |
26 | static LIST_HEAD(acpi_bus_id_list); | 26 | static LIST_HEAD(acpi_bus_id_list); |
27 | DEFINE_SPINLOCK(acpi_device_lock); | 27 | DEFINE_MUTEX(acpi_device_lock); |
28 | LIST_HEAD(acpi_wakeup_device_list); | 28 | LIST_HEAD(acpi_wakeup_device_list); |
29 | 29 | ||
30 | struct acpi_device_bus_id{ | 30 | struct acpi_device_bus_id{ |
@@ -491,7 +491,6 @@ static int acpi_device_register(struct acpi_device *device, | |||
491 | */ | 491 | */ |
492 | INIT_LIST_HEAD(&device->children); | 492 | INIT_LIST_HEAD(&device->children); |
493 | INIT_LIST_HEAD(&device->node); | 493 | INIT_LIST_HEAD(&device->node); |
494 | INIT_LIST_HEAD(&device->g_list); | ||
495 | INIT_LIST_HEAD(&device->wakeup_list); | 494 | INIT_LIST_HEAD(&device->wakeup_list); |
496 | 495 | ||
497 | new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); | 496 | new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); |
@@ -500,7 +499,7 @@ static int acpi_device_register(struct acpi_device *device, | |||
500 | return -ENOMEM; | 499 | return -ENOMEM; |
501 | } | 500 | } |
502 | 501 | ||
503 | spin_lock(&acpi_device_lock); | 502 | mutex_lock(&acpi_device_lock); |
504 | /* | 503 | /* |
505 | * Find suitable bus_id and instance number in acpi_bus_id_list | 504 | * Find suitable bus_id and instance number in acpi_bus_id_list |
506 | * If failed, create one and link it into acpi_bus_id_list | 505 | * If failed, create one and link it into acpi_bus_id_list |
@@ -521,14 +520,12 @@ static int acpi_device_register(struct acpi_device *device, | |||
521 | } | 520 | } |
522 | dev_set_name(&device->dev, "%s:%02x", acpi_device_bus_id->bus_id, acpi_device_bus_id->instance_no); | 521 | dev_set_name(&device->dev, "%s:%02x", acpi_device_bus_id->bus_id, acpi_device_bus_id->instance_no); |
523 | 522 | ||
524 | if (device->parent) { | 523 | if (device->parent) |
525 | list_add_tail(&device->node, &device->parent->children); | 524 | list_add_tail(&device->node, &device->parent->children); |
526 | list_add_tail(&device->g_list, &device->parent->g_list); | 525 | |
527 | } else | ||
528 | list_add_tail(&device->g_list, &acpi_device_list); | ||
529 | if (device->wakeup.flags.valid) | 526 | if (device->wakeup.flags.valid) |
530 | list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list); | 527 | list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list); |
531 | spin_unlock(&acpi_device_lock); | 528 | mutex_unlock(&acpi_device_lock); |
532 | 529 | ||
533 | if (device->parent) | 530 | if (device->parent) |
534 | device->dev.parent = &parent->dev; | 531 | device->dev.parent = &parent->dev; |
@@ -549,28 +546,22 @@ static int acpi_device_register(struct acpi_device *device, | |||
549 | device->removal_type = ACPI_BUS_REMOVAL_NORMAL; | 546 | device->removal_type = ACPI_BUS_REMOVAL_NORMAL; |
550 | return 0; | 547 | return 0; |
551 | end: | 548 | end: |
552 | spin_lock(&acpi_device_lock); | 549 | mutex_lock(&acpi_device_lock); |
553 | if (device->parent) { | 550 | if (device->parent) |
554 | list_del(&device->node); | 551 | list_del(&device->node); |
555 | list_del(&device->g_list); | ||
556 | } else | ||
557 | list_del(&device->g_list); | ||
558 | list_del(&device->wakeup_list); | 552 | list_del(&device->wakeup_list); |
559 | spin_unlock(&acpi_device_lock); | 553 | mutex_unlock(&acpi_device_lock); |
560 | return result; | 554 | return result; |
561 | } | 555 | } |
562 | 556 | ||
563 | static void acpi_device_unregister(struct acpi_device *device, int type) | 557 | static void acpi_device_unregister(struct acpi_device *device, int type) |
564 | { | 558 | { |
565 | spin_lock(&acpi_device_lock); | 559 | mutex_lock(&acpi_device_lock); |
566 | if (device->parent) { | 560 | if (device->parent) |
567 | list_del(&device->node); | 561 | list_del(&device->node); |
568 | list_del(&device->g_list); | ||
569 | } else | ||
570 | list_del(&device->g_list); | ||
571 | 562 | ||
572 | list_del(&device->wakeup_list); | 563 | list_del(&device->wakeup_list); |
573 | spin_unlock(&acpi_device_lock); | 564 | mutex_unlock(&acpi_device_lock); |
574 | 565 | ||
575 | acpi_detach_data(device->handle, acpi_bus_data_handler); | 566 | acpi_detach_data(device->handle, acpi_bus_data_handler); |
576 | 567 | ||
diff --git a/drivers/acpi/sleep.h b/drivers/acpi/sleep.h index cfaf8f5b0a14..8a8f3b3382a6 100644 --- a/drivers/acpi/sleep.h +++ b/drivers/acpi/sleep.h | |||
@@ -5,3 +5,6 @@ extern int acpi_suspend (u32 state); | |||
5 | extern void acpi_enable_wakeup_device_prep(u8 sleep_state); | 5 | extern void acpi_enable_wakeup_device_prep(u8 sleep_state); |
6 | extern void acpi_enable_wakeup_device(u8 sleep_state); | 6 | extern void acpi_enable_wakeup_device(u8 sleep_state); |
7 | extern void acpi_disable_wakeup_device(u8 sleep_state); | 7 | extern void acpi_disable_wakeup_device(u8 sleep_state); |
8 | |||
9 | extern struct list_head acpi_wakeup_device_list; | ||
10 | extern struct mutex acpi_device_lock; | ||
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index e8c143caf0fd..9cd15e8c8932 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -98,6 +98,7 @@ MODULE_PARM_DESC(psv, "Disable or override all passive trip points."); | |||
98 | static int acpi_thermal_add(struct acpi_device *device); | 98 | static int acpi_thermal_add(struct acpi_device *device); |
99 | static int acpi_thermal_remove(struct acpi_device *device, int type); | 99 | static int acpi_thermal_remove(struct acpi_device *device, int type); |
100 | static int acpi_thermal_resume(struct acpi_device *device); | 100 | static int acpi_thermal_resume(struct acpi_device *device); |
101 | static void acpi_thermal_notify(struct acpi_device *device, u32 event); | ||
101 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); | 102 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); |
102 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); | 103 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); |
103 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); | 104 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); |
@@ -123,6 +124,7 @@ static struct acpi_driver acpi_thermal_driver = { | |||
123 | .add = acpi_thermal_add, | 124 | .add = acpi_thermal_add, |
124 | .remove = acpi_thermal_remove, | 125 | .remove = acpi_thermal_remove, |
125 | .resume = acpi_thermal_resume, | 126 | .resume = acpi_thermal_resume, |
127 | .notify = acpi_thermal_notify, | ||
126 | }, | 128 | }, |
127 | }; | 129 | }; |
128 | 130 | ||
@@ -192,6 +194,7 @@ struct acpi_thermal { | |||
192 | struct acpi_handle_list devices; | 194 | struct acpi_handle_list devices; |
193 | struct thermal_zone_device *thermal_zone; | 195 | struct thermal_zone_device *thermal_zone; |
194 | int tz_enabled; | 196 | int tz_enabled; |
197 | int kelvin_offset; | ||
195 | struct mutex lock; | 198 | struct mutex lock; |
196 | }; | 199 | }; |
197 | 200 | ||
@@ -581,7 +584,7 @@ static void acpi_thermal_check(void *data) | |||
581 | } | 584 | } |
582 | 585 | ||
583 | /* sys I/F for generic thermal sysfs support */ | 586 | /* sys I/F for generic thermal sysfs support */ |
584 | #define KELVIN_TO_MILLICELSIUS(t) (t * 100 - 273200) | 587 | #define KELVIN_TO_MILLICELSIUS(t, off) (((t) - (off)) * 100) |
585 | 588 | ||
586 | static int thermal_get_temp(struct thermal_zone_device *thermal, | 589 | static int thermal_get_temp(struct thermal_zone_device *thermal, |
587 | unsigned long *temp) | 590 | unsigned long *temp) |
@@ -596,7 +599,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, | |||
596 | if (result) | 599 | if (result) |
597 | return result; | 600 | return result; |
598 | 601 | ||
599 | *temp = KELVIN_TO_MILLICELSIUS(tz->temperature); | 602 | *temp = KELVIN_TO_MILLICELSIUS(tz->temperature, tz->kelvin_offset); |
600 | return 0; | 603 | return 0; |
601 | } | 604 | } |
602 | 605 | ||
@@ -702,7 +705,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, | |||
702 | if (tz->trips.critical.flags.valid) { | 705 | if (tz->trips.critical.flags.valid) { |
703 | if (!trip) { | 706 | if (!trip) { |
704 | *temp = KELVIN_TO_MILLICELSIUS( | 707 | *temp = KELVIN_TO_MILLICELSIUS( |
705 | tz->trips.critical.temperature); | 708 | tz->trips.critical.temperature, |
709 | tz->kelvin_offset); | ||
706 | return 0; | 710 | return 0; |
707 | } | 711 | } |
708 | trip--; | 712 | trip--; |
@@ -711,7 +715,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, | |||
711 | if (tz->trips.hot.flags.valid) { | 715 | if (tz->trips.hot.flags.valid) { |
712 | if (!trip) { | 716 | if (!trip) { |
713 | *temp = KELVIN_TO_MILLICELSIUS( | 717 | *temp = KELVIN_TO_MILLICELSIUS( |
714 | tz->trips.hot.temperature); | 718 | tz->trips.hot.temperature, |
719 | tz->kelvin_offset); | ||
715 | return 0; | 720 | return 0; |
716 | } | 721 | } |
717 | trip--; | 722 | trip--; |
@@ -720,7 +725,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, | |||
720 | if (tz->trips.passive.flags.valid) { | 725 | if (tz->trips.passive.flags.valid) { |
721 | if (!trip) { | 726 | if (!trip) { |
722 | *temp = KELVIN_TO_MILLICELSIUS( | 727 | *temp = KELVIN_TO_MILLICELSIUS( |
723 | tz->trips.passive.temperature); | 728 | tz->trips.passive.temperature, |
729 | tz->kelvin_offset); | ||
724 | return 0; | 730 | return 0; |
725 | } | 731 | } |
726 | trip--; | 732 | trip--; |
@@ -730,7 +736,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, | |||
730 | tz->trips.active[i].flags.valid; i++) { | 736 | tz->trips.active[i].flags.valid; i++) { |
731 | if (!trip) { | 737 | if (!trip) { |
732 | *temp = KELVIN_TO_MILLICELSIUS( | 738 | *temp = KELVIN_TO_MILLICELSIUS( |
733 | tz->trips.active[i].temperature); | 739 | tz->trips.active[i].temperature, |
740 | tz->kelvin_offset); | ||
734 | return 0; | 741 | return 0; |
735 | } | 742 | } |
736 | trip--; | 743 | trip--; |
@@ -745,7 +752,8 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal, | |||
745 | 752 | ||
746 | if (tz->trips.critical.flags.valid) { | 753 | if (tz->trips.critical.flags.valid) { |
747 | *temperature = KELVIN_TO_MILLICELSIUS( | 754 | *temperature = KELVIN_TO_MILLICELSIUS( |
748 | tz->trips.critical.temperature); | 755 | tz->trips.critical.temperature, |
756 | tz->kelvin_offset); | ||
749 | return 0; | 757 | return 0; |
750 | } else | 758 | } else |
751 | return -EINVAL; | 759 | return -EINVAL; |
@@ -1264,17 +1272,14 @@ static int acpi_thermal_remove_fs(struct acpi_device *device) | |||
1264 | Driver Interface | 1272 | Driver Interface |
1265 | -------------------------------------------------------------------------- */ | 1273 | -------------------------------------------------------------------------- */ |
1266 | 1274 | ||
1267 | static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | 1275 | static void acpi_thermal_notify(struct acpi_device *device, u32 event) |
1268 | { | 1276 | { |
1269 | struct acpi_thermal *tz = data; | 1277 | struct acpi_thermal *tz = acpi_driver_data(device); |
1270 | struct acpi_device *device = NULL; | ||
1271 | 1278 | ||
1272 | 1279 | ||
1273 | if (!tz) | 1280 | if (!tz) |
1274 | return; | 1281 | return; |
1275 | 1282 | ||
1276 | device = tz->device; | ||
1277 | |||
1278 | switch (event) { | 1283 | switch (event) { |
1279 | case ACPI_THERMAL_NOTIFY_TEMPERATURE: | 1284 | case ACPI_THERMAL_NOTIFY_TEMPERATURE: |
1280 | acpi_thermal_check(tz); | 1285 | acpi_thermal_check(tz); |
@@ -1298,8 +1303,6 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | |||
1298 | "Unsupported event [0x%x]\n", event)); | 1303 | "Unsupported event [0x%x]\n", event)); |
1299 | break; | 1304 | break; |
1300 | } | 1305 | } |
1301 | |||
1302 | return; | ||
1303 | } | 1306 | } |
1304 | 1307 | ||
1305 | static int acpi_thermal_get_info(struct acpi_thermal *tz) | 1308 | static int acpi_thermal_get_info(struct acpi_thermal *tz) |
@@ -1334,10 +1337,28 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz) | |||
1334 | return 0; | 1337 | return 0; |
1335 | } | 1338 | } |
1336 | 1339 | ||
1340 | /* | ||
1341 | * The exact offset between Kelvin and degree Celsius is 273.15. However ACPI | ||
1342 | * handles temperature values with a single decimal place. As a consequence, | ||
1343 | * some implementations use an offset of 273.1 and others use an offset of | ||
1344 | * 273.2. Try to find out which one is being used, to present the most | ||
1345 | * accurate and visually appealing number. | ||
1346 | * | ||
1347 | * The heuristic below should work for all ACPI thermal zones which have a | ||
1348 | * critical trip point with a value being a multiple of 0.5 degree Celsius. | ||
1349 | */ | ||
1350 | static void acpi_thermal_guess_offset(struct acpi_thermal *tz) | ||
1351 | { | ||
1352 | if (tz->trips.critical.flags.valid && | ||
1353 | (tz->trips.critical.temperature % 5) == 1) | ||
1354 | tz->kelvin_offset = 2731; | ||
1355 | else | ||
1356 | tz->kelvin_offset = 2732; | ||
1357 | } | ||
1358 | |||
1337 | static int acpi_thermal_add(struct acpi_device *device) | 1359 | static int acpi_thermal_add(struct acpi_device *device) |
1338 | { | 1360 | { |
1339 | int result = 0; | 1361 | int result = 0; |
1340 | acpi_status status = AE_OK; | ||
1341 | struct acpi_thermal *tz = NULL; | 1362 | struct acpi_thermal *tz = NULL; |
1342 | 1363 | ||
1343 | 1364 | ||
@@ -1360,6 +1381,8 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1360 | if (result) | 1381 | if (result) |
1361 | goto free_memory; | 1382 | goto free_memory; |
1362 | 1383 | ||
1384 | acpi_thermal_guess_offset(tz); | ||
1385 | |||
1363 | result = acpi_thermal_register_thermal_zone(tz); | 1386 | result = acpi_thermal_register_thermal_zone(tz); |
1364 | if (result) | 1387 | if (result) |
1365 | goto free_memory; | 1388 | goto free_memory; |
@@ -1368,21 +1391,11 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1368 | if (result) | 1391 | if (result) |
1369 | goto unregister_thermal_zone; | 1392 | goto unregister_thermal_zone; |
1370 | 1393 | ||
1371 | status = acpi_install_notify_handler(device->handle, | ||
1372 | ACPI_DEVICE_NOTIFY, | ||
1373 | acpi_thermal_notify, tz); | ||
1374 | if (ACPI_FAILURE(status)) { | ||
1375 | result = -ENODEV; | ||
1376 | goto remove_fs; | ||
1377 | } | ||
1378 | |||
1379 | printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n", | 1394 | printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n", |
1380 | acpi_device_name(device), acpi_device_bid(device), | 1395 | acpi_device_name(device), acpi_device_bid(device), |
1381 | KELVIN_TO_CELSIUS(tz->temperature)); | 1396 | KELVIN_TO_CELSIUS(tz->temperature)); |
1382 | goto end; | 1397 | goto end; |
1383 | 1398 | ||
1384 | remove_fs: | ||
1385 | acpi_thermal_remove_fs(device); | ||
1386 | unregister_thermal_zone: | 1399 | unregister_thermal_zone: |
1387 | thermal_zone_device_unregister(tz->thermal_zone); | 1400 | thermal_zone_device_unregister(tz->thermal_zone); |
1388 | free_memory: | 1401 | free_memory: |
@@ -1393,7 +1406,6 @@ end: | |||
1393 | 1406 | ||
1394 | static int acpi_thermal_remove(struct acpi_device *device, int type) | 1407 | static int acpi_thermal_remove(struct acpi_device *device, int type) |
1395 | { | 1408 | { |
1396 | acpi_status status = AE_OK; | ||
1397 | struct acpi_thermal *tz = NULL; | 1409 | struct acpi_thermal *tz = NULL; |
1398 | 1410 | ||
1399 | if (!device || !acpi_driver_data(device)) | 1411 | if (!device || !acpi_driver_data(device)) |
@@ -1401,10 +1413,6 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1401 | 1413 | ||
1402 | tz = acpi_driver_data(device); | 1414 | tz = acpi_driver_data(device); |
1403 | 1415 | ||
1404 | status = acpi_remove_notify_handler(device->handle, | ||
1405 | ACPI_DEVICE_NOTIFY, | ||
1406 | acpi_thermal_notify); | ||
1407 | |||
1408 | acpi_thermal_remove_fs(device); | 1416 | acpi_thermal_remove_fs(device); |
1409 | acpi_thermal_unregister_thermal_zone(tz); | 1417 | acpi_thermal_unregister_thermal_zone(tz); |
1410 | mutex_destroy(&tz->lock); | 1418 | mutex_destroy(&tz->lock); |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index ab06143672bc..cd4fb7543a90 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -79,6 +79,7 @@ module_param(brightness_switch_enabled, bool, 0644); | |||
79 | static int acpi_video_bus_add(struct acpi_device *device); | 79 | static int acpi_video_bus_add(struct acpi_device *device); |
80 | static int acpi_video_bus_remove(struct acpi_device *device, int type); | 80 | static int acpi_video_bus_remove(struct acpi_device *device, int type); |
81 | static int acpi_video_resume(struct acpi_device *device); | 81 | static int acpi_video_resume(struct acpi_device *device); |
82 | static void acpi_video_bus_notify(struct acpi_device *device, u32 event); | ||
82 | 83 | ||
83 | static const struct acpi_device_id video_device_ids[] = { | 84 | static const struct acpi_device_id video_device_ids[] = { |
84 | {ACPI_VIDEO_HID, 0}, | 85 | {ACPI_VIDEO_HID, 0}, |
@@ -94,6 +95,7 @@ static struct acpi_driver acpi_video_bus = { | |||
94 | .add = acpi_video_bus_add, | 95 | .add = acpi_video_bus_add, |
95 | .remove = acpi_video_bus_remove, | 96 | .remove = acpi_video_bus_remove, |
96 | .resume = acpi_video_resume, | 97 | .resume = acpi_video_resume, |
98 | .notify = acpi_video_bus_notify, | ||
97 | }, | 99 | }, |
98 | }; | 100 | }; |
99 | 101 | ||
@@ -1986,17 +1988,15 @@ static int acpi_video_bus_stop_devices(struct acpi_video_bus *video) | |||
1986 | return acpi_video_bus_DOS(video, 0, 1); | 1988 | return acpi_video_bus_DOS(video, 0, 1); |
1987 | } | 1989 | } |
1988 | 1990 | ||
1989 | static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) | 1991 | static void acpi_video_bus_notify(struct acpi_device *device, u32 event) |
1990 | { | 1992 | { |
1991 | struct acpi_video_bus *video = data; | 1993 | struct acpi_video_bus *video = acpi_driver_data(device); |
1992 | struct acpi_device *device = NULL; | ||
1993 | struct input_dev *input; | 1994 | struct input_dev *input; |
1994 | int keycode; | 1995 | int keycode; |
1995 | 1996 | ||
1996 | if (!video) | 1997 | if (!video) |
1997 | return; | 1998 | return; |
1998 | 1999 | ||
1999 | device = video->device; | ||
2000 | input = video->input; | 2000 | input = video->input; |
2001 | 2001 | ||
2002 | switch (event) { | 2002 | switch (event) { |
@@ -2127,7 +2127,6 @@ static int acpi_video_resume(struct acpi_device *device) | |||
2127 | 2127 | ||
2128 | static int acpi_video_bus_add(struct acpi_device *device) | 2128 | static int acpi_video_bus_add(struct acpi_device *device) |
2129 | { | 2129 | { |
2130 | acpi_status status; | ||
2131 | struct acpi_video_bus *video; | 2130 | struct acpi_video_bus *video; |
2132 | struct input_dev *input; | 2131 | struct input_dev *input; |
2133 | int error; | 2132 | int error; |
@@ -2169,20 +2168,10 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
2169 | acpi_video_bus_get_devices(video, device); | 2168 | acpi_video_bus_get_devices(video, device); |
2170 | acpi_video_bus_start_devices(video); | 2169 | acpi_video_bus_start_devices(video); |
2171 | 2170 | ||
2172 | status = acpi_install_notify_handler(device->handle, | ||
2173 | ACPI_DEVICE_NOTIFY, | ||
2174 | acpi_video_bus_notify, video); | ||
2175 | if (ACPI_FAILURE(status)) { | ||
2176 | printk(KERN_ERR PREFIX | ||
2177 | "Error installing notify handler\n"); | ||
2178 | error = -ENODEV; | ||
2179 | goto err_stop_video; | ||
2180 | } | ||
2181 | |||
2182 | video->input = input = input_allocate_device(); | 2171 | video->input = input = input_allocate_device(); |
2183 | if (!input) { | 2172 | if (!input) { |
2184 | error = -ENOMEM; | 2173 | error = -ENOMEM; |
2185 | goto err_uninstall_notify; | 2174 | goto err_stop_video; |
2186 | } | 2175 | } |
2187 | 2176 | ||
2188 | snprintf(video->phys, sizeof(video->phys), | 2177 | snprintf(video->phys, sizeof(video->phys), |
@@ -2218,9 +2207,6 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
2218 | 2207 | ||
2219 | err_free_input_dev: | 2208 | err_free_input_dev: |
2220 | input_free_device(input); | 2209 | input_free_device(input); |
2221 | err_uninstall_notify: | ||
2222 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, | ||
2223 | acpi_video_bus_notify); | ||
2224 | err_stop_video: | 2210 | err_stop_video: |
2225 | acpi_video_bus_stop_devices(video); | 2211 | acpi_video_bus_stop_devices(video); |
2226 | acpi_video_bus_put_devices(video); | 2212 | acpi_video_bus_put_devices(video); |
@@ -2235,7 +2221,6 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
2235 | 2221 | ||
2236 | static int acpi_video_bus_remove(struct acpi_device *device, int type) | 2222 | static int acpi_video_bus_remove(struct acpi_device *device, int type) |
2237 | { | 2223 | { |
2238 | acpi_status status = 0; | ||
2239 | struct acpi_video_bus *video = NULL; | 2224 | struct acpi_video_bus *video = NULL; |
2240 | 2225 | ||
2241 | 2226 | ||
@@ -2245,11 +2230,6 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) | |||
2245 | video = acpi_driver_data(device); | 2230 | video = acpi_driver_data(device); |
2246 | 2231 | ||
2247 | acpi_video_bus_stop_devices(video); | 2232 | acpi_video_bus_stop_devices(video); |
2248 | |||
2249 | status = acpi_remove_notify_handler(video->device->handle, | ||
2250 | ACPI_DEVICE_NOTIFY, | ||
2251 | acpi_video_bus_notify); | ||
2252 | |||
2253 | acpi_video_bus_put_devices(video); | 2233 | acpi_video_bus_put_devices(video); |
2254 | acpi_video_bus_remove_fs(device); | 2234 | acpi_video_bus_remove_fs(device); |
2255 | 2235 | ||
diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c index 5aee8c26cc9f..88725dcdf8bc 100644 --- a/drivers/acpi/wakeup.c +++ b/drivers/acpi/wakeup.c | |||
@@ -12,12 +12,14 @@ | |||
12 | #include "internal.h" | 12 | #include "internal.h" |
13 | #include "sleep.h" | 13 | #include "sleep.h" |
14 | 14 | ||
15 | /* | ||
16 | * We didn't lock acpi_device_lock in the file, because it invokes oops in | ||
17 | * suspend/resume and isn't really required as this is called in S-state. At | ||
18 | * that time, there is no device hotplug | ||
19 | **/ | ||
15 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 20 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
16 | ACPI_MODULE_NAME("wakeup_devices") | 21 | ACPI_MODULE_NAME("wakeup_devices") |
17 | 22 | ||
18 | extern struct list_head acpi_wakeup_device_list; | ||
19 | extern spinlock_t acpi_device_lock; | ||
20 | |||
21 | /** | 23 | /** |
22 | * acpi_enable_wakeup_device_prep - prepare wakeup devices | 24 | * acpi_enable_wakeup_device_prep - prepare wakeup devices |
23 | * @sleep_state: ACPI state | 25 | * @sleep_state: ACPI state |
@@ -29,7 +31,6 @@ void acpi_enable_wakeup_device_prep(u8 sleep_state) | |||
29 | { | 31 | { |
30 | struct list_head *node, *next; | 32 | struct list_head *node, *next; |
31 | 33 | ||
32 | spin_lock(&acpi_device_lock); | ||
33 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 34 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
34 | struct acpi_device *dev = container_of(node, | 35 | struct acpi_device *dev = container_of(node, |
35 | struct acpi_device, | 36 | struct acpi_device, |
@@ -40,11 +41,8 @@ void acpi_enable_wakeup_device_prep(u8 sleep_state) | |||
40 | (sleep_state > (u32) dev->wakeup.sleep_state)) | 41 | (sleep_state > (u32) dev->wakeup.sleep_state)) |
41 | continue; | 42 | continue; |
42 | 43 | ||
43 | spin_unlock(&acpi_device_lock); | ||
44 | acpi_enable_wakeup_device_power(dev, sleep_state); | 44 | acpi_enable_wakeup_device_power(dev, sleep_state); |
45 | spin_lock(&acpi_device_lock); | ||
46 | } | 45 | } |
47 | spin_unlock(&acpi_device_lock); | ||
48 | } | 46 | } |
49 | 47 | ||
50 | /** | 48 | /** |
@@ -60,7 +58,6 @@ void acpi_enable_wakeup_device(u8 sleep_state) | |||
60 | * Caution: this routine must be invoked when interrupt is disabled | 58 | * Caution: this routine must be invoked when interrupt is disabled |
61 | * Refer ACPI2.0: P212 | 59 | * Refer ACPI2.0: P212 |
62 | */ | 60 | */ |
63 | spin_lock(&acpi_device_lock); | ||
64 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 61 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
65 | struct acpi_device *dev = | 62 | struct acpi_device *dev = |
66 | container_of(node, struct acpi_device, wakeup_list); | 63 | container_of(node, struct acpi_device, wakeup_list); |
@@ -74,22 +71,17 @@ void acpi_enable_wakeup_device(u8 sleep_state) | |||
74 | if ((!dev->wakeup.state.enabled && !dev->wakeup.flags.prepared) | 71 | if ((!dev->wakeup.state.enabled && !dev->wakeup.flags.prepared) |
75 | || sleep_state > (u32) dev->wakeup.sleep_state) { | 72 | || sleep_state > (u32) dev->wakeup.sleep_state) { |
76 | if (dev->wakeup.flags.run_wake) { | 73 | if (dev->wakeup.flags.run_wake) { |
77 | spin_unlock(&acpi_device_lock); | ||
78 | /* set_gpe_type will disable GPE, leave it like that */ | 74 | /* set_gpe_type will disable GPE, leave it like that */ |
79 | acpi_set_gpe_type(dev->wakeup.gpe_device, | 75 | acpi_set_gpe_type(dev->wakeup.gpe_device, |
80 | dev->wakeup.gpe_number, | 76 | dev->wakeup.gpe_number, |
81 | ACPI_GPE_TYPE_RUNTIME); | 77 | ACPI_GPE_TYPE_RUNTIME); |
82 | spin_lock(&acpi_device_lock); | ||
83 | } | 78 | } |
84 | continue; | 79 | continue; |
85 | } | 80 | } |
86 | spin_unlock(&acpi_device_lock); | ||
87 | if (!dev->wakeup.flags.run_wake) | 81 | if (!dev->wakeup.flags.run_wake) |
88 | acpi_enable_gpe(dev->wakeup.gpe_device, | 82 | acpi_enable_gpe(dev->wakeup.gpe_device, |
89 | dev->wakeup.gpe_number); | 83 | dev->wakeup.gpe_number); |
90 | spin_lock(&acpi_device_lock); | ||
91 | } | 84 | } |
92 | spin_unlock(&acpi_device_lock); | ||
93 | } | 85 | } |
94 | 86 | ||
95 | /** | 87 | /** |
@@ -101,7 +93,6 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
101 | { | 93 | { |
102 | struct list_head *node, *next; | 94 | struct list_head *node, *next; |
103 | 95 | ||
104 | spin_lock(&acpi_device_lock); | ||
105 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 96 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
106 | struct acpi_device *dev = | 97 | struct acpi_device *dev = |
107 | container_of(node, struct acpi_device, wakeup_list); | 98 | container_of(node, struct acpi_device, wakeup_list); |
@@ -112,19 +103,16 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
112 | if ((!dev->wakeup.state.enabled && !dev->wakeup.flags.prepared) | 103 | if ((!dev->wakeup.state.enabled && !dev->wakeup.flags.prepared) |
113 | || sleep_state > (u32) dev->wakeup.sleep_state) { | 104 | || sleep_state > (u32) dev->wakeup.sleep_state) { |
114 | if (dev->wakeup.flags.run_wake) { | 105 | if (dev->wakeup.flags.run_wake) { |
115 | spin_unlock(&acpi_device_lock); | ||
116 | acpi_set_gpe_type(dev->wakeup.gpe_device, | 106 | acpi_set_gpe_type(dev->wakeup.gpe_device, |
117 | dev->wakeup.gpe_number, | 107 | dev->wakeup.gpe_number, |
118 | ACPI_GPE_TYPE_WAKE_RUN); | 108 | ACPI_GPE_TYPE_WAKE_RUN); |
119 | /* Re-enable it, since set_gpe_type will disable it */ | 109 | /* Re-enable it, since set_gpe_type will disable it */ |
120 | acpi_enable_gpe(dev->wakeup.gpe_device, | 110 | acpi_enable_gpe(dev->wakeup.gpe_device, |
121 | dev->wakeup.gpe_number); | 111 | dev->wakeup.gpe_number); |
122 | spin_lock(&acpi_device_lock); | ||
123 | } | 112 | } |
124 | continue; | 113 | continue; |
125 | } | 114 | } |
126 | 115 | ||
127 | spin_unlock(&acpi_device_lock); | ||
128 | acpi_disable_wakeup_device_power(dev); | 116 | acpi_disable_wakeup_device_power(dev); |
129 | /* Never disable run-wake GPE */ | 117 | /* Never disable run-wake GPE */ |
130 | if (!dev->wakeup.flags.run_wake) { | 118 | if (!dev->wakeup.flags.run_wake) { |
@@ -133,16 +121,14 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
133 | acpi_clear_gpe(dev->wakeup.gpe_device, | 121 | acpi_clear_gpe(dev->wakeup.gpe_device, |
134 | dev->wakeup.gpe_number, ACPI_NOT_ISR); | 122 | dev->wakeup.gpe_number, ACPI_NOT_ISR); |
135 | } | 123 | } |
136 | spin_lock(&acpi_device_lock); | ||
137 | } | 124 | } |
138 | spin_unlock(&acpi_device_lock); | ||
139 | } | 125 | } |
140 | 126 | ||
141 | int __init acpi_wakeup_device_init(void) | 127 | int __init acpi_wakeup_device_init(void) |
142 | { | 128 | { |
143 | struct list_head *node, *next; | 129 | struct list_head *node, *next; |
144 | 130 | ||
145 | spin_lock(&acpi_device_lock); | 131 | mutex_lock(&acpi_device_lock); |
146 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 132 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
147 | struct acpi_device *dev = container_of(node, | 133 | struct acpi_device *dev = container_of(node, |
148 | struct acpi_device, | 134 | struct acpi_device, |
@@ -150,15 +136,13 @@ int __init acpi_wakeup_device_init(void) | |||
150 | /* In case user doesn't load button driver */ | 136 | /* In case user doesn't load button driver */ |
151 | if (!dev->wakeup.flags.run_wake || dev->wakeup.state.enabled) | 137 | if (!dev->wakeup.flags.run_wake || dev->wakeup.state.enabled) |
152 | continue; | 138 | continue; |
153 | spin_unlock(&acpi_device_lock); | ||
154 | acpi_set_gpe_type(dev->wakeup.gpe_device, | 139 | acpi_set_gpe_type(dev->wakeup.gpe_device, |
155 | dev->wakeup.gpe_number, | 140 | dev->wakeup.gpe_number, |
156 | ACPI_GPE_TYPE_WAKE_RUN); | 141 | ACPI_GPE_TYPE_WAKE_RUN); |
157 | acpi_enable_gpe(dev->wakeup.gpe_device, | 142 | acpi_enable_gpe(dev->wakeup.gpe_device, |
158 | dev->wakeup.gpe_number); | 143 | dev->wakeup.gpe_number); |
159 | dev->wakeup.state.enabled = 1; | 144 | dev->wakeup.state.enabled = 1; |
160 | spin_lock(&acpi_device_lock); | ||
161 | } | 145 | } |
162 | spin_unlock(&acpi_device_lock); | 146 | mutex_unlock(&acpi_device_lock); |
163 | return 0; | 147 | return 0; |
164 | } | 148 | } |
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 45940f31fe9e..218b9a16ac3f 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
@@ -174,8 +174,7 @@ struct fujitsu_hotkey_t { | |||
174 | 174 | ||
175 | static struct fujitsu_hotkey_t *fujitsu_hotkey; | 175 | static struct fujitsu_hotkey_t *fujitsu_hotkey; |
176 | 176 | ||
177 | static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, | 177 | static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event); |
178 | void *data); | ||
179 | 178 | ||
180 | #ifdef CONFIG_LEDS_CLASS | 179 | #ifdef CONFIG_LEDS_CLASS |
181 | static enum led_brightness logolamp_get(struct led_classdev *cdev); | 180 | static enum led_brightness logolamp_get(struct led_classdev *cdev); |
@@ -203,7 +202,7 @@ struct led_classdev kblamps_led = { | |||
203 | static u32 dbg_level = 0x03; | 202 | static u32 dbg_level = 0x03; |
204 | #endif | 203 | #endif |
205 | 204 | ||
206 | static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data); | 205 | static void acpi_fujitsu_notify(struct acpi_device *device, u32 event); |
207 | 206 | ||
208 | /* Fujitsu ACPI interface function */ | 207 | /* Fujitsu ACPI interface function */ |
209 | 208 | ||
@@ -658,7 +657,6 @@ static struct dmi_system_id fujitsu_dmi_table[] = { | |||
658 | 657 | ||
659 | static int acpi_fujitsu_add(struct acpi_device *device) | 658 | static int acpi_fujitsu_add(struct acpi_device *device) |
660 | { | 659 | { |
661 | acpi_status status; | ||
662 | acpi_handle handle; | 660 | acpi_handle handle; |
663 | int result = 0; | 661 | int result = 0; |
664 | int state = 0; | 662 | int state = 0; |
@@ -673,20 +671,10 @@ static int acpi_fujitsu_add(struct acpi_device *device) | |||
673 | sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS); | 671 | sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS); |
674 | device->driver_data = fujitsu; | 672 | device->driver_data = fujitsu; |
675 | 673 | ||
676 | status = acpi_install_notify_handler(device->handle, | ||
677 | ACPI_DEVICE_NOTIFY, | ||
678 | acpi_fujitsu_notify, fujitsu); | ||
679 | |||
680 | if (ACPI_FAILURE(status)) { | ||
681 | printk(KERN_ERR "Error installing notify handler\n"); | ||
682 | error = -ENODEV; | ||
683 | goto err_stop; | ||
684 | } | ||
685 | |||
686 | fujitsu->input = input = input_allocate_device(); | 674 | fujitsu->input = input = input_allocate_device(); |
687 | if (!input) { | 675 | if (!input) { |
688 | error = -ENOMEM; | 676 | error = -ENOMEM; |
689 | goto err_uninstall_notify; | 677 | goto err_stop; |
690 | } | 678 | } |
691 | 679 | ||
692 | snprintf(fujitsu->phys, sizeof(fujitsu->phys), | 680 | snprintf(fujitsu->phys, sizeof(fujitsu->phys), |
@@ -743,9 +731,6 @@ static int acpi_fujitsu_add(struct acpi_device *device) | |||
743 | end: | 731 | end: |
744 | err_free_input_dev: | 732 | err_free_input_dev: |
745 | input_free_device(input); | 733 | input_free_device(input); |
746 | err_uninstall_notify: | ||
747 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, | ||
748 | acpi_fujitsu_notify); | ||
749 | err_stop: | 734 | err_stop: |
750 | 735 | ||
751 | return result; | 736 | return result; |
@@ -753,7 +738,6 @@ err_stop: | |||
753 | 738 | ||
754 | static int acpi_fujitsu_remove(struct acpi_device *device, int type) | 739 | static int acpi_fujitsu_remove(struct acpi_device *device, int type) |
755 | { | 740 | { |
756 | acpi_status status; | ||
757 | struct fujitsu_t *fujitsu = NULL; | 741 | struct fujitsu_t *fujitsu = NULL; |
758 | 742 | ||
759 | if (!device || !acpi_driver_data(device)) | 743 | if (!device || !acpi_driver_data(device)) |
@@ -761,10 +745,6 @@ static int acpi_fujitsu_remove(struct acpi_device *device, int type) | |||
761 | 745 | ||
762 | fujitsu = acpi_driver_data(device); | 746 | fujitsu = acpi_driver_data(device); |
763 | 747 | ||
764 | status = acpi_remove_notify_handler(fujitsu->acpi_handle, | ||
765 | ACPI_DEVICE_NOTIFY, | ||
766 | acpi_fujitsu_notify); | ||
767 | |||
768 | if (!device || !acpi_driver_data(device)) | 748 | if (!device || !acpi_driver_data(device)) |
769 | return -EINVAL; | 749 | return -EINVAL; |
770 | 750 | ||
@@ -775,7 +755,7 @@ static int acpi_fujitsu_remove(struct acpi_device *device, int type) | |||
775 | 755 | ||
776 | /* Brightness notify */ | 756 | /* Brightness notify */ |
777 | 757 | ||
778 | static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data) | 758 | static void acpi_fujitsu_notify(struct acpi_device *device, u32 event) |
779 | { | 759 | { |
780 | struct input_dev *input; | 760 | struct input_dev *input; |
781 | int keycode; | 761 | int keycode; |
@@ -829,15 +809,12 @@ static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data) | |||
829 | input_report_key(input, keycode, 0); | 809 | input_report_key(input, keycode, 0); |
830 | input_sync(input); | 810 | input_sync(input); |
831 | } | 811 | } |
832 | |||
833 | return; | ||
834 | } | 812 | } |
835 | 813 | ||
836 | /* ACPI device for hotkey handling */ | 814 | /* ACPI device for hotkey handling */ |
837 | 815 | ||
838 | static int acpi_fujitsu_hotkey_add(struct acpi_device *device) | 816 | static int acpi_fujitsu_hotkey_add(struct acpi_device *device) |
839 | { | 817 | { |
840 | acpi_status status; | ||
841 | acpi_handle handle; | 818 | acpi_handle handle; |
842 | int result = 0; | 819 | int result = 0; |
843 | int state = 0; | 820 | int state = 0; |
@@ -854,17 +831,6 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) | |||
854 | sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS); | 831 | sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS); |
855 | device->driver_data = fujitsu_hotkey; | 832 | device->driver_data = fujitsu_hotkey; |
856 | 833 | ||
857 | status = acpi_install_notify_handler(device->handle, | ||
858 | ACPI_DEVICE_NOTIFY, | ||
859 | acpi_fujitsu_hotkey_notify, | ||
860 | fujitsu_hotkey); | ||
861 | |||
862 | if (ACPI_FAILURE(status)) { | ||
863 | printk(KERN_ERR "Error installing notify handler\n"); | ||
864 | error = -ENODEV; | ||
865 | goto err_stop; | ||
866 | } | ||
867 | |||
868 | /* kfifo */ | 834 | /* kfifo */ |
869 | spin_lock_init(&fujitsu_hotkey->fifo_lock); | 835 | spin_lock_init(&fujitsu_hotkey->fifo_lock); |
870 | fujitsu_hotkey->fifo = | 836 | fujitsu_hotkey->fifo = |
@@ -879,7 +845,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) | |||
879 | fujitsu_hotkey->input = input = input_allocate_device(); | 845 | fujitsu_hotkey->input = input = input_allocate_device(); |
880 | if (!input) { | 846 | if (!input) { |
881 | error = -ENOMEM; | 847 | error = -ENOMEM; |
882 | goto err_uninstall_notify; | 848 | goto err_free_fifo; |
883 | } | 849 | } |
884 | 850 | ||
885 | snprintf(fujitsu_hotkey->phys, sizeof(fujitsu_hotkey->phys), | 851 | snprintf(fujitsu_hotkey->phys, sizeof(fujitsu_hotkey->phys), |
@@ -975,9 +941,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) | |||
975 | end: | 941 | end: |
976 | err_free_input_dev: | 942 | err_free_input_dev: |
977 | input_free_device(input); | 943 | input_free_device(input); |
978 | err_uninstall_notify: | 944 | err_free_fifo: |
979 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, | ||
980 | acpi_fujitsu_hotkey_notify); | ||
981 | kfifo_free(fujitsu_hotkey->fifo); | 945 | kfifo_free(fujitsu_hotkey->fifo); |
982 | err_stop: | 946 | err_stop: |
983 | 947 | ||
@@ -986,7 +950,6 @@ err_stop: | |||
986 | 950 | ||
987 | static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) | 951 | static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) |
988 | { | 952 | { |
989 | acpi_status status; | ||
990 | struct fujitsu_hotkey_t *fujitsu_hotkey = NULL; | 953 | struct fujitsu_hotkey_t *fujitsu_hotkey = NULL; |
991 | 954 | ||
992 | if (!device || !acpi_driver_data(device)) | 955 | if (!device || !acpi_driver_data(device)) |
@@ -994,10 +957,6 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) | |||
994 | 957 | ||
995 | fujitsu_hotkey = acpi_driver_data(device); | 958 | fujitsu_hotkey = acpi_driver_data(device); |
996 | 959 | ||
997 | status = acpi_remove_notify_handler(fujitsu_hotkey->acpi_handle, | ||
998 | ACPI_DEVICE_NOTIFY, | ||
999 | acpi_fujitsu_hotkey_notify); | ||
1000 | |||
1001 | fujitsu_hotkey->acpi_handle = NULL; | 960 | fujitsu_hotkey->acpi_handle = NULL; |
1002 | 961 | ||
1003 | kfifo_free(fujitsu_hotkey->fifo); | 962 | kfifo_free(fujitsu_hotkey->fifo); |
@@ -1005,8 +964,7 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) | |||
1005 | return 0; | 964 | return 0; |
1006 | } | 965 | } |
1007 | 966 | ||
1008 | static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, | 967 | static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) |
1009 | void *data) | ||
1010 | { | 968 | { |
1011 | struct input_dev *input; | 969 | struct input_dev *input; |
1012 | int keycode, keycode_r; | 970 | int keycode, keycode_r; |
@@ -1089,8 +1047,6 @@ static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, | |||
1089 | input_sync(input); | 1047 | input_sync(input); |
1090 | break; | 1048 | break; |
1091 | } | 1049 | } |
1092 | |||
1093 | return; | ||
1094 | } | 1050 | } |
1095 | 1051 | ||
1096 | /* Initialization */ | 1052 | /* Initialization */ |
@@ -1107,6 +1063,7 @@ static struct acpi_driver acpi_fujitsu_driver = { | |||
1107 | .ops = { | 1063 | .ops = { |
1108 | .add = acpi_fujitsu_add, | 1064 | .add = acpi_fujitsu_add, |
1109 | .remove = acpi_fujitsu_remove, | 1065 | .remove = acpi_fujitsu_remove, |
1066 | .notify = acpi_fujitsu_notify, | ||
1110 | }, | 1067 | }, |
1111 | }; | 1068 | }; |
1112 | 1069 | ||
@@ -1122,6 +1079,7 @@ static struct acpi_driver acpi_fujitsu_hotkey_driver = { | |||
1122 | .ops = { | 1079 | .ops = { |
1123 | .add = acpi_fujitsu_hotkey_add, | 1080 | .add = acpi_fujitsu_hotkey_add, |
1124 | .remove = acpi_fujitsu_hotkey_remove, | 1081 | .remove = acpi_fujitsu_hotkey_remove, |
1082 | .notify = acpi_fujitsu_hotkey_notify, | ||
1125 | }, | 1083 | }, |
1126 | }; | 1084 | }; |
1127 | 1085 | ||
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index a5ce4bc202e3..fe7cf0188acc 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c | |||
@@ -176,6 +176,7 @@ enum SINF_BITS { SINF_NUM_BATTERIES = 0, | |||
176 | static int acpi_pcc_hotkey_add(struct acpi_device *device); | 176 | static int acpi_pcc_hotkey_add(struct acpi_device *device); |
177 | static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type); | 177 | static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type); |
178 | static int acpi_pcc_hotkey_resume(struct acpi_device *device); | 178 | static int acpi_pcc_hotkey_resume(struct acpi_device *device); |
179 | static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event); | ||
179 | 180 | ||
180 | static const struct acpi_device_id pcc_device_ids[] = { | 181 | static const struct acpi_device_id pcc_device_ids[] = { |
181 | { "MAT0012", 0}, | 182 | { "MAT0012", 0}, |
@@ -194,6 +195,7 @@ static struct acpi_driver acpi_pcc_driver = { | |||
194 | .add = acpi_pcc_hotkey_add, | 195 | .add = acpi_pcc_hotkey_add, |
195 | .remove = acpi_pcc_hotkey_remove, | 196 | .remove = acpi_pcc_hotkey_remove, |
196 | .resume = acpi_pcc_hotkey_resume, | 197 | .resume = acpi_pcc_hotkey_resume, |
198 | .notify = acpi_pcc_hotkey_notify, | ||
197 | }, | 199 | }, |
198 | }; | 200 | }; |
199 | 201 | ||
@@ -271,7 +273,7 @@ static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc, u32 *sinf) | |||
271 | union acpi_object *hkey = NULL; | 273 | union acpi_object *hkey = NULL; |
272 | int i; | 274 | int i; |
273 | 275 | ||
274 | status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, 0, | 276 | status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, NULL, |
275 | &buffer); | 277 | &buffer); |
276 | if (ACPI_FAILURE(status)) { | 278 | if (ACPI_FAILURE(status)) { |
277 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 279 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -527,9 +529,9 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc) | |||
527 | return; | 529 | return; |
528 | } | 530 | } |
529 | 531 | ||
530 | static void acpi_pcc_hotkey_notify(acpi_handle handle, u32 event, void *data) | 532 | static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event) |
531 | { | 533 | { |
532 | struct pcc_acpi *pcc = (struct pcc_acpi *) data; | 534 | struct pcc_acpi *pcc = acpi_driver_data(device); |
533 | 535 | ||
534 | switch (event) { | 536 | switch (event) { |
535 | case HKEY_NOTIFY: | 537 | case HKEY_NOTIFY: |
@@ -599,7 +601,6 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device) | |||
599 | 601 | ||
600 | static int acpi_pcc_hotkey_add(struct acpi_device *device) | 602 | static int acpi_pcc_hotkey_add(struct acpi_device *device) |
601 | { | 603 | { |
602 | acpi_status status; | ||
603 | struct pcc_acpi *pcc; | 604 | struct pcc_acpi *pcc; |
604 | int num_sifr, result; | 605 | int num_sifr, result; |
605 | 606 | ||
@@ -640,22 +641,11 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) | |||
640 | goto out_sinf; | 641 | goto out_sinf; |
641 | } | 642 | } |
642 | 643 | ||
643 | /* initialize hotkey input device */ | ||
644 | status = acpi_install_notify_handler(pcc->handle, ACPI_DEVICE_NOTIFY, | ||
645 | acpi_pcc_hotkey_notify, pcc); | ||
646 | |||
647 | if (ACPI_FAILURE(status)) { | ||
648 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
649 | "Error installing notify handler\n")); | ||
650 | result = -ENODEV; | ||
651 | goto out_input; | ||
652 | } | ||
653 | |||
654 | /* initialize backlight */ | 644 | /* initialize backlight */ |
655 | pcc->backlight = backlight_device_register("panasonic", NULL, pcc, | 645 | pcc->backlight = backlight_device_register("panasonic", NULL, pcc, |
656 | &pcc_backlight_ops); | 646 | &pcc_backlight_ops); |
657 | if (IS_ERR(pcc->backlight)) | 647 | if (IS_ERR(pcc->backlight)) |
658 | goto out_notify; | 648 | goto out_input; |
659 | 649 | ||
660 | if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { | 650 | if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { |
661 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 651 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -680,9 +670,6 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) | |||
680 | 670 | ||
681 | out_backlight: | 671 | out_backlight: |
682 | backlight_device_unregister(pcc->backlight); | 672 | backlight_device_unregister(pcc->backlight); |
683 | out_notify: | ||
684 | acpi_remove_notify_handler(pcc->handle, ACPI_DEVICE_NOTIFY, | ||
685 | acpi_pcc_hotkey_notify); | ||
686 | out_input: | 673 | out_input: |
687 | input_unregister_device(pcc->input_dev); | 674 | input_unregister_device(pcc->input_dev); |
688 | /* no need to input_free_device() since core input API refcount and | 675 | /* no need to input_free_device() since core input API refcount and |
@@ -723,9 +710,6 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type) | |||
723 | 710 | ||
724 | backlight_device_unregister(pcc->backlight); | 711 | backlight_device_unregister(pcc->backlight); |
725 | 712 | ||
726 | acpi_remove_notify_handler(pcc->handle, ACPI_DEVICE_NOTIFY, | ||
727 | acpi_pcc_hotkey_notify); | ||
728 | |||
729 | input_unregister_device(pcc->input_dev); | 713 | input_unregister_device(pcc->input_dev); |
730 | /* no need to input_free_device() since core input API refcount and | 714 | /* no need to input_free_device() since core input API refcount and |
731 | * free()s the device */ | 715 | * free()s the device */ |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index a90ec5cb2f20..d3c92d777bde 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -914,7 +914,7 @@ static struct sony_nc_event sony_127_events[] = { | |||
914 | /* | 914 | /* |
915 | * ACPI callbacks | 915 | * ACPI callbacks |
916 | */ | 916 | */ |
917 | static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) | 917 | static void sony_nc_notify(struct acpi_device *device, u32 event) |
918 | { | 918 | { |
919 | u32 ev = event; | 919 | u32 ev = event; |
920 | 920 | ||
@@ -933,7 +933,7 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) | |||
933 | struct sony_nc_event *key_event; | 933 | struct sony_nc_event *key_event; |
934 | 934 | ||
935 | if (sony_call_snc_handle(key_handle, 0x200, &result)) { | 935 | if (sony_call_snc_handle(key_handle, 0x200, &result)) { |
936 | dprintk("sony_acpi_notify, unable to decode" | 936 | dprintk("sony_nc_notify, unable to decode" |
937 | " event 0x%.2x 0x%.2x\n", key_handle, | 937 | " event 0x%.2x 0x%.2x\n", key_handle, |
938 | ev); | 938 | ev); |
939 | /* restore the original event */ | 939 | /* restore the original event */ |
@@ -968,7 +968,7 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) | |||
968 | } else | 968 | } else |
969 | sony_laptop_report_input_event(ev); | 969 | sony_laptop_report_input_event(ev); |
970 | 970 | ||
971 | dprintk("sony_acpi_notify, event: 0x%.2x\n", ev); | 971 | dprintk("sony_nc_notify, event: 0x%.2x\n", ev); |
972 | acpi_bus_generate_proc_event(sony_nc_acpi_device, 1, ev); | 972 | acpi_bus_generate_proc_event(sony_nc_acpi_device, 1, ev); |
973 | } | 973 | } |
974 | 974 | ||
@@ -1276,15 +1276,6 @@ static int sony_nc_add(struct acpi_device *device) | |||
1276 | goto outwalk; | 1276 | goto outwalk; |
1277 | } | 1277 | } |
1278 | 1278 | ||
1279 | status = acpi_install_notify_handler(sony_nc_acpi_handle, | ||
1280 | ACPI_DEVICE_NOTIFY, | ||
1281 | sony_acpi_notify, NULL); | ||
1282 | if (ACPI_FAILURE(status)) { | ||
1283 | printk(KERN_WARNING DRV_PFX "unable to install notify handler (%u)\n", status); | ||
1284 | result = -ENODEV; | ||
1285 | goto outinput; | ||
1286 | } | ||
1287 | |||
1288 | if (acpi_video_backlight_support()) { | 1279 | if (acpi_video_backlight_support()) { |
1289 | printk(KERN_INFO DRV_PFX "brightness ignored, must be " | 1280 | printk(KERN_INFO DRV_PFX "brightness ignored, must be " |
1290 | "controlled by ACPI video driver\n"); | 1281 | "controlled by ACPI video driver\n"); |
@@ -1362,13 +1353,6 @@ static int sony_nc_add(struct acpi_device *device) | |||
1362 | if (sony_backlight_device) | 1353 | if (sony_backlight_device) |
1363 | backlight_device_unregister(sony_backlight_device); | 1354 | backlight_device_unregister(sony_backlight_device); |
1364 | 1355 | ||
1365 | status = acpi_remove_notify_handler(sony_nc_acpi_handle, | ||
1366 | ACPI_DEVICE_NOTIFY, | ||
1367 | sony_acpi_notify); | ||
1368 | if (ACPI_FAILURE(status)) | ||
1369 | printk(KERN_WARNING DRV_PFX "unable to remove notify handler\n"); | ||
1370 | |||
1371 | outinput: | ||
1372 | sony_laptop_remove_input(); | 1356 | sony_laptop_remove_input(); |
1373 | 1357 | ||
1374 | outwalk: | 1358 | outwalk: |
@@ -1378,7 +1362,6 @@ static int sony_nc_add(struct acpi_device *device) | |||
1378 | 1362 | ||
1379 | static int sony_nc_remove(struct acpi_device *device, int type) | 1363 | static int sony_nc_remove(struct acpi_device *device, int type) |
1380 | { | 1364 | { |
1381 | acpi_status status; | ||
1382 | struct sony_nc_value *item; | 1365 | struct sony_nc_value *item; |
1383 | 1366 | ||
1384 | if (sony_backlight_device) | 1367 | if (sony_backlight_device) |
@@ -1386,12 +1369,6 @@ static int sony_nc_remove(struct acpi_device *device, int type) | |||
1386 | 1369 | ||
1387 | sony_nc_acpi_device = NULL; | 1370 | sony_nc_acpi_device = NULL; |
1388 | 1371 | ||
1389 | status = acpi_remove_notify_handler(sony_nc_acpi_handle, | ||
1390 | ACPI_DEVICE_NOTIFY, | ||
1391 | sony_acpi_notify); | ||
1392 | if (ACPI_FAILURE(status)) | ||
1393 | printk(KERN_WARNING DRV_PFX "unable to remove notify handler\n"); | ||
1394 | |||
1395 | for (item = sony_nc_values; item->name; ++item) { | 1372 | for (item = sony_nc_values; item->name; ++item) { |
1396 | device_remove_file(&sony_pf_device->dev, &item->devattr); | 1373 | device_remove_file(&sony_pf_device->dev, &item->devattr); |
1397 | } | 1374 | } |
@@ -1425,6 +1402,7 @@ static struct acpi_driver sony_nc_driver = { | |||
1425 | .add = sony_nc_add, | 1402 | .add = sony_nc_add, |
1426 | .remove = sony_nc_remove, | 1403 | .remove = sony_nc_remove, |
1427 | .resume = sony_nc_resume, | 1404 | .resume = sony_nc_resume, |
1405 | .notify = sony_nc_notify, | ||
1428 | }, | 1406 | }, |
1429 | }; | 1407 | }; |
1430 | 1408 | ||
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 2f269e117b8f..043b208d971d 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
@@ -81,6 +81,7 @@ static struct wmi_block wmi_blocks; | |||
81 | 81 | ||
82 | static int acpi_wmi_remove(struct acpi_device *device, int type); | 82 | static int acpi_wmi_remove(struct acpi_device *device, int type); |
83 | static int acpi_wmi_add(struct acpi_device *device); | 83 | static int acpi_wmi_add(struct acpi_device *device); |
84 | static void acpi_wmi_notify(struct acpi_device *device, u32 event); | ||
84 | 85 | ||
85 | static const struct acpi_device_id wmi_device_ids[] = { | 86 | static const struct acpi_device_id wmi_device_ids[] = { |
86 | {"PNP0C14", 0}, | 87 | {"PNP0C14", 0}, |
@@ -96,6 +97,7 @@ static struct acpi_driver acpi_wmi_driver = { | |||
96 | .ops = { | 97 | .ops = { |
97 | .add = acpi_wmi_add, | 98 | .add = acpi_wmi_add, |
98 | .remove = acpi_wmi_remove, | 99 | .remove = acpi_wmi_remove, |
100 | .notify = acpi_wmi_notify, | ||
99 | }, | 101 | }, |
100 | }; | 102 | }; |
101 | 103 | ||
@@ -643,12 +645,11 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, | |||
643 | } | 645 | } |
644 | } | 646 | } |
645 | 647 | ||
646 | static void acpi_wmi_notify(acpi_handle handle, u32 event, void *data) | 648 | static void acpi_wmi_notify(struct acpi_device *device, u32 event) |
647 | { | 649 | { |
648 | struct guid_block *block; | 650 | struct guid_block *block; |
649 | struct wmi_block *wblock; | 651 | struct wmi_block *wblock; |
650 | struct list_head *p; | 652 | struct list_head *p; |
651 | struct acpi_device *device = data; | ||
652 | 653 | ||
653 | list_for_each(p, &wmi_blocks.list) { | 654 | list_for_each(p, &wmi_blocks.list) { |
654 | wblock = list_entry(p, struct wmi_block, list); | 655 | wblock = list_entry(p, struct wmi_block, list); |
@@ -669,9 +670,6 @@ static void acpi_wmi_notify(acpi_handle handle, u32 event, void *data) | |||
669 | 670 | ||
670 | static int acpi_wmi_remove(struct acpi_device *device, int type) | 671 | static int acpi_wmi_remove(struct acpi_device *device, int type) |
671 | { | 672 | { |
672 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, | ||
673 | acpi_wmi_notify); | ||
674 | |||
675 | acpi_remove_address_space_handler(device->handle, | 673 | acpi_remove_address_space_handler(device->handle, |
676 | ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler); | 674 | ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler); |
677 | 675 | ||
@@ -683,13 +681,6 @@ static int __init acpi_wmi_add(struct acpi_device *device) | |||
683 | acpi_status status; | 681 | acpi_status status; |
684 | int result = 0; | 682 | int result = 0; |
685 | 683 | ||
686 | status = acpi_install_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, | ||
687 | acpi_wmi_notify, device); | ||
688 | if (ACPI_FAILURE(status)) { | ||
689 | printk(KERN_ERR PREFIX "Error installing notify handler\n"); | ||
690 | return -ENODEV; | ||
691 | } | ||
692 | |||
693 | status = acpi_install_address_space_handler(device->handle, | 684 | status = acpi_install_address_space_handler(device->handle, |
694 | ACPI_ADR_SPACE_EC, | 685 | ACPI_ADR_SPACE_EC, |
695 | &acpi_wmi_ec_space_handler, | 686 | &acpi_wmi_ec_space_handler, |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index a2228511d4be..c34b11022908 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -270,7 +270,6 @@ struct acpi_device { | |||
270 | struct list_head children; | 270 | struct list_head children; |
271 | struct list_head node; | 271 | struct list_head node; |
272 | struct list_head wakeup_list; | 272 | struct list_head wakeup_list; |
273 | struct list_head g_list; | ||
274 | struct acpi_device_status status; | 273 | struct acpi_device_status status; |
275 | struct acpi_device_flags flags; | 274 | struct acpi_device_flags flags; |
276 | struct acpi_device_pnp pnp; | 275 | struct acpi_device_pnp pnp; |