History

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: gcc-4.6: ACPI: fix unused but set variables in ACPI ACPI thermal: make procfs I/F depend on CONFIG_ACPI_PROCFS ACPI video: make procfs I/F depend on CONFIG_ACPI_PROCFS ACPI processor: remove deprecated ACPI procfs I/F ACPI power_resource: remove unused procfs I/F ACPI: remove deprecated ACPI procfs I/F ACPI: introduce drivers/acpi/sysfs.c ACPI: introduce module parameter acpi.aml_debug_output ACPI: introduce drivers/acpi/debugfs.c ACPI, APEI, ERST debug support ACPI, APEI, Manage GHES as platform devices ACPI, APEI, Rename CPER and GHES severity constants ACPI, APEI, Fix a typo of error path of apei_resources_request ACPI / ACPICA: Fix reference counting problems with GPE handlers ACPI: Add the check of ADR flag in course of finding ACPI handle for PCI device ACPI / Sleep: Drop acpi_suspend_finish() ACPI / Sleep: Consolidate suspend and hibernation routines ACPI / Wakeup: Simplify enabling of wakeup devices ACPI / Sleep: Rework enabling wakeup devices ACPI / Sleep: Free NVS copy if suspending of devices fails Fixed up totally buggered "ACPI: fix unused but set variables in ACPI" patch that doesn't even compile in the merge. Thanks to Sedat Dilek <sedat.dilek@googlemail.com> for noticing the breakage before I even pulled. And a big "Grrr.." at Len for not even bothering to compile the tree before asking me to pull.

Linus Torvalds committed 16 years ago

Commit 2245ba22 parents e2e96c6 95ee46a40 files · +1071 −1479Browse files

Unified · Split

40 files
  1. Documentation/acpi/method-customizing.txt +2 −0
  2. arch/x86/kernel/cpu/mcheck/mce-apei.c +2 −2
  3. drivers/acpi/Kconfig +2 −9
  4. drivers/acpi/Makefile +3 −2
  5. drivers/acpi/acpica/acevents.h +4 −0
  6. drivers/acpi/acpica/acglobal.h +1 −1
  7. drivers/acpi/acpica/aclocal.h +1 −0
  8. drivers/acpi/acpica/evgpe.c +73 −0
  9. drivers/acpi/acpica/evxface.c +52 −25
  10. drivers/acpi/acpica/evxfevnt.c +9 −53
  11. drivers/acpi/acpica/utmutex.c +1 −4
  12. drivers/acpi/apei/Kconfig +9 −0
  13. drivers/acpi/apei/Makefile +1 −0
  14. drivers/acpi/apei/apei-base.c +2 −2
  15. drivers/acpi/apei/erst-dbg.c +207 −0
  16. drivers/acpi/apei/ghes.c +91 −81
  17. drivers/acpi/apei/hest.c +70 −6
  18. drivers/acpi/bus.c +2 −2
  19. drivers/acpi/debug.c +0 −422
  20. drivers/acpi/debugfs.c +93 −0
  21. drivers/acpi/glue.c +2 −1
  22. drivers/acpi/internal.h +4 −4
  23. drivers/acpi/numa.c +1 −3
  24. drivers/acpi/osl.c +3 −4
  25. drivers/acpi/power.c +1 −128
  26. drivers/acpi/proc.c +0 −70
  27. drivers/acpi/processor_driver.c +0 −85
  28. drivers/acpi/processor_idle.c +1 −101
  29. drivers/acpi/processor_thermal.c +0 −83
  30. drivers/acpi/processor_throttling.c +0 −2
  31. drivers/acpi/sleep.c +21 −39
  32. drivers/acpi/sleep.h +2 −3
  33. drivers/acpi/sysfs.c +257 −209
  34. drivers/acpi/thermal.c +53 −33
  35. drivers/acpi/video.c +86 −55
  36. drivers/acpi/wakeup.c +10 −38
  37. drivers/ata/libata-acpi.c +0 −6
  38. include/acpi/acpixf.h +1 −1
  39. include/acpi/processor.h +0 −1
  40. include/linux/cper.h +4 −4
Documentation/acpi/method-customizing.txt+2−0
@@ -19,6 +19,8 @@ Note: Only ACPI METHOD can be overridden, any other object types like · 18 unmodified lines
1919 "Device", "OperationRegion", are not recognized.
2020 Note: The same ACPI control method can be overridden for many times,
2121 and it's always the latest one that used by Linux/kernel.
22+Note: To get the ACPI debug object output (Store (AAAA, Debug)),
23+ please run "echo 1 > /sys/module/acpi/parameters/aml_debug_output".
2224
2325 1. override an existing method
2426 a) get the ACPI table via ACPI sysfs I/F. e.g. to get the DSDT,
arch/x86/kernel/cpu/mcheck/mce-apei.c+2−2
@@ -80,7 +80,7 @@ int apei_write_mce(struct mce *m) · 79 unmodified lines
8080 rcd.hdr.revision = CPER_RECORD_REV;
8181 rcd.hdr.signature_end = CPER_SIG_END;
8282 rcd.hdr.section_count = 1;
83− rcd.hdr.error_severity = CPER_SER_FATAL;
83+ rcd.hdr.error_severity = CPER_SEV_FATAL;
8484 /* timestamp, platform_id, partition_id are all invalid */
8585 rcd.hdr.validation_bits = 0;
8686 rcd.hdr.record_length = sizeof(rcd);
@@ -96,7 +96,7 @@ int apei_write_mce(struct mce *m) · 9 unmodified lines
9696 rcd.sec_hdr.validation_bits = 0;
9797 rcd.sec_hdr.flags = CPER_SEC_PRIMARY;
9898 rcd.sec_hdr.section_type = CPER_SECTION_TYPE_MCE;
99− rcd.sec_hdr.section_severity = CPER_SER_FATAL;
99+ rcd.sec_hdr.section_severity = CPER_SEV_FATAL;
100100
101101 memcpy(&rcd.mce, m, sizeof(*m));
102102
drivers/acpi/Kconfig+2−9
@@ -54,17 +54,10 @@ config ACPI_PROCFS · 53 unmodified lines
5454 they have been replaced by functions in /sys.
5555 The deprecated files (and their replacements) include:
5656
57− /proc/acpi/sleep (/sys/power/state)
58− /proc/acpi/info (/sys/module/acpi/parameters/acpica_version)
59− /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT)
60− /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP)
61− /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer)
62− /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level)
63− /proc/acpi/processor/*/power (/sys/devices/system/cpu/*/cpuidle/*)
64− /proc/acpi/processor/*/performance (/sys/devices/system/cpu/*/
65− cpufreq/*)
6657 /proc/acpi/processor/*/throttling (/sys/class/thermal/
6758 cooling_device*/*)
59+ /proc/acpi/video/*/brightness (/sys/class/backlight/)
60+ /proc/acpi/thermal_zone/*/* (/sys/class/thermal/)
6861 This option has no effect on /proc/acpi/ files
6962 and functions which do not yet exist in /sys.
7063
drivers/acpi/Makefile+3−2
@@ -37,8 +37,9 @@ acpi-y += ec.o · 36 unmodified lines
3737 acpi-$(CONFIG_ACPI_DOCK) += dock.o
3838 acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
3939 acpi-y += power.o
40−acpi-y += system.o event.o
41−acpi-$(CONFIG_ACPI_DEBUG) += debug.o
40+acpi-y += event.o
41+acpi-y += sysfs.o
42+acpi-$(CONFIG_DEBUG_FS) += debugfs.o
4243 acpi-$(CONFIG_ACPI_NUMA) += numa.o
4344 acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
4445 ifdef CONFIG_ACPI_VIDEO
drivers/acpi/acpica/acevents.h+4−0
@@ -82,6 +82,10 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info); · 81 unmodified lines
8282
8383 acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
8484
85+acpi_status acpi_raw_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
86+
87+acpi_status acpi_raw_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
88+
8589 struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
8690 u32 gpe_number);
8791
drivers/acpi/acpica/acglobal.h+1−1
@@ -108,7 +108,7 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE); · 107 unmodified lines
108108 /*
109109 * Optionally enable output from the AML Debug Object.
110110 */
111−u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
111+u32 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
112112
113113 /*
114114 * Optionally copy the entire DSDT to local memory (instead of simply
drivers/acpi/acpica/aclocal.h+1−0
@@ -412,6 +412,7 @@ struct acpi_handler_info { · 411 unmodified lines
412412 acpi_event_handler address; /* Address of handler, if any */
413413 void *context; /* Context to be passed to handler */
414414 struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
415+ u8 orig_flags; /* Original misc info about this GPE */
415416 };
416417
417418 union acpi_gpe_dispatch_info {
drivers/acpi/acpica/evgpe.c+73−0
@@ -135,6 +135,79 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) · 134 unmodified lines
135135 }
136136
137137
138+/*******************************************************************************
139+ *
140+ * FUNCTION: acpi_raw_enable_gpe
141+ *
142+ * PARAMETERS: gpe_event_info - GPE to enable
143+ *
144+ * RETURN: Status
145+ *
146+ * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
147+ * hardware-enabled.
148+ *
149+ ******************************************************************************/
150+
151+acpi_status acpi_raw_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
152+{
153+ acpi_status status = AE_OK;
154+
155+ if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) {
156+ return_ACPI_STATUS(AE_LIMIT);
157+ }
158+
159+ gpe_event_info->runtime_count++;
160+ if (gpe_event_info->runtime_count == 1) {
161+ status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
162+ if (ACPI_SUCCESS(status)) {
163+ status = acpi_ev_enable_gpe(gpe_event_info);
164+ }
165+
166+ if (ACPI_FAILURE(status)) {
167+ gpe_event_info->runtime_count--;
168+ }
169+ }
170+
171+ return_ACPI_STATUS(status);
172+}
173+
174+/*******************************************************************************
175+ *
176+ * FUNCTION: acpi_raw_disable_gpe
177+ *
178+ * PARAMETERS: gpe_event_info - GPE to disable
179+ *
180+ * RETURN: Status
181+ *
182+ * DESCRIPTION: Remove a reference to a GPE. When the last reference is
183+ * removed, the GPE is hardware-disabled.
184+ *
185+ ******************************************************************************/
186+
187+acpi_status acpi_raw_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
188+{
189+ acpi_status status = AE_OK;
190+
191+ if (!gpe_event_info->runtime_count) {
192+ return_ACPI_STATUS(AE_LIMIT);
193+ }
194+
195+ gpe_event_info->runtime_count--;
196+ if (!gpe_event_info->runtime_count) {
197+ status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
198+ if (ACPI_SUCCESS(status)) {
199+ status = acpi_hw_low_set_gpe(gpe_event_info,
200+ ACPI_GPE_DISABLE);
201+ }
202+
203+ if (ACPI_FAILURE(status)) {
204+ gpe_event_info->runtime_count++;
205+ }
206+ }
207+
208+ return_ACPI_STATUS(status);
209+}
210+
138211 /*******************************************************************************
139212 *
140213 * FUNCTION: acpi_ev_low_get_gpe_info
drivers/acpi/acpica/evxface.c+52−25
@@ -691,12 +691,22 @@ acpi_install_gpe_handler(acpi_handle gpe_device, · 690 unmodified lines
691691 return_ACPI_STATUS(status);
692692 }
693693
694+ /* Allocate memory for the handler object */
695+
696+ handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
697+ if (!handler) {
698+ status = AE_NO_MEMORY;
699+ goto unlock_and_exit;
700+ }
701+
702+ flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
703+
694704 /* Ensure that we have a valid GPE number */
695705
696706 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
697707 if (!gpe_event_info) {
698708 status = AE_BAD_PARAMETER;
699− goto unlock_and_exit;
709+ goto free_and_exit;
700710 }
701711
702712 /* Make sure that there isn't a handler there already */
@@ -704,24 +714,30 @@ acpi_install_gpe_handler(acpi_handle gpe_device, · 1 unmodified line
704714 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
705715 ACPI_GPE_DISPATCH_HANDLER) {
706716 status = AE_ALREADY_EXISTS;
707− goto unlock_and_exit;
717+ goto free_and_exit;
708718 }
709719
710720 /* Allocate and init handler object */
711721
712− handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
713− if (!handler) {
714− status = AE_NO_MEMORY;
715− goto unlock_and_exit;
716− }
717−
718722 handler->address = address;
719723 handler->context = context;
720724 handler->method_node = gpe_event_info->dispatch.method_node;
725+ handler->orig_flags = gpe_event_info->flags &
726+ (ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
727+
728+ /*
729+ * If the GPE is associated with a method and it cannot wake up the
730+ * system from sleep states, it was enabled automatically during
731+ * initialization, so it has to be disabled now to avoid spurious
732+ * execution of the handler.
733+ */
734+
735+ if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD)
736+ && !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE))
737+ (void)acpi_raw_disable_gpe(gpe_event_info);
721738
722739 /* Install the handler */
723740
724− flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
725741 gpe_event_info->dispatch.handler = handler;
726742
727743 /* Setup up dispatch flags to indicate handler (vs. method) */
@@ -735,6 +751,11 @@ acpi_install_gpe_handler(acpi_handle gpe_device, · 7 unmodified lines
735751 unlock_and_exit:
736752 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
737753 return_ACPI_STATUS(status);
754+
755+free_and_exit:
756+ acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
757+ ACPI_FREE(handler);
758+ goto unlock_and_exit;
738759 }
739760
740761 ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler)
@@ -770,11 +791,17 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, · 29 unmodified lines
770791 return_ACPI_STATUS(AE_BAD_PARAMETER);
771792 }
772793
794+ /* Make sure all deferred tasks are completed */
795+
796+ acpi_os_wait_events_complete(NULL);
797+
773798 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
774799 if (ACPI_FAILURE(status)) {
775800 return_ACPI_STATUS(status);
776801 }
777802
803+ flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
804+
778805 /* Ensure that we have a valid GPE number */
779806
780807 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
@@ -798,34 +825,34 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, · 17 unmodified lines
798825 goto unlock_and_exit;
799826 }
800827
801− /* Make sure all deferred tasks are completed */
802−
803− (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
804− acpi_os_wait_events_complete(NULL);
805− status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
806− if (ACPI_FAILURE(status)) {
807− return_ACPI_STATUS(status);
808− }
809−
810828 /* Remove the handler */
811829
812− flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
813830 handler = gpe_event_info->dispatch.handler;
814831
815832 /* Restore Method node (if any), set dispatch flags */
816833
817834 gpe_event_info->dispatch.method_node = handler->method_node;
818− gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */
819− if (handler->method_node) {
820− gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD;
821− }
822− acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
835+ gpe_event_info->flags &=
836+ ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
837+ gpe_event_info->flags |= handler->orig_flags;
838+
839+ /*
840+ * If the GPE was previously associated with a method and it cannot wake
841+ * up the system from sleep states, it should be enabled at this point
842+ * to restore the post-initialization configuration.
843+ */
844+
845+ if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD)
846+ && !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE))
847+ (void)acpi_raw_enable_gpe(gpe_event_info);
823848
824849 /* Now we can free the handler object */
825850
826851 ACPI_FREE(handler);
827852
828− unlock_and_exit:
853+unlock_and_exit:
854+ acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
855+
829856 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
830857 return_ACPI_STATUS(status);
831858 }
drivers/acpi/acpica/evxfevnt.c+9−53
@@ -294,7 +294,7 @@ ACPI_EXPORT_SYMBOL(acpi_gpe_wakeup) · 293 unmodified lines
294294 ******************************************************************************/
295295 acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
296296 {
297− acpi_status status = AE_OK;
297+ acpi_status status = AE_BAD_PARAMETER;
298298 struct acpi_gpe_event_info *gpe_event_info;
299299 acpi_cpu_flags flags;
300300
@@ -305,28 +305,10 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) · 4 unmodified lines
305305 /* Ensure that we have a valid GPE number */
306306
307307 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
308− if (!gpe_event_info) {
309− status = AE_BAD_PARAMETER;
310− goto unlock_and_exit;
308+ if (gpe_event_info) {
309+ status = acpi_raw_enable_gpe(gpe_event_info);
311310 }
312311
313− if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) {
314− status = AE_LIMIT; /* Too many references */
315− goto unlock_and_exit;
316− }
317−
318− gpe_event_info->runtime_count++;
319− if (gpe_event_info->runtime_count == 1) {
320− status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
321− if (ACPI_SUCCESS(status)) {
322− status = acpi_ev_enable_gpe(gpe_event_info);
323− }
324− if (ACPI_FAILURE(status)) {
325− gpe_event_info->runtime_count--;
326− }
327− }
328−
329−unlock_and_exit:
330312 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
331313 return_ACPI_STATUS(status);
332314 }
@@ -348,7 +330,7 @@ ACPI_EXPORT_SYMBOL(acpi_enable_gpe) · 15 unmodified lines
348330 ******************************************************************************/
349331 acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
350332 {
351− acpi_status status = AE_OK;
333+ acpi_status status = AE_BAD_PARAMETER;
352334 struct acpi_gpe_event_info *gpe_event_info;
353335 acpi_cpu_flags flags;
354336
@@ -359,32 +341,10 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number) · 4 unmodified lines
359341 /* Ensure that we have a valid GPE number */
360342
361343 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
362− if (!gpe_event_info) {
363− status = AE_BAD_PARAMETER;
364− goto unlock_and_exit;
365− }
366−
367− /* Hardware-disable a runtime GPE on removal of the last reference */
368−
369− if (!gpe_event_info->runtime_count) {
370− status = AE_LIMIT; /* There are no references to remove */
371− goto unlock_and_exit;
344+ if (gpe_event_info) {
345+ status = acpi_raw_disable_gpe(gpe_event_info) ;
372346 }
373347
374− gpe_event_info->runtime_count--;
375− if (!gpe_event_info->runtime_count) {
376− status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
377− if (ACPI_SUCCESS(status)) {
378− status =
379− acpi_hw_low_set_gpe(gpe_event_info,
380− ACPI_GPE_DISABLE);
381− }
382− if (ACPI_FAILURE(status)) {
383− gpe_event_info->runtime_count++;
384− }
385− }
386−
387−unlock_and_exit:
388348 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
389349 return_ACPI_STATUS(status);
390350 }
@@ -411,7 +371,6 @@ acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number) · 20 unmodified lines
411371 acpi_status status = AE_OK;
412372 struct acpi_gpe_event_info *gpe_event_info;
413373 acpi_cpu_flags flags;
414− u8 disable = 0;
415374
416375 ACPI_FUNCTION_TRACE(acpi_gpe_can_wake);
417376
@@ -430,15 +389,12 @@ acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number) · 12 unmodified lines
430389 }
431390
432391 gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
433− disable = (gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)
434− && gpe_event_info->runtime_count;
392+ if (gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD) {
393+ (void)acpi_raw_disable_gpe(gpe_event_info);
394+ }
435395
436396 unlock_and_exit:
437397 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
438−
439− if (disable)
440− status = acpi_disable_gpe(gpe_device, gpe_number);
441−
442398 return_ACPI_STATUS(status);
443399 }
444400 ACPI_EXPORT_SYMBOL(acpi_gpe_can_wake)
drivers/acpi/acpica/utmutex.c+1−4
@@ -279,13 +279,10 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) · 278 unmodified lines
279279
280280 acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
281281 {
282− acpi_thread_id this_thread_id;
283−
284282 ACPI_FUNCTION_NAME(ut_release_mutex);
285283
286− this_thread_id = acpi_os_get_thread_id();
287284 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n",
288− ACPI_CAST_PTR(void, this_thread_id),
285+ ACPI_CAST_PTR(void, acpi_os_get_thread_id()),
289286 acpi_ut_get_mutex_name(mutex_id)));
290287
291288 if (mutex_id > ACPI_MAX_MUTEX) {
drivers/acpi/apei/Kconfig+9−0
@@ -28,3 +28,12 @@ config ACPI_APEI_EINJ · 27 unmodified lines
2828 EINJ provides a hardware error injection mechanism, it is
2929 mainly used for debugging and testing the other parts of
3030 APEI and some other RAS features.
31+
32+config ACPI_APEI_ERST_DEBUG
33+ tristate "APEI Error Record Serialization Table (ERST) Debug Support"
34+ depends on ACPI_APEI
35+ help
36+ ERST is a way provided by APEI to save and retrieve hardware
37+ error infomation to and from a persistent store. Enable this
38+ if you want to debugging and testing the ERST kernel support
39+ and firmware implementation.
drivers/acpi/apei/Makefile+1−0
@@ -1,5 +1,6 @@
11 obj-$(CONFIG_ACPI_APEI) += apei.o
22 obj-$(CONFIG_ACPI_APEI_GHES) += ghes.o
33 obj-$(CONFIG_ACPI_APEI_EINJ) += einj.o
4+obj-$(CONFIG_ACPI_APEI_ERST_DEBUG) += erst-dbg.o
45
56 apei-y := apei-base.o hest.o cper.o erst.o
drivers/acpi/apei/apei-base.c+2−2
@@ -482,14 +482,14 @@ err_unmap_ioport: · 481 unmodified lines
482482 list_for_each_entry(res, &resources->ioport, list) {
483483 if (res == res_bak)
484484 break;
485− release_mem_region(res->start, res->end - res->start);
485+ release_region(res->start, res->end - res->start);
486486 }
487487 res_bak = NULL;
488488 err_unmap_iomem:
489489 list_for_each_entry(res, &resources->iomem, list) {
490490 if (res == res_bak)
491491 break;
492− release_region(res->start, res->end - res->start);
492+ release_mem_region(res->start, res->end - res->start);
493493 }
494494 return -EINVAL;
495495 }
drivers/acpi/apei/erst-dbg.c+207−0
@@ -0,0 +1,207 @@
1+/*
2+ * APEI Error Record Serialization Table debug support
3+ *
4+ * ERST is a way provided by APEI to save and retrieve hardware error
5+ * infomation to and from a persistent store. This file provide the
6+ * debugging/testing support for ERST kernel support and firmware
7+ * implementation.
8+ *
9+ * Copyright 2010 Intel Corp.
10+ * Author: Huang Ying <ying.huang@intel.com>
11+ *
12+ * This program is free software; you can redistribute it and/or
13+ * modify it under the terms of the GNU General Public License version
14+ * 2 as published by the Free Software Foundation.
15+ *
16+ * This program is distributed in the hope that it will be useful,
17+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+ * GNU General Public License for more details.
20+ *
21+ * You should have received a copy of the GNU General Public License
22+ * along with this program; if not, write to the Free Software
23+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24+ */
25+
26+#include <linux/kernel.h>
27+#include <linux/module.h>
28+#include <linux/uaccess.h>
29+#include <acpi/apei.h>
30+#include <linux/miscdevice.h>
31+
32+#include "apei-internal.h"
33+
34+#define ERST_DBG_PFX "ERST DBG: "
35+
36+#define ERST_DBG_RECORD_LEN_MAX 4096
37+
38+static void *erst_dbg_buf;
39+static unsigned int erst_dbg_buf_len;
40+
41+/* Prevent erst_dbg_read/write from being invoked concurrently */
42+static DEFINE_MUTEX(erst_dbg_mutex);
43+
44+static int erst_dbg_open(struct inode *inode, struct file *file)
45+{
46+ if (erst_disable)
47+ return -ENODEV;
48+
49+ return nonseekable_open(inode, file);
50+}
51+
52+static long erst_dbg_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
53+{
54+ int rc;
55+ u64 record_id;
56+ u32 record_count;
57+
58+ switch (cmd) {
59+ case APEI_ERST_CLEAR_RECORD:
60+ rc = copy_from_user(&record_id, (void __user *)arg,
61+ sizeof(record_id));
62+ if (rc)
63+ return -EFAULT;
64+ return erst_clear(record_id);
65+ case APEI_ERST_GET_RECORD_COUNT:
66+ rc = erst_get_record_count();
67+ if (rc < 0)
68+ return rc;
69+ record_count = rc;
70+ rc = put_user(record_count, (u32 __user *)arg);
71+ if (rc)
72+ return rc;
73+ return 0;
74+ default:
75+ return -ENOTTY;
76+ }
77+}
78+
79+static ssize_t erst_dbg_read(struct file *filp, char __user *ubuf,
80+ size_t usize, loff_t *off)
81+{
82+ int rc;
83+ ssize_t len = 0;
84+ u64 id;
85+
86+ if (*off != 0)
87+ return -EINVAL;
88+
89+ if (mutex_lock_interruptible(&erst_dbg_mutex) != 0)
90+ return -EINTR;
91+
92+retry_next:
93+ rc = erst_get_next_record_id(&id);
94+ if (rc)
95+ goto out;
96+ /* no more record */
97+ if (id == APEI_ERST_INVALID_RECORD_ID)
98+ goto out;
99+retry:
100+ rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len);
101+ /* The record may be cleared by others, try read next record */
102+ if (rc == -ENOENT)
103+ goto retry_next;
104+ if (rc < 0)
105+ goto out;
106+ if (len > ERST_DBG_RECORD_LEN_MAX) {
107+ pr_warning(ERST_DBG_PFX
108+ "Record (ID: 0x%llx) length is too long: %zd\n",
109+ id, len);
110+ rc = -EIO;
111+ goto out;
112+ }
113+ if (len > erst_dbg_buf_len) {
114+ kfree(erst_dbg_buf);
115+ rc = -ENOMEM;
116+ erst_dbg_buf = kmalloc(len, GFP_KERNEL);
117+ if (!erst_dbg_buf)
118+ goto out;
119+ erst_dbg_buf_len = len;
120+ goto retry;
121+ }
122+
123+ rc = -EINVAL;
124+ if (len > usize)
125+ goto out;
126+
127+ rc = -EFAULT;
128+ if (copy_to_user(ubuf, erst_dbg_buf, len))
129+ goto out;
130+ rc = 0;
131+out:
132+ mutex_unlock(&erst_dbg_mutex);
133+ return rc ? rc : len;
134+}
135+
136+static ssize_t erst_dbg_write(struct file *filp, const char __user *ubuf,
137+ size_t usize, loff_t *off)
138+{
139+ int rc;
140+ struct cper_record_header *rcd;
141+
142+ if (!capable(CAP_SYS_ADMIN))
143+ return -EPERM;
144+
145+ if (usize > ERST_DBG_RECORD_LEN_MAX) {
146+ pr_err(ERST_DBG_PFX "Too long record to be written\n");
147+ return -EINVAL;
148+ }
149+
150+ if (mutex_lock_interruptible(&erst_dbg_mutex))
151+ return -EINTR;
152+ if (usize > erst_dbg_buf_len) {
153+ kfree(erst_dbg_buf);
154+ rc = -ENOMEM;
155+ erst_dbg_buf = kmalloc(usize, GFP_KERNEL);
156+ if (!erst_dbg_buf)
157+ goto out;
158+ erst_dbg_buf_len = usize;
159+ }
160+ rc = copy_from_user(erst_dbg_buf, ubuf, usize);
161+ if (rc) {
162+ rc = -EFAULT;
163+ goto out;
164+ }
165+ rcd = erst_dbg_buf;
166+ rc = -EINVAL;
167+ if (rcd->record_length != usize)
168+ goto out;
169+
170+ rc = erst_write(erst_dbg_buf);
171+
172+out:
173+ mutex_unlock(&erst_dbg_mutex);
174+ return rc < 0 ? rc : usize;
175+}
176+
177+static const struct file_operations erst_dbg_ops = {
178+ .owner = THIS_MODULE,
179+ .open = erst_dbg_open,
180+ .read = erst_dbg_read,
181+ .write = erst_dbg_write,
182+ .unlocked_ioctl = erst_dbg_ioctl,
183+};
184+
185+static struct miscdevice erst_dbg_dev = {
186+ .minor = MISC_DYNAMIC_MINOR,
187+ .name = "erst_dbg",
188+ .fops = &erst_dbg_ops,
189+};
190+
191+static __init int erst_dbg_init(void)
192+{
193+ return misc_register(&erst_dbg_dev);
194+}
195+
196+static __exit void erst_dbg_exit(void)
197+{
198+ misc_deregister(&erst_dbg_dev);
199+ kfree(erst_dbg_buf);
200+}
201+
202+module_init(erst_dbg_init);
203+module_exit(erst_dbg_exit);
204+
205+MODULE_AUTHOR("Huang Ying");
206+MODULE_DESCRIPTION("APEI Error Record Serialization Table debug support");
207+MODULE_LICENSE("GPL");
drivers/acpi/apei/ghes.c+91−81
@@ -41,6 +41,8 @@ · 40 unmodified lines
4141 #include <linux/interrupt.h>
4242 #include <linux/cper.h>
4343 #include <linux/kdebug.h>
44+#include <linux/platform_device.h>
45+#include <linux/mutex.h>
4446 #include <acpi/apei.h>
4547 #include <acpi/atomicio.h>
4648 #include <acpi/hed.h>
@@ -87,6 +89,7 @@ struct ghes { · 40 unmodified lines
8789 * used for that.
8890 */
8991 static LIST_HEAD(ghes_sci);
92+static DEFINE_MUTEX(ghes_list_mutex);
9093
9194 static struct ghes *ghes_new(struct acpi_hest_generic *generic)
9295 {
@@ -132,26 +135,26 @@ static void ghes_fini(struct ghes *ghes) · 39 unmodified lines
132135 }
133136
134137 enum {
135− GHES_SER_NO = 0x0,
136− GHES_SER_CORRECTED = 0x1,
137− GHES_SER_RECOVERABLE = 0x2,
138− GHES_SER_PANIC = 0x3,
138+ GHES_SEV_NO = 0x0,
139+ GHES_SEV_CORRECTED = 0x1,
140+ GHES_SEV_RECOVERABLE = 0x2,
141+ GHES_SEV_PANIC = 0x3,
139142 };
140143
141144 static inline int ghes_severity(int severity)
142145 {
143146 switch (severity) {
144− case CPER_SER_INFORMATIONAL:
145− return GHES_SER_NO;
146− case CPER_SER_CORRECTED:
147− return GHES_SER_CORRECTED;
148− case CPER_SER_RECOVERABLE:
149− return GHES_SER_RECOVERABLE;
150− case CPER_SER_FATAL:
151− return GHES_SER_PANIC;
147+ case CPER_SEV_INFORMATIONAL:
148+ return GHES_SEV_NO;
149+ case CPER_SEV_CORRECTED:
150+ return GHES_SEV_CORRECTED;
151+ case CPER_SEV_RECOVERABLE:
152+ return GHES_SEV_RECOVERABLE;
153+ case CPER_SEV_FATAL:
154+ return GHES_SEV_PANIC;
152155 default:
153156 /* Unkown, go panic */
154− return GHES_SER_PANIC;
157+ return GHES_SEV_PANIC;
155158 }
156159 }
157160
@@ -237,16 +240,16 @@ static void ghes_clear_estatus(struct ghes *ghes) · 79 unmodified lines
237240
238241 static void ghes_do_proc(struct ghes *ghes)
239242 {
240− int ser, processed = 0;
243+ int sev, processed = 0;
241244 struct acpi_hest_generic_data *gdata;
242245
243− ser = ghes_severity(ghes->estatus->error_severity);
246+ sev = ghes_severity(ghes->estatus->error_severity);
244247 apei_estatus_for_each_section(ghes->estatus, gdata) {
245248 #ifdef CONFIG_X86_MCE
246249 if (!uuid_le_cmp(*(uuid_le *)gdata->section_type,
247250 CPER_SEC_PLATFORM_MEM)) {
248251 apei_mce_report_mem_error(
249− ser == GHES_SER_CORRECTED,
252+ sev == GHES_SEV_CORRECTED,
250253 (struct cper_sec_mem_err *)(gdata+1));
251254 processed = 1;
252255 }
@@ -293,18 +296,15 @@ static struct notifier_block ghes_notifier_sci = { · 40 unmodified lines
293296 .notifier_call = ghes_notify_sci,
294297 };
295298
296−static int hest_ghes_parse(struct acpi_hest_header *hest_hdr, void *data)
299+static int __devinit ghes_probe(struct platform_device *ghes_dev)
297300 {
298301 struct acpi_hest_generic *generic;
299302 struct ghes *ghes = NULL;
300− int rc = 0;
303+ int rc = -EINVAL;
301304
302− if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR)
303− return 0;
304−
305− generic = (struct acpi_hest_generic *)hest_hdr;
305+ generic = ghes_dev->dev.platform_data;
306306 if (!generic->enabled)
307− return 0;
307+ return -ENODEV;
308308
309309 if (generic->error_block_length <
310310 sizeof(struct acpi_hest_generic_status)) {
@@ -327,62 +327,91 @@ static int hest_ghes_parse(struct acpi_hest_header *hest_hdr, void *data) · 16 unmodified lines
327327 ghes = NULL;
328328 goto err;
329329 }
330− switch (generic->notify.type) {
331− case ACPI_HEST_NOTIFY_POLLED:
332− pr_warning(GHES_PFX
333−"Generic hardware error source: %d notified via POLL is not supported!\n",
334− generic->header.source_id);
335− break;
336− case ACPI_HEST_NOTIFY_EXTERNAL:
337− case ACPI_HEST_NOTIFY_LOCAL:
338− pr_warning(GHES_PFX
339−"Generic hardware error source: %d notified via IRQ is not supported!\n",
340− generic->header.source_id);
341− break;
342− case ACPI_HEST_NOTIFY_SCI:
330+ if (generic->notify.type == ACPI_HEST_NOTIFY_SCI) {
331+ mutex_lock(&ghes_list_mutex);
343332 if (list_empty(&ghes_sci))
344333 register_acpi_hed_notifier(&ghes_notifier_sci);
345334 list_add_rcu(&ghes->list, &ghes_sci);
346− break;
347− case ACPI_HEST_NOTIFY_NMI:
348− pr_warning(GHES_PFX
349−"Generic hardware error source: %d notified via NMI is not supported!\n",
350− generic->header.source_id);
351− break;
352− default:
353− pr_warning(FW_WARN GHES_PFX
354− "Unknown notification type: %u for generic hardware error source: %d\n",
355− generic->notify.type, generic->header.source_id);
356− break;
335+ mutex_unlock(&ghes_list_mutex);
336+ } else {
337+ unsigned char *notify = NULL;
338+
339+ switch (generic->notify.type) {
340+ case ACPI_HEST_NOTIFY_POLLED:
341+ notify = "POLL";
342+ break;
343+ case ACPI_HEST_NOTIFY_EXTERNAL:
344+ case ACPI_HEST_NOTIFY_LOCAL:
345+ notify = "IRQ";
346+ break;
347+ case ACPI_HEST_NOTIFY_NMI:
348+ notify = "NMI";
349+ break;
350+ }
351+ if (notify) {
352+ pr_warning(GHES_PFX
353+"Generic hardware error source: %d notified via %s is not supported!\n",
354+ generic->header.source_id, notify);
355+ } else {
356+ pr_warning(FW_WARN GHES_PFX
357+"Unknown notification type: %u for generic hardware error source: %d\n",
358+ generic->notify.type, generic->header.source_id);
359+ }
360+ rc = -ENODEV;
361+ goto err;
357362 }
363+ platform_set_drvdata(ghes_dev, ghes);
358364
359365 return 0;
360366 err:
361− if (ghes)
367+ if (ghes) {
362368 ghes_fini(ghes);
369+ kfree(ghes);
370+ }
363371 return rc;
364372 }
365373
366−static void ghes_cleanup(void)
374+static int __devexit ghes_remove(struct platform_device *ghes_dev)
367375 {
368− struct ghes *ghes, *nghes;
376+ struct ghes *ghes;
377+ struct acpi_hest_generic *generic;
369378
370− if (!list_empty(&ghes_sci))
371− unregister_acpi_hed_notifier(&ghes_notifier_sci);
379+ ghes = platform_get_drvdata(ghes_dev);
380+ generic = ghes->generic;
381+
382+ switch (generic->notify.type) {
383+ case ACPI_HEST_NOTIFY_SCI:
384+ mutex_lock(&ghes_list_mutex);
385+ list_del_rcu(&ghes->list);
386+ if (list_empty(&ghes_sci))
387+ unregister_acpi_hed_notifier(&ghes_notifier_sci);
388+ mutex_unlock(&ghes_list_mutex);
389+ break;
390+ default:
391+ BUG();
392+ break;
393+ }
372394
373395 synchronize_rcu();
396+ ghes_fini(ghes);
397+ kfree(ghes);
374398
375− list_for_each_entry_safe(ghes, nghes, &ghes_sci, list) {
376− list_del(&ghes->list);
377− ghes_fini(ghes);
378− kfree(ghes);
379− }
399+ platform_set_drvdata(ghes_dev, NULL);
400+
401+ return 0;
380402 }
381403
404+static struct platform_driver ghes_platform_driver = {
405+ .driver = {
406+ .name = "GHES",
407+ .owner = THIS_MODULE,
408+ },
409+ .probe = ghes_probe,
410+ .remove = ghes_remove,
411+};
412+
382413 static int __init ghes_init(void)
383414 {
384− int rc;
385−
386415 if (acpi_disabled)
387416 return -ENODEV;
388417
@@ -391,32 +420,12 @@ static int __init ghes_init(void) · 2 unmodified lines
391420 return -EINVAL;
392421 }
393422
394− rc = apei_hest_parse(hest_ghes_parse, NULL);
395− if (rc) {
396− pr_err(GHES_PFX
397− "Error during parsing HEST generic hardware error sources.\n");
398− goto err_cleanup;
399− }
400−
401− if (list_empty(&ghes_sci)) {
402− pr_info(GHES_PFX
403− "No functional generic hardware error sources.\n");
404− rc = -ENODEV;
405− goto err_cleanup;
406− }
407−
408− pr_info(GHES_PFX
409− "Generic Hardware Error Source support is initialized.\n");
410−
411− return 0;
412−err_cleanup:
413− ghes_cleanup();
414− return rc;
423+ return platform_driver_register(&ghes_platform_driver);
415424 }
416425
417426 static void __exit ghes_exit(void)
418427 {
419− ghes_cleanup();
428+ platform_driver_unregister(&ghes_platform_driver);
420429 }
421430
422431 module_init(ghes_init);
@@ -425,3 +434,4 @@ module_exit(ghes_exit); · 2 unmodified lines
425434 MODULE_AUTHOR("Huang Ying");
426435 MODULE_DESCRIPTION("APEI Generic Hardware Error Source support");
427436 MODULE_LICENSE("GPL");
437+MODULE_ALIAS("platform:GHES");
drivers/acpi/apei/hest.c+70−6
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #include <linux/kdebug.h>
3535 #include <linux/highmem.h>
3636 #include <linux/io.h>
37+#include <linux/platform_device.h>
3738 #include <acpi/apei.h>
3839
3940 #include "apei-internal.h"
@@ -47,11 +48,6 @@ EXPORT_SYMBOL_GPL(hest_disable); · 7 unmodified lines
4748
4849 static struct acpi_table_hest *hest_tab;
4950
50−static int hest_void_parse(struct acpi_hest_header *hest_hdr, void *data)
51−{
52− return 0;
53−}
54−
5551 static int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = {
5652 [ACPI_HEST_TYPE_IA32_CHECK] = -1, /* need further calculation */
5753 [ACPI_HEST_TYPE_IA32_CORRECTED_CHECK] = -1,
@@ -125,6 +121,69 @@ int apei_hest_parse(apei_hest_func_t func, void *data) · 67 unmodified lines
125121 }
126122 EXPORT_SYMBOL_GPL(apei_hest_parse);
127123
124+struct ghes_arr {
125+ struct platform_device **ghes_devs;
126+ unsigned int count;
127+};
128+
129+static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data)
130+{
131+ int *count = data;
132+
133+ if (hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR)
134+ (*count)++;
135+ return 0;
136+}
137+
138+static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data)
139+{
140+ struct acpi_hest_generic *generic;
141+ struct platform_device *ghes_dev;
142+ struct ghes_arr *ghes_arr = data;
143+ int rc;
144+
145+ if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR)
146+ return 0;
147+ generic = (struct acpi_hest_generic *)hest_hdr;
148+ if (!generic->enabled)
149+ return 0;
150+ ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id);
151+ if (!ghes_dev)
152+ return -ENOMEM;
153+ ghes_dev->dev.platform_data = generic;
154+ rc = platform_device_add(ghes_dev);
155+ if (rc)
156+ goto err;
157+ ghes_arr->ghes_devs[ghes_arr->count++] = ghes_dev;
158+
159+ return 0;
160+err:
161+ platform_device_put(ghes_dev);
162+ return rc;
163+}
164+
165+static int hest_ghes_dev_register(unsigned int ghes_count)
166+{
167+ int rc, i;
168+ struct ghes_arr ghes_arr;
169+
170+ ghes_arr.count = 0;
171+ ghes_arr.ghes_devs = kmalloc(sizeof(void *) * ghes_count, GFP_KERNEL);
172+ if (!ghes_arr.ghes_devs)
173+ return -ENOMEM;
174+
175+ rc = apei_hest_parse(hest_parse_ghes, &ghes_arr);
176+ if (rc)
177+ goto err;
178+out:
179+ kfree(ghes_arr.ghes_devs);
180+ return rc;
181+err:
182+ for (i = 0; i < ghes_arr.count; i++)
183+ platform_device_unregister(ghes_arr.ghes_devs[i]);
184+ goto out;
185+}
186+
128187 static int __init setup_hest_disable(char *str)
129188 {
130189 hest_disable = 1;
@@ -137,6 +196,7 @@ static int __init hest_init(void) · 6 unmodified lines
137196 {
138197 acpi_status status;
139198 int rc = -ENODEV;
199+ unsigned int ghes_count = 0;
140200
141201 if (acpi_disabled)
142202 goto err;
@@ -158,7 +218,11 @@ static int __init hest_init(void) · 15 unmodified lines
158218 goto err;
159219 }
160220
161− rc = apei_hest_parse(hest_void_parse, NULL);
221+ rc = apei_hest_parse(hest_parse_ghes_count, &ghes_count);
222+ if (rc)
223+ goto err;
224+
225+ rc = hest_ghes_dev_register(ghes_count);
162226 if (rc)
163227 goto err;
164228
drivers/acpi/bus.c+2−2
@@ -1034,8 +1034,8 @@ static int __init acpi_init(void) · 1033 unmodified lines
10341034 acpi_scan_init();
10351035 acpi_ec_init();
10361036 acpi_power_init();
1037− acpi_system_init();
1038− acpi_debug_init();
1037+ acpi_sysfs_init();
1038+ acpi_debugfs_init();
10391039 acpi_sleep_proc_init();
10401040 acpi_wakeup_device_init();
10411041 return result;
drivers/acpi/debug.c+0−422
@@ -1,422 +0,0 @@
1−/*
2− * debug.c - ACPI debug interface to userspace.
3− */
4−
5−#include <linux/proc_fs.h>
6−#include <linux/seq_file.h>
7−#include <linux/init.h>
8−#include <linux/module.h>
9−#include <linux/kernel.h>
10−#include <linux/moduleparam.h>
11−#include <linux/debugfs.h>
12−#include <linux/slab.h>
13−#include <asm/uaccess.h>
14−#include <acpi/acpi_drivers.h>
15−
16−#define _COMPONENT ACPI_SYSTEM_COMPONENT
17−ACPI_MODULE_NAME("debug");
18−
19−struct acpi_dlayer {
20− const char *name;
21− unsigned long value;
22−};
23−struct acpi_dlevel {
24− const char *name;
25− unsigned long value;
26−};
27−#define ACPI_DEBUG_INIT(v) { .name = #v, .value = v }
28−
29−static const struct acpi_dlayer acpi_debug_layers[] = {
30− ACPI_DEBUG_INIT(ACPI_UTILITIES),
31− ACPI_DEBUG_INIT(ACPI_HARDWARE),
32− ACPI_DEBUG_INIT(ACPI_EVENTS),
33− ACPI_DEBUG_INIT(ACPI_TABLES),
34− ACPI_DEBUG_INIT(ACPI_NAMESPACE),
35− ACPI_DEBUG_INIT(ACPI_PARSER),
36− ACPI_DEBUG_INIT(ACPI_DISPATCHER),
37− ACPI_DEBUG_INIT(ACPI_EXECUTER),
38− ACPI_DEBUG_INIT(ACPI_RESOURCES),
39− ACPI_DEBUG_INIT(ACPI_CA_DEBUGGER),
40− ACPI_DEBUG_INIT(ACPI_OS_SERVICES),
41− ACPI_DEBUG_INIT(ACPI_CA_DISASSEMBLER),
42− ACPI_DEBUG_INIT(ACPI_COMPILER),
43− ACPI_DEBUG_INIT(ACPI_TOOLS),
44−
45− ACPI_DEBUG_INIT(ACPI_BUS_COMPONENT),
46− ACPI_DEBUG_INIT(ACPI_AC_COMPONENT),
47− ACPI_DEBUG_INIT(ACPI_BATTERY_COMPONENT),
48− ACPI_DEBUG_INIT(ACPI_BUTTON_COMPONENT),
49− ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT),
50− ACPI_DEBUG_INIT(ACPI_FAN_COMPONENT),
51− ACPI_DEBUG_INIT(ACPI_PCI_COMPONENT),
52− ACPI_DEBUG_INIT(ACPI_POWER_COMPONENT),
53− ACPI_DEBUG_INIT(ACPI_CONTAINER_COMPONENT),
54− ACPI_DEBUG_INIT(ACPI_SYSTEM_COMPONENT),
55− ACPI_DEBUG_INIT(ACPI_THERMAL_COMPONENT),
56− ACPI_DEBUG_INIT(ACPI_MEMORY_DEVICE_COMPONENT),
57− ACPI_DEBUG_INIT(ACPI_VIDEO_COMPONENT),
58− ACPI_DEBUG_INIT(ACPI_PROCESSOR_COMPONENT),
59−};
60−
61−static const struct acpi_dlevel acpi_debug_levels[] = {
62− ACPI_DEBUG_INIT(ACPI_LV_INIT),
63− ACPI_DEBUG_INIT(ACPI_LV_DEBUG_OBJECT),
64− ACPI_DEBUG_INIT(ACPI_LV_INFO),
65−
66− ACPI_DEBUG_INIT(ACPI_LV_INIT_NAMES),
67− ACPI_DEBUG_INIT(ACPI_LV_PARSE),
68− ACPI_DEBUG_INIT(ACPI_LV_LOAD),
69− ACPI_DEBUG_INIT(ACPI_LV_DISPATCH),
70− ACPI_DEBUG_INIT(ACPI_LV_EXEC),
71− ACPI_DEBUG_INIT(ACPI_LV_NAMES),
72− ACPI_DEBUG_INIT(ACPI_LV_OPREGION),
73− ACPI_DEBUG_INIT(ACPI_LV_BFIELD),
74− ACPI_DEBUG_INIT(ACPI_LV_TABLES),
75− ACPI_DEBUG_INIT(ACPI_LV_VALUES),
76− ACPI_DEBUG_INIT(ACPI_LV_OBJECTS),
77− ACPI_DEBUG_INIT(ACPI_LV_RESOURCES),
78− ACPI_DEBUG_INIT(ACPI_LV_USER_REQUESTS),
79− ACPI_DEBUG_INIT(ACPI_LV_PACKAGE),
80−
81− ACPI_DEBUG_INIT(ACPI_LV_ALLOCATIONS),
82− ACPI_DEBUG_INIT(ACPI_LV_FUNCTIONS),
83− ACPI_DEBUG_INIT(ACPI_LV_OPTIMIZATIONS),
84−
85− ACPI_DEBUG_INIT(ACPI_LV_MUTEX),
86− ACPI_DEBUG_INIT(ACPI_LV_THREADS),
87− ACPI_DEBUG_INIT(ACPI_LV_IO),
88− ACPI_DEBUG_INIT(ACPI_LV_INTERRUPTS),
89−
90− ACPI_DEBUG_INIT(ACPI_LV_AML_DISASSEMBLE),
91− ACPI_DEBUG_INIT(ACPI_LV_VERBOSE_INFO),
92− ACPI_DEBUG_INIT(ACPI_LV_FULL_TABLES),
93− ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
94−};
95−
96−/* --------------------------------------------------------------------------
97− FS Interface (/sys)
98− -------------------------------------------------------------------------- */
99−static int param_get_debug_layer(char *buffer, const struct kernel_param *kp)
100−{
101− int result = 0;
102− int i;
103−
104− result = sprintf(buffer, "%-25s\tHex SET\n", "Description");
105−
106− for(i = 0; i <ARRAY_SIZE(acpi_debug_layers); i++) {
107− result += sprintf(buffer+result, "%-25s\t0x%08lX [%c]\n",
108− acpi_debug_layers[i].name,
109− acpi_debug_layers[i].value,
110− (acpi_dbg_layer & acpi_debug_layers[i].value) ? '*' : ' ');
111− }
112− result += sprintf(buffer+result, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
113− ACPI_ALL_DRIVERS,
114− (acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
115− ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
116− ACPI_ALL_DRIVERS) == 0 ? ' ' : '-');
117− result += sprintf(buffer+result, "--\ndebug_layer = 0x%08X ( * = enabled)\n", acpi_dbg_layer);
118−
119− return result;
120−}
121−
122−static int param_get_debug_level(char *buffer, const struct kernel_param *kp)
123−{
124− int result = 0;
125− int i;
126−
127− result = sprintf(buffer, "%-25s\tHex SET\n", "Description");
128−
129− for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
130− result += sprintf(buffer+result, "%-25s\t0x%08lX [%c]\n",
131− acpi_debug_levels[i].name,
132− acpi_debug_levels[i].value,
133− (acpi_dbg_level & acpi_debug_levels[i].
134− value) ? '*' : ' ');
135− }
136− result += sprintf(buffer+result, "--\ndebug_level = 0x%08X (* = enabled)\n",
137− acpi_dbg_level);
138−
139− return result;
140−}
141−
142−static struct kernel_param_ops acpi_debug_layer_ops = {
143− .set = param_set_uint,
144− .get = param_get_debug_layer,
145−};
146−
147−static struct kernel_param_ops acpi_debug_level_ops = {
148− .set = param_set_uint,
149− .get = param_get_debug_level,
150−};
151−
152−module_param_cb(debug_layer, &acpi_debug_layer_ops, &acpi_dbg_layer, 0644);
153−module_param_cb(debug_level, &acpi_debug_level_ops, &acpi_dbg_level, 0644);
154−
155−static char trace_method_name[6];
156−module_param_string(trace_method_name, trace_method_name, 6, 0644);
157−static unsigned int trace_debug_layer;
158−module_param(trace_debug_layer, uint, 0644);
159−static unsigned int trace_debug_level;
160−module_param(trace_debug_level, uint, 0644);
161−
162−static int param_set_trace_state(const char *val, const struct kernel_param *kp)
163−{
164− int result = 0;
165−
166− if (!strncmp(val, "enable", strlen("enable") - 1)) {
167− result = acpi_debug_trace(trace_method_name, trace_debug_level,
168− trace_debug_layer, 0);
169− if (result)
170− result = -EBUSY;
171− goto exit;
172− }
173−
174− if (!strncmp(val, "disable", strlen("disable") - 1)) {
175− int name = 0;
176− result = acpi_debug_trace((char *)&name, trace_debug_level,
177− trace_debug_layer, 0);
178− if (result)
179− result = -EBUSY;
180− goto exit;
181− }
182−
183− if (!strncmp(val, "1", 1)) {
184− result = acpi_debug_trace(trace_method_name, trace_debug_level,
185− trace_debug_layer, 1);
186− if (result)
187− result = -EBUSY;
188− goto exit;
189− }
190−
191− result = -EINVAL;
192−exit:
193− return result;
194−}
195−
196−static int param_get_trace_state(char *buffer, const struct kernel_param *kp)
197−{
198− if (!acpi_gbl_trace_method_name)
199− return sprintf(buffer, "disable");
200− else {
201− if (acpi_gbl_trace_flags & 1)
202− return sprintf(buffer, "1");
203− else
204− return sprintf(buffer, "enable");
205− }
206− return 0;
207−}
208−
209−static struct kernel_param_ops param_ops_trace_state = {
210− .set = param_set_trace_state,
211− .get = param_get_trace_state,
212−};
213−
214−module_param_cb(trace_state, &param_ops_trace_state, NULL, 0644);
215−
216−/* --------------------------------------------------------------------------
217− DebugFS Interface
218− -------------------------------------------------------------------------- */
219−
220−static ssize_t cm_write(struct file *file, const char __user *user_buf,
221− size_t count, loff_t *ppos)
222−{
223− static char *buf;
224− static int uncopied_bytes;
225− struct acpi_table_header table;
226− acpi_status status;
227−
228− if (!(*ppos)) {
229− /* parse the table header to get the table length */
230− if (count <= sizeof(struct acpi_table_header))
231− return -EINVAL;
232− if (copy_from_user(&table, user_buf,
233− sizeof(struct acpi_table_header)))
234− return -EFAULT;
235− uncopied_bytes = table.length;
236− buf = kzalloc(uncopied_bytes, GFP_KERNEL);
237− if (!buf)
238− return -ENOMEM;
239− }
240−
241− if (uncopied_bytes < count) {
242− kfree(buf);
243− return -EINVAL;
244− }
245−
246− if (copy_from_user(buf + (*ppos), user_buf, count)) {
247− kfree(buf);
248− return -EFAULT;
249− }
250−
251− uncopied_bytes -= count;
252− *ppos += count;
253−
254− if (!uncopied_bytes) {
255− status = acpi_install_method(buf);
256− kfree(buf);
257− if (ACPI_FAILURE(status))
258− return -EINVAL;
259− add_taint(TAINT_OVERRIDDEN_ACPI_TABLE);
260− }
261−
262− return count;
263−}
264−
265−static const struct file_operations cm_fops = {
266− .write = cm_write,
267−};
268−
269−static int acpi_debugfs_init(void)
270−{
271− struct dentry *acpi_dir, *cm_dentry;
272−
273− acpi_dir = debugfs_create_dir("acpi", NULL);
274− if (!acpi_dir)
275− goto err;
276−
277− cm_dentry = debugfs_create_file("custom_method", S_IWUGO,
278− acpi_dir, NULL, &cm_fops);
279− if (!cm_dentry)
280− goto err;
281−
282− return 0;
283−
284−err:
285− if (acpi_dir)
286− debugfs_remove(acpi_dir);
287− return -EINVAL;
288−}
289−
290−/* --------------------------------------------------------------------------
291− FS Interface (/proc)
292− -------------------------------------------------------------------------- */
293−#ifdef CONFIG_ACPI_PROCFS
294−#define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer"
295−#define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level"
296−
297−static int acpi_system_debug_proc_show(struct seq_file *m, void *v)
298−{
299− unsigned int i;
300−
301− seq_printf(m, "%-25s\tHex SET\n", "Description");
302−
303− switch ((unsigned long)m->private) {
304− case 0:
305− for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) {
306− seq_printf(m, "%-25s\t0x%08lX [%c]\n",
307− acpi_debug_layers[i].name,
308− acpi_debug_layers[i].value,
309− (acpi_dbg_layer & acpi_debug_layers[i].
310− value) ? '*' : ' ');
311− }
312− seq_printf(m, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
313− ACPI_ALL_DRIVERS,
314− (acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
315− ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
316− ACPI_ALL_DRIVERS) ==
317− 0 ? ' ' : '-');
318− seq_printf(m,
319− "--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
320− acpi_dbg_layer);
321− break;
322− case 1:
323− for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
324− seq_printf(m, "%-25s\t0x%08lX [%c]\n",
325− acpi_debug_levels[i].name,
326− acpi_debug_levels[i].value,
327− (acpi_dbg_level & acpi_debug_levels[i].
328− value) ? '*' : ' ');
329− }
330− seq_printf(m, "--\ndebug_level = 0x%08X (* = enabled)\n",
331− acpi_dbg_level);
332− break;
333− }
334− return 0;
335−}
336−
337−static int acpi_system_debug_proc_open(struct inode *inode, struct file *file)
338−{
339− return single_open(file, acpi_system_debug_proc_show, PDE(inode)->data);
340−}
341−
342−static ssize_t acpi_system_debug_proc_write(struct file *file,
343− const char __user * buffer,
344− size_t count, loff_t *pos)
345−{
346− char debug_string[12] = { '\0' };
347−
348−
349− if (count > sizeof(debug_string) - 1)
350− return -EINVAL;
351−
352− if (copy_from_user(debug_string, buffer, count))
353− return -EFAULT;
354−
355− debug_string[count] = '\0';
356−
357− switch ((unsigned long)PDE(file->f_path.dentry->d_inode)->data) {
358− case 0:
359− acpi_dbg_layer = simple_strtoul(debug_string, NULL, 0);
360− break;
361− case 1:
362− acpi_dbg_level = simple_strtoul(debug_string, NULL, 0);
363− break;
364− default:
365− return -EINVAL;
366− }
367−
368− return count;
369−}
370−
371−static const struct file_operations acpi_system_debug_proc_fops = {
372− .owner = THIS_MODULE,
373− .open = acpi_system_debug_proc_open,
374− .read = seq_read,
375− .llseek = seq_lseek,
376− .release = single_release,
377− .write = acpi_system_debug_proc_write,
378−};
379−#endif
380−
381−int __init acpi_procfs_init(void)
382−{
383−#ifdef CONFIG_ACPI_PROCFS
384− struct proc_dir_entry *entry;
385− int error = 0;
386− char *name;
387−
388− /* 'debug_layer' [R/W] */
389− name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
390− entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUSR,
391− acpi_root_dir, &acpi_system_debug_proc_fops,
392− (void *)0);
393− if (!entry)
394− goto Error;
395−
396− /* 'debug_level' [R/W] */
397− name = ACPI_SYSTEM_FILE_DEBUG_LEVEL;
398− entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUSR,
399− acpi_root_dir, &acpi_system_debug_proc_fops,
400− (void *)1);
401− if (!entry)
402− goto Error;
403−
404− Done:
405− return error;
406−
407− Error:
408− remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir);
409− remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir);
410− error = -ENODEV;
411− goto Done;
412−#else
413− return 0;
414−#endif
415−}
416−
417−int __init acpi_debug_init(void)
418−{
419− acpi_debugfs_init();
420− acpi_procfs_init();
421− return 0;
422−}
drivers/acpi/debugfs.c+93−0
@@ -0,0 +1,93 @@
1+/*
2+ * debugfs.c - ACPI debugfs interface to userspace.
3+ */
4+
5+#include <linux/init.h>
6+#include <linux/module.h>
7+#include <linux/kernel.h>
8+#include <linux/uaccess.h>
9+#include <linux/debugfs.h>
10+#include <acpi/acpi_drivers.h>
11+
12+#define _COMPONENT ACPI_SYSTEM_COMPONENT
13+ACPI_MODULE_NAME("debugfs");
14+
15+
16+/* /sys/modules/acpi/parameters/aml_debug_output */
17+
18+module_param_named(aml_debug_output, acpi_gbl_enable_aml_debug_object,
19+ bool, 0644);
20+MODULE_PARM_DESC(aml_debug_output,
21+ "To enable/disable the ACPI Debug Object output.");
22+
23+/* /sys/kernel/debug/acpi/custom_method */
24+
25+static ssize_t cm_write(struct file *file, const char __user * user_buf,
26+ size_t count, loff_t *ppos)
27+{
28+ static char *buf;
29+ static int uncopied_bytes;
30+ struct acpi_table_header table;
31+ acpi_status status;
32+
33+ if (!(*ppos)) {
34+ /* parse the table header to get the table length */
35+ if (count <= sizeof(struct acpi_table_header))
36+ return -EINVAL;
37+ if (copy_from_user(&table, user_buf,
38+ sizeof(struct acpi_table_header)))
39+ return -EFAULT;
40+ uncopied_bytes = table.length;
41+ buf = kzalloc(uncopied_bytes, GFP_KERNEL);
42+ if (!buf)
43+ return -ENOMEM;
44+ }
45+
46+ if (uncopied_bytes < count) {
47+ kfree(buf);
48+ return -EINVAL;
49+ }
50+
51+ if (copy_from_user(buf + (*ppos), user_buf, count)) {
52+ kfree(buf);
53+ return -EFAULT;
54+ }
55+
56+ uncopied_bytes -= count;
57+ *ppos += count;
58+
59+ if (!uncopied_bytes) {
60+ status = acpi_install_method(buf);
61+ kfree(buf);
62+ if (ACPI_FAILURE(status))
63+ return -EINVAL;
64+ add_taint(TAINT_OVERRIDDEN_ACPI_TABLE);
65+ }
66+
67+ return count;
68+}
69+
70+static const struct file_operations cm_fops = {
71+ .write = cm_write,
72+};
73+
74+int __init acpi_debugfs_init(void)
75+{
76+ struct dentry *acpi_dir, *cm_dentry;
77+
78+ acpi_dir = debugfs_create_dir("acpi", NULL);
79+ if (!acpi_dir)
80+ goto err;
81+
82+ cm_dentry = debugfs_create_file("custom_method", S_IWUGO,
83+ acpi_dir, NULL, &cm_fops);
84+ if (!cm_dentry)
85+ goto err;
86+
87+ return 0;
88+
89+err:
90+ if (acpi_dir)
91+ debugfs_remove(acpi_dir);
92+ return -EINVAL;
93+}
drivers/acpi/glue.c+2−1
@@ -100,7 +100,8 @@ do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv) · 99 unmodified lines
100100
101101 status = acpi_get_object_info(handle, &info);
102102 if (ACPI_SUCCESS(status)) {
103− if (info->address == find->address)
103+ if ((info->address == find->address)
104+ && (info->valid & ACPI_VALID_ADR))
104105 find->handle = handle;
105106 kfree(info);
106107 }
drivers/acpi/internal.h+4−4
@@ -27,12 +27,12 @@ · 26 unmodified lines
2727
2828 int init_acpi_device_notify(void);
2929 int acpi_scan_init(void);
30−int acpi_system_init(void);
30+int acpi_sysfs_init(void);
3131
32−#ifdef CONFIG_ACPI_DEBUG
33−int acpi_debug_init(void);
32+#ifdef CONFIG_DEBUG_FS
33+int acpi_debugfs_init(void);
3434 #else
35−static inline int acpi_debug_init(void) { return 0; }
35+static inline int acpi_debugfs_init(void) { return 0; }
3636 #endif
3737
3838 /* --------------------------------------------------------------------------
drivers/acpi/numa.c+1−3
@@ -255,12 +255,10 @@ acpi_parse_memory_affinity(struct acpi_subtable_header * header, · 254 unmodified lines
255255
256256 static int __init acpi_parse_srat(struct acpi_table_header *table)
257257 {
258− struct acpi_table_srat *srat;
259−
260258 if (!table)
261259 return -EINVAL;
262260
263− srat = (struct acpi_table_srat *)table;
261+ /* Real work done in acpi_table_parse_srat below. */
264262
265263 return 0;
266264 }
drivers/acpi/osl.c+3−4
@@ -141,15 +141,14 @@ static struct osi_linux { · 140 unmodified lines
141141 static void __init acpi_request_region (struct acpi_generic_address *addr,
142142 unsigned int length, char *desc)
143143 {
144− struct resource *res;
145−
146144 if (!addr->address || !length)
147145 return;
148146
147+ /* Resources are never freed */
149148 if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
150− res = request_region(addr->address, length, desc);
149+ request_region(addr->address, length, desc);
151150 else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
152− res = request_mem_region(addr->address, length, desc);
151+ request_mem_region(addr->address, length, desc);
153152 }
154153
155154 static int __init acpi_reserve_resources(void)
drivers/acpi/power.c+1−128
@@ -40,8 +40,6 @@ · 39 unmodified lines
4040 #include <linux/init.h>
4141 #include <linux/types.h>
4242 #include <linux/slab.h>
43−#include <linux/proc_fs.h>
44−#include <linux/seq_file.h>
4543 #include <acpi/acpi_bus.h>
4644 #include <acpi/acpi_drivers.h>
4745 #include "sleep.h"
@@ -64,7 +62,6 @@ module_param_named(power_nocheck, acpi_power_nocheck, bool, 000); · 16 unmodified lines
6462 static int acpi_power_add(struct acpi_device *device);
6563 static int acpi_power_remove(struct acpi_device *device, int type);
6664 static int acpi_power_resume(struct acpi_device *device);
67−static int acpi_power_open_fs(struct inode *inode, struct file *file);
6865
6966 static const struct acpi_device_id power_device_ids[] = {
7067 {ACPI_POWER_HID, 0},
@@ -99,14 +96,6 @@ struct acpi_power_resource { · 28 unmodified lines
9996
10097 static struct list_head acpi_power_resource_list;
10198
102−static const struct file_operations acpi_power_fops = {
103− .owner = THIS_MODULE,
104− .open = acpi_power_open_fs,
105− .read = seq_read,
106− .llseek = seq_lseek,
107− .release = single_release,
108−};
109−
11099 /* --------------------------------------------------------------------------
111100 Power Resource Management
112101 -------------------------------------------------------------------------- */
@@ -255,7 +244,6 @@ static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev) · 142 unmodified lines
255244 struct list_head *node, *next;
256245 struct acpi_power_reference *ref;
257246
258−
259247 result = acpi_power_get_context(handle, &resource);
260248 if (result)
261249 return result;
@@ -541,102 +529,6 @@ int acpi_power_transition(struct acpi_device *device, int state) · 279 unmodified lines
541529 return result;
542530 }
543531
544−/* --------------------------------------------------------------------------
545− FS Interface (/proc)
546− -------------------------------------------------------------------------- */
547−
548−static struct proc_dir_entry *acpi_power_dir;
549−
550−static int acpi_power_seq_show(struct seq_file *seq, void *offset)
551−{
552− int count = 0;
553− int result = 0, state;
554− struct acpi_power_resource *resource = NULL;
555− struct list_head *node, *next;
556− struct acpi_power_reference *ref;
557−
558−
559− resource = seq->private;
560−
561− if (!resource)
562− goto end;
563−
564− result = acpi_power_get_state(resource->device->handle, &state);
565− if (result)
566− goto end;
567−
568− seq_puts(seq, "state: ");
569− switch (state) {
570− case ACPI_POWER_RESOURCE_STATE_ON:
571− seq_puts(seq, "on\n");
572− break;
573− case ACPI_POWER_RESOURCE_STATE_OFF:
574− seq_puts(seq, "off\n");
575− break;
576− default:
577− seq_puts(seq, "unknown\n");
578− break;
579− }
580−
581− mutex_lock(&resource->resource_lock);
582− list_for_each_safe(node, next, &resource->reference) {
583− ref = container_of(node, struct acpi_power_reference, node);
584− count++;
585− }
586− mutex_unlock(&resource->resource_lock);
587−
588− seq_printf(seq, "system level: S%d\n"
589− "order: %d\n"
590− "reference count: %d\n",
591− resource->system_level,
592− resource->order, count);
593−
594− end:
595− return 0;
596−}
597−
598−static int acpi_power_open_fs(struct inode *inode, struct file *file)
599−{
600− return single_open(file, acpi_power_seq_show, PDE(inode)->data);
601−}
602−
603−static int acpi_power_add_fs(struct acpi_device *device)
604−{
605− struct proc_dir_entry *entry = NULL;
606−
607−
608− if (!device)
609− return -EINVAL;
610−
611− if (!acpi_device_dir(device)) {
612− acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
613− acpi_power_dir);
614− if (!acpi_device_dir(device))
615− return -ENODEV;
616− }
617−
618− /* 'status' [R] */
619− entry = proc_create_data(ACPI_POWER_FILE_STATUS,
620− S_IRUGO, acpi_device_dir(device),
621− &acpi_power_fops, acpi_driver_data(device));
622− if (!entry)
623− return -EIO;
624− return 0;
625−}
626−
627−static int acpi_power_remove_fs(struct acpi_device *device)
628−{
629−
630− if (acpi_device_dir(device)) {
631− remove_proc_entry(ACPI_POWER_FILE_STATUS,
632− acpi_device_dir(device));
633− remove_proc_entry(acpi_device_bid(device), acpi_power_dir);
634− acpi_device_dir(device) = NULL;
635− }
636−
637− return 0;
638−}
639−
640532 /* --------------------------------------------------------------------------
641533 Driver Interface
642534 -------------------------------------------------------------------------- */
@@ -690,10 +582,6 @@ static int acpi_power_add(struct acpi_device *device) · 47 unmodified lines
690582 break;
691583 }
692584
693− result = acpi_power_add_fs(device);
694− if (result)
695− goto end;
696−
697585 printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device),
698586 acpi_device_bid(device), state ? "on" : "off");
699587
@@ -715,8 +603,6 @@ static int acpi_power_remove(struct acpi_device *device, int type) · 15 unmodified lines
715603
716604 resource = acpi_driver_data(device);
717605
718− acpi_power_remove_fs(device);
719−
720606 mutex_lock(&resource->resource_lock);
721607 list_for_each_safe(node, next, &resource->reference) {
722608 struct acpi_power_reference *ref = container_of(node, struct acpi_power_reference, node);
@@ -760,19 +646,6 @@ static int acpi_power_resume(struct acpi_device *device) · 37 unmodified lines
760646
761647 int __init acpi_power_init(void)
762648 {
763− int result = 0;
764−
765649 INIT_LIST_HEAD(&acpi_power_resource_list);
766−
767− acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir);
768− if (!acpi_power_dir)
769− return -ENODEV;
770−
771− result = acpi_bus_register_driver(&acpi_power_driver);
772− if (result < 0) {
773− remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir);
774− return -ENODEV;
775− }
776−
777− return 0;
650+ return acpi_bus_register_driver(&acpi_power_driver);
778651 }
drivers/acpi/proc.c+0−70
@@ -17,64 +17,11 @@ · 16 unmodified lines
1717
1818 /*
1919 * this file provides support for:
20− * /proc/acpi/sleep
2120 * /proc/acpi/alarm
2221 * /proc/acpi/wakeup
2322 */
2423
2524 ACPI_MODULE_NAME("sleep")
26−#ifdef CONFIG_ACPI_PROCFS
27−static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset)
28−{
29− int i;
30−
31− for (i = 0; i <= ACPI_STATE_S5; i++) {
32− if (sleep_states[i]) {
33− seq_printf(seq, "S%d ", i);
34− }
35− }
36−
37− seq_puts(seq, "\n");
38−
39− return 0;
40−}
41−
42−static int acpi_system_sleep_open_fs(struct inode *inode, struct file *file)
43−{
44− return single_open(file, acpi_system_sleep_seq_show, PDE(inode)->data);
45−}
46−
47−static ssize_t
48−acpi_system_write_sleep(struct file *file,
49− const char __user * buffer, size_t count, loff_t * ppos)
50−{
51− char str[12];
52− u32 state = 0;
53− int error = 0;
54−
55− if (count > sizeof(str) - 1)
56− goto Done;
57− memset(str, 0, sizeof(str));
58− if (copy_from_user(str, buffer, count))
59− return -EFAULT;
60−
61− /* Check for S4 bios request */
62− if (!strcmp(str, "4b")) {
63− error = acpi_suspend(4);
64− goto Done;
65− }
66− state = simple_strtoul(str, NULL, 0);
67−#ifdef CONFIG_HIBERNATION
68− if (state == 4) {
69− error = hibernate();
70− goto Done;
71− }
72−#endif
73− error = acpi_suspend(state);
74− Done:
75− return error ? error : count;
76−}
77−#endif /* CONFIG_ACPI_PROCFS */
7825
7926 #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || !defined(CONFIG_X86)
8027 /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */
@@ -463,17 +410,6 @@ static const struct file_operations acpi_system_wakeup_device_fops = { · 382 unmodified lines
463410 .release = single_release,
464411 };
465412
466−#ifdef CONFIG_ACPI_PROCFS
467−static const struct file_operations acpi_system_sleep_fops = {
468− .owner = THIS_MODULE,
469− .open = acpi_system_sleep_open_fs,
470− .read = seq_read,
471− .write = acpi_system_write_sleep,
472− .llseek = seq_lseek,
473− .release = single_release,
474−};
475−#endif /* CONFIG_ACPI_PROCFS */
476−
477413 #ifdef HAVE_ACPI_LEGACY_ALARM
478414 static const struct file_operations acpi_system_alarm_fops = {
479415 .owner = THIS_MODULE,
@@ -495,12 +431,6 @@ static u32 rtc_handler(void *context) · 15 unmodified lines
495431
496432 int __init acpi_sleep_proc_init(void)
497433 {
498−#ifdef CONFIG_ACPI_PROCFS
499− /* 'sleep' [R/W] */
500− proc_create("sleep", S_IFREG | S_IRUGO | S_IWUSR,
501− acpi_root_dir, &acpi_system_sleep_fops);
502−#endif /* CONFIG_ACPI_PROCFS */
503−
504434 #ifdef HAVE_ACPI_LEGACY_ALARM
505435 /* 'alarm' [R/W] */
506436 proc_create("alarm", S_IFREG | S_IRUGO | S_IWUSR,
drivers/acpi/processor_driver.c+0−85
@@ -83,9 +83,6 @@ MODULE_LICENSE("GPL"); · 82 unmodified lines
8383
8484 static int acpi_processor_add(struct acpi_device *device);
8585 static int acpi_processor_remove(struct acpi_device *device, int type);
86−#ifdef CONFIG_ACPI_PROCFS
87−static int acpi_processor_info_open_fs(struct inode *inode, struct file *file);
88−#endif
8986 static void acpi_processor_notify(struct acpi_device *device, u32 event);
9087 static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu);
9188 static int acpi_processor_handle_eject(struct acpi_processor *pr);
@@ -113,15 +110,6 @@ static struct acpi_driver acpi_processor_driver = { · 21 unmodified lines
113110
114111 #define INSTALL_NOTIFY_HANDLER 1
115112 #define UNINSTALL_NOTIFY_HANDLER 2
116−#ifdef CONFIG_ACPI_PROCFS
117−static const struct file_operations acpi_processor_info_fops = {
118− .owner = THIS_MODULE,
119− .open = acpi_processor_info_open_fs,
120− .read = seq_read,
121− .llseek = seq_lseek,
122− .release = single_release,
123−};
124−#endif
125113
126114 DEFINE_PER_CPU(struct acpi_processor *, processors);
127115 EXPORT_PER_CPU_SYMBOL(processors);
@@ -256,44 +244,8 @@ static int acpi_processor_errata(struct acpi_processor *pr) · 128 unmodified lines
256244 return result;
257245 }
258246
259−/* --------------------------------------------------------------------------
260− FS Interface (/proc)
261− -------------------------------------------------------------------------- */
262−
263−#ifdef CONFIG_ACPI_PROCFS
264247 static struct proc_dir_entry *acpi_processor_dir = NULL;
265248
266−static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset)
267−{
268− struct acpi_processor *pr = seq->private;
269−
270−
271− if (!pr)
272− goto end;
273−
274− seq_printf(seq, "processor id: %d\n"
275− "acpi id: %d\n"
276− "bus mastering control: %s\n"
277− "power management: %s\n"
278− "throttling control: %s\n"
279− "limit interface: %s\n",
280− pr->id,
281− pr->acpi_id,
282− pr->flags.bm_control ? "yes" : "no",
283− pr->flags.power ? "yes" : "no",
284− pr->flags.throttling ? "yes" : "no",
285− pr->flags.limit ? "yes" : "no");
286−
287− end:
288− return 0;
289−}
290−
291−static int acpi_processor_info_open_fs(struct inode *inode, struct file *file)
292−{
293− return single_open(file, acpi_processor_info_seq_show,
294− PDE(inode)->data);
295−}
296−
297249 static int __cpuinit acpi_processor_add_fs(struct acpi_device *device)
298250 {
299251 struct proc_dir_entry *entry = NULL;
@@ -306,14 +258,6 @@ static int __cpuinit acpi_processor_add_fs(struct acpi_device *device) · 6 unmodified lines
306258 return -ENODEV;
307259 }
308260
309− /* 'info' [R] */
310− entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO,
311− S_IRUGO, acpi_device_dir(device),
312− &acpi_processor_info_fops,
313− acpi_driver_data(device));
314− if (!entry)
315− return -EIO;
316−
317261 /* 'throttling' [R/W] */
318262 entry = proc_create_data(ACPI_PROCESSOR_FILE_THROTTLING,
319263 S_IFREG | S_IRUGO | S_IWUSR,
@@ -322,43 +266,20 @@ static int __cpuinit acpi_processor_add_fs(struct acpi_device *device) · 2 unmodified lines
322266 acpi_driver_data(device));
323267 if (!entry)
324268 return -EIO;
325−
326− /* 'limit' [R/W] */
327− entry = proc_create_data(ACPI_PROCESSOR_FILE_LIMIT,
328− S_IFREG | S_IRUGO | S_IWUSR,
329− acpi_device_dir(device),
330− &acpi_processor_limit_fops,
331− acpi_driver_data(device));
332− if (!entry)
333− return -EIO;
334269 return 0;
335270 }
336271 static int acpi_processor_remove_fs(struct acpi_device *device)
337272 {
338273
339274 if (acpi_device_dir(device)) {
340− remove_proc_entry(ACPI_PROCESSOR_FILE_INFO,
341− acpi_device_dir(device));
342275 remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING,
343276 acpi_device_dir(device));
344− remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT,
345− acpi_device_dir(device));
346277 remove_proc_entry(acpi_device_bid(device), acpi_processor_dir);
347278 acpi_device_dir(device) = NULL;
348279 }
349280
350281 return 0;
351282 }
352−#else
353−static inline int acpi_processor_add_fs(struct acpi_device *device)
354−{
355− return 0;
356−}
357−static inline int acpi_processor_remove_fs(struct acpi_device *device)
358−{
359− return 0;
360−}
361−#endif
362283
363284 /* --------------------------------------------------------------------------
364285 Driver Interface
@@ -921,11 +842,9 @@ static int __init acpi_processor_init(void) · 556 unmodified lines
921842
922843 memset(&errata, 0, sizeof(errata));
923844
924−#ifdef CONFIG_ACPI_PROCFS
925845 acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
926846 if (!acpi_processor_dir)
927847 return -ENOMEM;
928−#endif
929848
930849 if (!cpuidle_register_driver(&acpi_idle_driver)) {
931850 printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n",
@@ -952,9 +871,7 @@ static int __init acpi_processor_init(void) · 20 unmodified lines
952871 out_cpuidle:
953872 cpuidle_unregister_driver(&acpi_idle_driver);
954873
955−#ifdef CONFIG_ACPI_PROCFS
956874 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
957−#endif
958875
959876 return result;
960877 }
@@ -974,9 +891,7 @@ static void __exit acpi_processor_exit(void) · 13 unmodified lines
974891
975892 cpuidle_unregister_driver(&acpi_idle_driver);
976893
977−#ifdef CONFIG_ACPI_PROCFS
978894 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
979−#endif
980895
981896 return;
982897 }
drivers/acpi/processor_idle.c+1−101
@@ -33,8 +33,6 @@ · 32 unmodified lines
3333 #include <linux/init.h>
3434 #include <linux/cpufreq.h>
3535 #include <linux/slab.h>
36−#include <linux/proc_fs.h>
37−#include <linux/seq_file.h>
3836 #include <linux/acpi.h>
3937 #include <linux/dmi.h>
4038 #include <linux/moduleparam.h>
@@ -82,13 +80,6 @@ module_param(bm_check_disable, uint, 0000); · 41 unmodified lines
8280 static unsigned int latency_factor __read_mostly = 2;
8381 module_param(latency_factor, uint, 0644);
8482
85−#ifdef CONFIG_ACPI_PROCFS
86−static u64 us_to_pm_timer_ticks(s64 t)
87−{
88− return div64_u64(t * PM_TIMER_FREQUENCY, 1000000);
89−}
90−#endif
91−
9283 /*
9384 * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3.
9485 * For now disable this. Probably a bug somewhere else.
@@ -689,78 +680,6 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) · 594 unmodified lines
689680 return 0;
690681 }
691682
692−#ifdef CONFIG_ACPI_PROCFS
693−static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
694−{
695− struct acpi_processor *pr = seq->private;
696− unsigned int i;
697−
698−
699− if (!pr)
700− goto end;
701−
702− seq_printf(seq, "active state: C%zd\n"
703− "max_cstate: C%d\n"
704− "maximum allowed latency: %d usec\n",
705− pr->power.state ? pr->power.state - pr->power.states : 0,
706− max_cstate, pm_qos_request(PM_QOS_CPU_DMA_LATENCY));
707−
708− seq_puts(seq, "states:\n");
709−
710− for (i = 1; i <= pr->power.count; i++) {
711− seq_printf(seq, " %cC%d: ",
712− (&pr->power.states[i] ==
713− pr->power.state ? '*' : ' '), i);
714−
715− if (!pr->power.states[i].valid) {
716− seq_puts(seq, "<not supported>\n");
717− continue;
718− }
719−
720− switch (pr->power.states[i].type) {
721− case ACPI_STATE_C1:
722− seq_printf(seq, "type[C1] ");
723− break;
724− case ACPI_STATE_C2:
725− seq_printf(seq, "type[C2] ");
726− break;
727− case ACPI_STATE_C3:
728− seq_printf(seq, "type[C3] ");
729− break;
730− default:
731− seq_printf(seq, "type[--] ");
732− break;
733− }
734−
735− seq_puts(seq, "promotion[--] ");
736−
737− seq_puts(seq, "demotion[--] ");
738−
739− seq_printf(seq, "latency[%03d] usage[%08d] duration[%020Lu]\n",
740− pr->power.states[i].latency,
741− pr->power.states[i].usage,
742− us_to_pm_timer_ticks(pr->power.states[i].time));
743− }
744−
745− end:
746− return 0;
747−}
748−
749−static int acpi_processor_power_open_fs(struct inode *inode, struct file *file)
750−{
751− return single_open(file, acpi_processor_power_seq_show,
752− PDE(inode)->data);
753−}
754−
755−static const struct file_operations acpi_processor_power_fops = {
756− .owner = THIS_MODULE,
757− .open = acpi_processor_power_open_fs,
758− .read = seq_read,
759− .llseek = seq_lseek,
760− .release = single_release,
761−};
762−#endif
763−
764683 /**
765684 * acpi_idle_bm_check - checks if bus master activity was detected
766685 */
@@ -803,13 +722,12 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx) · 36 unmodified lines
803722 } else if (cx->entry_method == ACPI_CSTATE_HALT) {
804723 acpi_safe_halt();
805724 } else {
806− int unused;
807725 /* IO port based C-state */
808726 inb(cx->address);
809727 /* Dummy wait op - must do something useless after P_LVL2 read
810728 because chipsets cannot guarantee that STPCLK# signal
811729 gets asserted in time to freeze execution properly. */
812− unused = inl(acpi_gbl_FADT.xpm_timer_block.address);
730+ inl(acpi_gbl_FADT.xpm_timer_block.address);
813731 }
814732 start_critical_timings();
815733 }
@@ -1172,9 +1090,6 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, · 356 unmodified lines
11721090 {
11731091 acpi_status status = 0;
11741092 static int first_run;
1175−#ifdef CONFIG_ACPI_PROCFS
1176− struct proc_dir_entry *entry = NULL;
1177−#endif
11781093
11791094 if (boot_option_idle_override)
11801095 return 0;
@@ -1223,15 +1138,6 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, · 42 unmodified lines
12231138 if (cpuidle_register_device(&pr->power.dev))
12241139 return -EIO;
12251140 }
1226−#ifdef CONFIG_ACPI_PROCFS
1227− /* 'power' [R] */
1228− entry = proc_create_data(ACPI_PROCESSOR_FILE_POWER,
1229− S_IRUGO, acpi_device_dir(device),
1230− &acpi_processor_power_fops,
1231− acpi_driver_data(device));
1232− if (!entry)
1233− return -EIO;
1234−#endif
12351141 return 0;
12361142 }
12371143
@@ -1244,11 +1150,5 @@ int acpi_processor_power_exit(struct acpi_processor *pr, · 6 unmodified lines
12441150 cpuidle_unregister_device(&pr->power.dev);
12451151 pr->flags.power_setup_done = 0;
12461152
1247−#ifdef CONFIG_ACPI_PROCFS
1248− if (acpi_device_dir(device))
1249− remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,
1250− acpi_device_dir(device));
1251−#endif
1252−
12531153 return 0;
12541154 }
drivers/acpi/processor_thermal.c+0−83
@@ -30,8 +30,6 @@ · 29 unmodified lines
3030 #include <linux/module.h>
3131 #include <linux/init.h>
3232 #include <linux/cpufreq.h>
33−#include <linux/proc_fs.h>
34−#include <linux/seq_file.h>
3533 #include <linux/sysdev.h>
3634
3735 #include <asm/uaccess.h>
@@ -438,84 +436,3 @@ struct thermal_cooling_device_ops processor_cooling_ops = { · 400 unmodified lines
438436 .get_cur_state = processor_get_cur_state,
439437 .set_cur_state = processor_set_cur_state,
440438 };
441−
442−/* /proc interface */
443−#ifdef CONFIG_ACPI_PROCFS
444−static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset)
445−{
446− struct acpi_processor *pr = seq->private;
447−
448− if (!pr)
449− goto end;
450−
451− if (!pr->flags.limit) {
452− seq_puts(seq, "<not supported>\n");
453− goto end;
454− }
455−
456− seq_printf(seq, "active limit: P%d:T%d\n"
457− "user limit: P%d:T%d\n"
458− "thermal limit: P%d:T%d\n",
459− pr->limit.state.px, pr->limit.state.tx,
460− pr->limit.user.px, pr->limit.user.tx,
461− pr->limit.thermal.px, pr->limit.thermal.tx);
462−
463− end:
464− return 0;
465−}
466−
467−static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file)
468−{
469− return single_open(file, acpi_processor_limit_seq_show,
470− PDE(inode)->data);
471−}
472−
473−static ssize_t acpi_processor_write_limit(struct file * file,
474− const char __user * buffer,
475− size_t count, loff_t * data)
476−{
477− int result = 0;
478− struct seq_file *m = file->private_data;
479− struct acpi_processor *pr = m->private;
480− char limit_string[25] = { '\0' };
481− int px = 0;
482− int tx = 0;
483−
484−
485− if (!pr || (count > sizeof(limit_string) - 1)) {
486− return -EINVAL;
487− }
488−
489− if (copy_from_user(limit_string, buffer, count)) {
490− return -EFAULT;
491− }
492−
493− limit_string[count] = '\0';
494−
495− if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) {
496− printk(KERN_ERR PREFIX "Invalid data format\n");
497− return -EINVAL;
498− }
499−
500− if (pr->flags.throttling) {
501− if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) {
502− printk(KERN_ERR PREFIX "Invalid tx\n");
503− return -EINVAL;
504− }
505− pr->limit.user.tx = tx;
506− }
507−
508− result = acpi_processor_apply_limit(pr);
509−
510− return count;
511−}
512−
513−const struct file_operations acpi_processor_limit_fops = {
514− .owner = THIS_MODULE,
515− .open = acpi_processor_limit_open_fs,
516− .read = seq_read,
517− .write = acpi_processor_write_limit,
518− .llseek = seq_lseek,
519− .release = single_release,
520−};
521−#endif
drivers/acpi/processor_throttling.c+0−2
@@ -1215,7 +1215,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) · 1214 unmodified lines
12151215 }
12161216
12171217 /* proc interface */
1218−#ifdef CONFIG_ACPI_PROCFS
12191218 static int acpi_processor_throttling_seq_show(struct seq_file *seq,
12201219 void *offset)
12211220 {
@@ -1323,4 +1322,3 @@ const struct file_operations acpi_processor_throttling_fops = { · 101 unmodified lines
13231322 .llseek = seq_lseek,
13241323 .release = single_release,
13251324 };
1326−#endif
drivers/acpi/sleep.c+21−39
@@ -70,10 +70,10 @@ static int acpi_sleep_prepare(u32 acpi_state) · 69 unmodified lines
7070
7171 }
7272 ACPI_FLUSH_CPU_CACHE();
73− acpi_enable_wakeup_device_prep(acpi_state);
7473 #endif
7574 printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n",
7675 acpi_state);
76+ acpi_enable_wakeup_devices(acpi_state);
7777 acpi_enter_sleep_state_prep(acpi_state);
7878 return 0;
7979 }
@@ -118,6 +118,16 @@ static int acpi_pm_freeze(void) · 38 unmodified lines
118118 return 0;
119119 }
120120
121+/**
122+ * acpi_pre_suspend - Enable wakeup devices, "freeze" EC and save NVS.
123+ */
124+static int acpi_pm_pre_suspend(void)
125+{
126+ acpi_pm_freeze();
127+ suspend_nvs_save();
128+ return 0;
129+}
130+
121131 /**
122132 * __acpi_pm_prepare - Prepare the platform to enter the target state.
123133 *
@@ -127,11 +137,9 @@ static int acpi_pm_freeze(void) · 3 unmodified lines
127137 static int __acpi_pm_prepare(void)
128138 {
129139 int error = acpi_sleep_prepare(acpi_target_sleep_state);
130−
131− suspend_nvs_save();
132−
133140 if (error)
134141 acpi_target_sleep_state = ACPI_STATE_S0;
142+
135143 return error;
136144 }
137145
@@ -142,9 +150,8 @@ static int __acpi_pm_prepare(void) · 4 unmodified lines
142150 static int acpi_pm_prepare(void)
143151 {
144152 int error = __acpi_pm_prepare();
145−
146153 if (!error)
147− acpi_pm_freeze();
154+ acpi_pm_pre_suspend();
148155
149156 return error;
150157 }
@@ -159,7 +166,6 @@ static void acpi_pm_finish(void) · 8 unmodified lines
159166 {
160167 u32 acpi_state = acpi_target_sleep_state;
161168
162− suspend_nvs_free();
163169 acpi_ec_unblock_transactions();
164170
165171 if (acpi_state == ACPI_STATE_S0)
@@ -167,7 +173,7 @@ static void acpi_pm_finish(void) · 1 unmodified line
167173
168174 printk(KERN_INFO PREFIX "Waking up from system sleep state S%d\n",
169175 acpi_state);
170− acpi_disable_wakeup_device(acpi_state);
176+ acpi_disable_wakeup_devices(acpi_state);
171177 acpi_leave_sleep_state(acpi_state);
172178
173179 /* reset firmware waking vector */
@@ -181,6 +187,7 @@ static void acpi_pm_finish(void) · 7 unmodified lines
181187 */
182188 static void acpi_pm_end(void)
183189 {
190+ suspend_nvs_free();
184191 /*
185192 * This is necessary in case acpi_pm_finish() is not called during a
186193 * failing transition to a sleep state.
@@ -251,7 +258,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state) · 64 unmodified lines
251258 }
252259
253260 local_irq_save(flags);
254− acpi_enable_wakeup_device(acpi_state);
255261 switch (acpi_state) {
256262 case ACPI_STATE_S1:
257263 barrier();
@@ -297,11 +303,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state) · 39 unmodified lines
297303 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
298304 }
299305
300−static void acpi_suspend_finish(void)
301−{
302− acpi_pm_finish();
303−}
304−
305306 static int acpi_suspend_state_valid(suspend_state_t pm_state)
306307 {
307308 u32 acpi_state;
@@ -323,7 +324,7 @@ static struct platform_suspend_ops acpi_suspend_ops = { · 15 unmodified lines
323324 .begin = acpi_suspend_begin,
324325 .prepare_late = acpi_pm_prepare,
325326 .enter = acpi_suspend_enter,
326− .wake = acpi_suspend_finish,
327+ .wake = acpi_pm_finish,
327328 .end = acpi_pm_end,
328329 };
329330
@@ -336,9 +337,9 @@ static struct platform_suspend_ops acpi_suspend_ops = { · 6 unmodified lines
336337 static int acpi_suspend_begin_old(suspend_state_t pm_state)
337338 {
338339 int error = acpi_suspend_begin(pm_state);
339−
340340 if (!error)
341341 error = __acpi_pm_prepare();
342+
342343 return error;
343344 }
344345
@@ -349,9 +350,9 @@ static int acpi_suspend_begin_old(suspend_state_t pm_state) · 4 unmodified lines
349350 static struct platform_suspend_ops acpi_suspend_ops_old = {
350351 .valid = acpi_suspend_state_valid,
351352 .begin = acpi_suspend_begin_old,
352− .prepare_late = acpi_pm_freeze,
353+ .prepare_late = acpi_pm_pre_suspend,
353354 .enter = acpi_suspend_enter,
354− .wake = acpi_suspend_finish,
355+ .wake = acpi_pm_finish,
355356 .end = acpi_pm_end,
356357 .recover = acpi_pm_finish,
357358 };
@@ -423,16 +424,6 @@ static int acpi_hibernation_begin(void) · 65 unmodified lines
423424 return error;
424425 }
425426
426−static int acpi_hibernation_pre_snapshot(void)
427−{
428− int error = acpi_pm_prepare();
429−
430− if (!error)
431− suspend_nvs_save();
432−
433− return error;
434−}
435−
436427 static int acpi_hibernation_enter(void)
437428 {
438429 acpi_status status = AE_OK;
@@ -441,7 +432,6 @@ static int acpi_hibernation_enter(void) · 2 unmodified lines
441432 ACPI_FLUSH_CPU_CACHE();
442433
443434 local_irq_save(flags);
444− acpi_enable_wakeup_device(ACPI_STATE_S4);
445435 /* This shouldn't return. If it returns, we have a problem */
446436 status = acpi_enter_sleep_state(ACPI_STATE_S4);
447437 /* Reprogram control registers and execute _BFS */
@@ -481,7 +471,7 @@ static void acpi_pm_thaw(void) · 33 unmodified lines
481471 static struct platform_hibernation_ops acpi_hibernation_ops = {
482472 .begin = acpi_hibernation_begin,
483473 .end = acpi_pm_end,
484− .pre_snapshot = acpi_hibernation_pre_snapshot,
474+ .pre_snapshot = acpi_pm_prepare,
485475 .finish = acpi_pm_finish,
486476 .prepare = acpi_pm_prepare,
487477 .enter = acpi_hibernation_enter,
@@ -517,13 +507,6 @@ static int acpi_hibernation_begin_old(void) · 29 unmodified lines
517507 return error;
518508 }
519509
520−static int acpi_hibernation_pre_snapshot_old(void)
521−{
522− acpi_pm_freeze();
523− suspend_nvs_save();
524− return 0;
525−}
526−
527510 /*
528511 * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
529512 * been requested.
@@ -531,7 +514,7 @@ static int acpi_hibernation_pre_snapshot_old(void) · 1 unmodified line
531514 static struct platform_hibernation_ops acpi_hibernation_ops_old = {
532515 .begin = acpi_hibernation_begin_old,
533516 .end = acpi_pm_end,
534− .pre_snapshot = acpi_hibernation_pre_snapshot_old,
517+ .pre_snapshot = acpi_pm_pre_suspend,
535518 .prepare = acpi_pm_freeze,
536519 .finish = acpi_pm_finish,
537520 .enter = acpi_hibernation_enter,
@@ -686,7 +669,6 @@ static void acpi_power_off(void) · 148 unmodified lines
686669 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
687670 printk(KERN_DEBUG "%s called\n", __func__);
688671 local_irq_disable();
689− acpi_enable_wakeup_device(ACPI_STATE_S5);
690672 acpi_enter_sleep_state(ACPI_STATE_S5);
691673 }
692674
drivers/acpi/sleep.h+2−3
@@ -2,9 +2,8 @@ · 1 unmodified line
22 extern u8 sleep_states[];
33 extern int acpi_suspend(u32 state);
44
5−extern void acpi_enable_wakeup_device_prep(u8 sleep_state);
6−extern void acpi_enable_wakeup_device(u8 sleep_state);
7−extern void acpi_disable_wakeup_device(u8 sleep_state);
5+extern void acpi_enable_wakeup_devices(u8 sleep_state);
6+extern void acpi_disable_wakeup_devices(u8 sleep_state);
87
98 extern struct list_head acpi_wakeup_device_list;
109 extern struct mutex acpi_device_lock;
drivers/acpi/sysfs.crenamed from drivers/acpi/system.c+257−209
@@ -1,51 +1,218 @@
11 /*
2− * acpi_system.c - ACPI System Driver ($Revision: 63 $)
3− *
4− * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
5− * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6− *
7− * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8− *
9− * This program is free software; you can redistribute it and/or modify
10− * it under the terms of the GNU General Public License as published by
11− * the Free Software Foundation; either version 2 of the License, or (at
12− * your option) any later version.
13− *
14− * This program is distributed in the hope that it will be useful, but
15− * WITHOUT ANY WARRANTY; without even the implied warranty of
16− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17− * General Public License for more details.
18− *
19− * You should have received a copy of the GNU General Public License along
20− * with this program; if not, write to the Free Software Foundation, Inc.,
21− * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22− *
23− * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2+ * sysfs.c - ACPI sysfs interface to userspace.
243 */
254
26−#include <linux/proc_fs.h>
27−#include <linux/seq_file.h>
28−#include <linux/slab.h>
295 #include <linux/init.h>
30−#include <linux/string.h>
31−#include <asm/uaccess.h>
32−
6+#include <linux/kernel.h>
7+#include <linux/moduleparam.h>
338 #include <acpi/acpi_drivers.h>
349
35−#define PREFIX "ACPI: "
36−
3710 #define _COMPONENT ACPI_SYSTEM_COMPONENT
38−ACPI_MODULE_NAME("system");
39−
40−#define ACPI_SYSTEM_CLASS "system"
41−#define ACPI_SYSTEM_DEVICE_NAME "System"
11+ACPI_MODULE_NAME("sysfs");
4212
43−u32 acpi_irq_handled;
44−u32 acpi_irq_not_handled;
13+#define PREFIX "ACPI: "
4514
15+#ifdef CONFIG_ACPI_DEBUG
4616 /*
47− * Make ACPICA version work as module param
17+ * ACPI debug sysfs I/F, including:
18+ * /sys/modules/acpi/parameters/debug_layer
19+ * /sys/modules/acpi/parameters/debug_level
20+ * /sys/modules/acpi/parameters/trace_method_name
21+ * /sys/modules/acpi/parameters/trace_state
22+ * /sys/modules/acpi/parameters/trace_debug_layer
23+ * /sys/modules/acpi/parameters/trace_debug_level
4824 */
25+
26+struct acpi_dlayer {
27+ const char *name;
28+ unsigned long value;
29+};
30+struct acpi_dlevel {
31+ const char *name;
32+ unsigned long value;
33+};
34+#define ACPI_DEBUG_INIT(v) { .name = #v, .value = v }
35+
36+static const struct acpi_dlayer acpi_debug_layers[] = {
37+ ACPI_DEBUG_INIT(ACPI_UTILITIES),
38+ ACPI_DEBUG_INIT(ACPI_HARDWARE),
39+ ACPI_DEBUG_INIT(ACPI_EVENTS),
40+ ACPI_DEBUG_INIT(ACPI_TABLES),
41+ ACPI_DEBUG_INIT(ACPI_NAMESPACE),
42+ ACPI_DEBUG_INIT(ACPI_PARSER),
43+ ACPI_DEBUG_INIT(ACPI_DISPATCHER),
44+ ACPI_DEBUG_INIT(ACPI_EXECUTER),
45+ ACPI_DEBUG_INIT(ACPI_RESOURCES),
46+ ACPI_DEBUG_INIT(ACPI_CA_DEBUGGER),
47+ ACPI_DEBUG_INIT(ACPI_OS_SERVICES),
48+ ACPI_DEBUG_INIT(ACPI_CA_DISASSEMBLER),
49+ ACPI_DEBUG_INIT(ACPI_COMPILER),
50+ ACPI_DEBUG_INIT(ACPI_TOOLS),
51+
52+ ACPI_DEBUG_INIT(ACPI_BUS_COMPONENT),
53+ ACPI_DEBUG_INIT(ACPI_AC_COMPONENT),
54+ ACPI_DEBUG_INIT(ACPI_BATTERY_COMPONENT),
55+ ACPI_DEBUG_INIT(ACPI_BUTTON_COMPONENT),
56+ ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT),
57+ ACPI_DEBUG_INIT(ACPI_FAN_COMPONENT),
58+ ACPI_DEBUG_INIT(ACPI_PCI_COMPONENT),
59+ ACPI_DEBUG_INIT(ACPI_POWER_COMPONENT),
60+ ACPI_DEBUG_INIT(ACPI_CONTAINER_COMPONENT),
61+ ACPI_DEBUG_INIT(ACPI_SYSTEM_COMPONENT),
62+ ACPI_DEBUG_INIT(ACPI_THERMAL_COMPONENT),
63+ ACPI_DEBUG_INIT(ACPI_MEMORY_DEVICE_COMPONENT),
64+ ACPI_DEBUG_INIT(ACPI_VIDEO_COMPONENT),
65+ ACPI_DEBUG_INIT(ACPI_PROCESSOR_COMPONENT),
66+};
67+
68+static const struct acpi_dlevel acpi_debug_levels[] = {
69+ ACPI_DEBUG_INIT(ACPI_LV_INIT),
70+ ACPI_DEBUG_INIT(ACPI_LV_DEBUG_OBJECT),
71+ ACPI_DEBUG_INIT(ACPI_LV_INFO),
72+
73+ ACPI_DEBUG_INIT(ACPI_LV_INIT_NAMES),
74+ ACPI_DEBUG_INIT(ACPI_LV_PARSE),
75+ ACPI_DEBUG_INIT(ACPI_LV_LOAD),
76+ ACPI_DEBUG_INIT(ACPI_LV_DISPATCH),
77+ ACPI_DEBUG_INIT(ACPI_LV_EXEC),
78+ ACPI_DEBUG_INIT(ACPI_LV_NAMES),
79+ ACPI_DEBUG_INIT(ACPI_LV_OPREGION),
80+ ACPI_DEBUG_INIT(ACPI_LV_BFIELD),
81+ ACPI_DEBUG_INIT(ACPI_LV_TABLES),
82+ ACPI_DEBUG_INIT(ACPI_LV_VALUES),
83+ ACPI_DEBUG_INIT(ACPI_LV_OBJECTS),
84+ ACPI_DEBUG_INIT(ACPI_LV_RESOURCES),
85+ ACPI_DEBUG_INIT(ACPI_LV_USER_REQUESTS),
86+ ACPI_DEBUG_INIT(ACPI_LV_PACKAGE),
87+
88+ ACPI_DEBUG_INIT(ACPI_LV_ALLOCATIONS),
89+ ACPI_DEBUG_INIT(ACPI_LV_FUNCTIONS),
90+ ACPI_DEBUG_INIT(ACPI_LV_OPTIMIZATIONS),
91+
92+ ACPI_DEBUG_INIT(ACPI_LV_MUTEX),
93+ ACPI_DEBUG_INIT(ACPI_LV_THREADS),
94+ ACPI_DEBUG_INIT(ACPI_LV_IO),
95+ ACPI_DEBUG_INIT(ACPI_LV_INTERRUPTS),
96+
97+ ACPI_DEBUG_INIT(ACPI_LV_AML_DISASSEMBLE),
98+ ACPI_DEBUG_INIT(ACPI_LV_VERBOSE_INFO),
99+ ACPI_DEBUG_INIT(ACPI_LV_FULL_TABLES),
100+ ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
101+};
102+
103+static int param_get_debug_layer(char *buffer, struct kernel_param *kp)
104+{
105+ int result = 0;
106+ int i;
107+
108+ result = sprintf(buffer, "%-25s\tHex SET\n", "Description");
109+
110+ for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) {
111+ result += sprintf(buffer + result, "%-25s\t0x%08lX [%c]\n",
112+ acpi_debug_layers[i].name,
113+ acpi_debug_layers[i].value,
114+ (acpi_dbg_layer & acpi_debug_layers[i].value)
115+ ? '*' : ' ');
116+ }
117+ result +=
118+ sprintf(buffer + result, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
119+ ACPI_ALL_DRIVERS,
120+ (acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
121+ ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer & ACPI_ALL_DRIVERS)
122+ == 0 ? ' ' : '-');
123+ result +=
124+ sprintf(buffer + result,
125+ "--\ndebug_layer = 0x%08X ( * = enabled)\n",
126+ acpi_dbg_layer);
127+
128+ return result;
129+}
130+
131+static int param_get_debug_level(char *buffer, struct kernel_param *kp)
132+{
133+ int result = 0;
134+ int i;
135+
136+ result = sprintf(buffer, "%-25s\tHex SET\n", "Description");
137+
138+ for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
139+ result += sprintf(buffer + result, "%-25s\t0x%08lX [%c]\n",
140+ acpi_debug_levels[i].name,
141+ acpi_debug_levels[i].value,
142+ (acpi_dbg_level & acpi_debug_levels[i].value)
143+ ? '*' : ' ');
144+ }
145+ result +=
146+ sprintf(buffer + result, "--\ndebug_level = 0x%08X (* = enabled)\n",
147+ acpi_dbg_level);
148+
149+ return result;
150+}
151+
152+module_param_call(debug_layer, param_set_uint, param_get_debug_layer,
153+ &acpi_dbg_layer, 0644);
154+module_param_call(debug_level, param_set_uint, param_get_debug_level,
155+ &acpi_dbg_level, 0644);
156+
157+static char trace_method_name[6];
158+module_param_string(trace_method_name, trace_method_name, 6, 0644);
159+static unsigned int trace_debug_layer;
160+module_param(trace_debug_layer, uint, 0644);
161+static unsigned int trace_debug_level;
162+module_param(trace_debug_level, uint, 0644);
163+
164+static int param_set_trace_state(const char *val, struct kernel_param *kp)
165+{
166+ int result = 0;
167+
168+ if (!strncmp(val, "enable", strlen("enable") - 1)) {
169+ result = acpi_debug_trace(trace_method_name, trace_debug_level,
170+ trace_debug_layer, 0);
171+ if (result)
172+ result = -EBUSY;
173+ goto exit;
174+ }
175+
176+ if (!strncmp(val, "disable", strlen("disable") - 1)) {
177+ int name = 0;
178+ result = acpi_debug_trace((char *)&name, trace_debug_level,
179+ trace_debug_layer, 0);
180+ if (result)
181+ result = -EBUSY;
182+ goto exit;
183+ }
184+
185+ if (!strncmp(val, "1", 1)) {
186+ result = acpi_debug_trace(trace_method_name, trace_debug_level,
187+ trace_debug_layer, 1);
188+ if (result)
189+ result = -EBUSY;
190+ goto exit;
191+ }
192+
193+ result = -EINVAL;
194+exit:
195+ return result;
196+}
197+
198+static int param_get_trace_state(char *buffer, struct kernel_param *kp)
199+{
200+ if (!acpi_gbl_trace_method_name)
201+ return sprintf(buffer, "disable");
202+ else {
203+ if (acpi_gbl_trace_flags & 1)
204+ return sprintf(buffer, "1");
205+ else
206+ return sprintf(buffer, "enable");
207+ }
208+ return 0;
209+}
210+
211+module_param_call(trace_state, param_set_trace_state, param_get_trace_state,
212+ NULL, 0644);
213+#endif /* CONFIG_ACPI_DEBUG */
214+
215+/* /sys/module/acpi/parameters/acpica_version */
49216 static int param_get_acpica_version(char *buffer, struct kernel_param *kp)
50217 {
51218 int result;
@@ -57,9 +224,12 @@ static int param_get_acpica_version(char *buffer, struct kernel_param *kp) · 5 unmodified lines
57224
58225 module_param_call(acpica_version, NULL, param_get_acpica_version, NULL, 0444);
59226
60−/* --------------------------------------------------------------------------
61− FS Interface (/sys)
62− -------------------------------------------------------------------------- */
227+/*
228+ * ACPI table sysfs I/F:
229+ * /sys/firmware/acpi/tables/
230+ * /sys/firmware/acpi/tables/dynamic/
231+ */
232+
63233 static LIST_HEAD(acpi_table_attr_list);
64234 static struct kobject *tables_kobj;
65235 static struct kobject *dynamic_tables_kobj;
@@ -86,14 +256,12 @@ static ssize_t acpi_table_show(struct file *filp, struct kobject *kobj, · 20 unmodified lines
86256 else
87257 memcpy(name, "\0\0\0\0", 4);
88258
89− status =
90− acpi_get_table(name, table_attr->instance,
91− &table_header);
259+ status = acpi_get_table(name, table_attr->instance, &table_header);
92260 if (ACPI_FAILURE(status))
93261 return -ENODEV;
94262
95263 return memory_read_from_buffer(buf, count, &offset,
96− table_header, table_header->length);
264+ table_header, table_header->length);
97265 }
98266
99267 static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
@@ -105,7 +273,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr, · 5 unmodified lines
105273 sysfs_attr_init(&table_attr->attr.attr);
106274 if (table_header->signature[0] != '\0')
107275 memcpy(table_attr->name, table_header->signature,
108− ACPI_NAME_SIZE);
276+ ACPI_NAME_SIZE);
109277 else
110278 memcpy(table_attr->name, "NULL", 4);
111279
@@ -117,8 +285,8 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr, · 5 unmodified lines
117285 table_attr->instance++;
118286
119287 if (table_attr->instance > 1 || (table_attr->instance == 1 &&
120− !acpi_get_table
121− (table_header->signature, 2, &header)))
288+ !acpi_get_table
289+ (table_header->signature, 2, &header)))
122290 sprintf(table_attr->name + ACPI_NAME_SIZE, "%d",
123291 table_attr->instance);
124292
@@ -138,18 +306,17 @@ acpi_sysfs_table_handler(u32 event, void *table, void *context) · 13 unmodified lines
138306 switch (event) {
139307 case ACPI_TABLE_EVENT_LOAD:
140308 table_attr =
141− kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL);
309+ kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL);
142310 if (!table_attr)
143311 return AE_NO_MEMORY;
144312
145313 acpi_table_attr_init(table_attr, table);
146314 if (sysfs_create_bin_file(dynamic_tables_kobj,
147− &table_attr->attr)) {
315+ &table_attr->attr)) {
148316 kfree(table_attr);
149317 return AE_ERROR;
150318 } else
151− list_add_tail(&table_attr->node,
152− &acpi_table_attr_list);
319+ list_add_tail(&table_attr->node, &acpi_table_attr_list);
153320 break;
154321 case ACPI_TABLE_EVENT_UNLOAD:
155322 /*
@@ -164,7 +331,7 @@ acpi_sysfs_table_handler(u32 event, void *table, void *context) · 8 unmodified lines
164331 return AE_OK;
165332 }
166333
167−static int acpi_system_sysfs_init(void)
334+static int acpi_tables_sysfs_init(void)
168335 {
169336 struct acpi_table_attr *table_attr;
170337 struct acpi_table_header *table_header = NULL;
@@ -213,14 +380,17 @@ err: · 42 unmodified lines
213380 }
214381
215382 /*
216− * Detailed ACPI IRQ counters in /sys/firmware/acpi/interrupts/
217− * See Documentation/ABI/testing/sysfs-firmware-acpi
383+ * Detailed ACPI IRQ counters:
384+ * /sys/firmware/acpi/interrupts/
218385 */
219386
387+u32 acpi_irq_handled;
388+u32 acpi_irq_not_handled;
389+
220390 #define COUNT_GPE 0
221−#define COUNT_SCI 1 /* acpi_irq_handled */
222−#define COUNT_SCI_NOT 2 /* acpi_irq_not_handled */
223−#define COUNT_ERROR 3 /* other */
391+#define COUNT_SCI 1 /* acpi_irq_handled */
392+#define COUNT_SCI_NOT 2 /* acpi_irq_not_handled */
393+#define COUNT_ERROR 3 /* other */
224394 #define NUM_COUNTERS_EXTRA 4
225395
226396 struct event_counter {
@@ -237,6 +407,7 @@ static u32 acpi_gpe_count; · 10 unmodified lines
237407 static struct attribute_group interrupt_stats_attr_group = {
238408 .name = "interrupts",
239409 };
410+
240411 static struct kobj_attribute *counter_attrs;
241412
242413 static void delete_gpe_attr_array(void)
@@ -269,8 +440,8 @@ void acpi_os_gpe_count(u32 gpe_number) · 26 unmodified lines
269440 if (gpe_number < num_gpes)
270441 all_counters[gpe_number].count++;
271442 else
272− all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR].
273− count++;
443+ all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS +
444+ COUNT_ERROR].count++;
274445
275446 return;
276447 }
@@ -283,13 +454,14 @@ void acpi_os_fixed_event_count(u32 event_number) · 6 unmodified lines
283454 if (event_number < ACPI_NUM_FIXED_EVENTS)
284455 all_counters[num_gpes + event_number].count++;
285456 else
286− all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR].
287− count++;
457+ all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS +
458+ COUNT_ERROR].count++;
288459
289460 return;
290461 }
291462
292−static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle)
463+static int get_status(u32 index, acpi_event_status *status,
464+ acpi_handle *handle)
293465 {
294466 int result = 0;
295467
@@ -300,7 +472,7 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle) · 4 unmodified lines
300472 result = acpi_get_gpe_device(index, handle);
301473 if (result) {
302474 ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND,
303− "Invalid GPE 0x%x\n", index));
475+ "Invalid GPE 0x%x\n", index));
304476 goto end;
305477 }
306478 result = acpi_get_gpe_status(*handle, index, status);
@@ -312,7 +484,7 @@ end: · 5 unmodified lines
312484 }
313485
314486 static ssize_t counter_show(struct kobject *kobj,
315− struct kobj_attribute *attr, char *buf)
487+ struct kobj_attribute *attr, char *buf)
316488 {
317489 int index = attr - counter_attrs;
318490 int size;
@@ -321,12 +493,11 @@ static ssize_t counter_show(struct kobject *kobj, · 2 unmodified lines
321493 int result = 0;
322494
323495 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count =
324− acpi_irq_handled;
496+ acpi_irq_handled;
325497 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT].count =
326− acpi_irq_not_handled;
498+ acpi_irq_not_handled;
327499 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count =
328− acpi_gpe_count;
329−
500+ acpi_gpe_count;
330501 size = sprintf(buf, "%8d", all_counters[index].count);
331502
332503 /* "gpe_all" or "sci" */
@@ -338,13 +509,13 @@ static ssize_t counter_show(struct kobject *kobj, · 5 unmodified lines
338509 goto end;
339510
340511 if (!(status & ACPI_EVENT_FLAG_HANDLE))
341− size += sprintf(buf + size, " invalid");
512+ size += sprintf(buf + size, " invalid");
342513 else if (status & ACPI_EVENT_FLAG_ENABLED)
343− size += sprintf(buf + size, " enabled");
514+ size += sprintf(buf + size, " enabled");
344515 else if (status & ACPI_EVENT_FLAG_WAKE_ENABLED)
345− size += sprintf(buf + size, " wake_enabled");
516+ size += sprintf(buf + size, " wake_enabled");
346517 else
347− size += sprintf(buf + size, " disabled");
518+ size += sprintf(buf + size, " disabled");
348519
349520 end:
350521 size += sprintf(buf + size, "\n");
@@ -357,7 +528,8 @@ end: · 6 unmodified lines
357528 * enable/disable/clear a gpe/fixed event in user space.
358529 */
359530 static ssize_t counter_set(struct kobject *kobj,
360− struct kobj_attribute *attr, const char *buf, size_t size)
531+ struct kobj_attribute *attr, const char *buf,
532+ size_t size)
361533 {
362534 int index = attr - counter_attrs;
363535 acpi_event_status status;
@@ -381,32 +553,32 @@ static ssize_t counter_set(struct kobject *kobj, · 17 unmodified lines
381553
382554 if (!(status & ACPI_EVENT_FLAG_HANDLE)) {
383555 printk(KERN_WARNING PREFIX
384− "Can not change Invalid GPE/Fixed Event status\n");
556+ "Can not change Invalid GPE/Fixed Event status\n");
385557 return -EINVAL;
386558 }
387559
388560 if (index < num_gpes) {
389561 if (!strcmp(buf, "disable\n") &&
390− (status & ACPI_EVENT_FLAG_ENABLED))
562+ (status & ACPI_EVENT_FLAG_ENABLED))
391563 result = acpi_disable_gpe(handle, index);
392564 else if (!strcmp(buf, "enable\n") &&
393− !(status & ACPI_EVENT_FLAG_ENABLED))
565+ !(status & ACPI_EVENT_FLAG_ENABLED))
394566 result = acpi_enable_gpe(handle, index);
395567 else if (!strcmp(buf, "clear\n") &&
396− (status & ACPI_EVENT_FLAG_SET))
568+ (status & ACPI_EVENT_FLAG_SET))
397569 result = acpi_clear_gpe(handle, index);
398570 else
399571 all_counters[index].count = strtoul(buf, NULL, 0);
400572 } else if (index < num_gpes + ACPI_NUM_FIXED_EVENTS) {
401573 int event = index - num_gpes;
402574 if (!strcmp(buf, "disable\n") &&
403− (status & ACPI_EVENT_FLAG_ENABLED))
575+ (status & ACPI_EVENT_FLAG_ENABLED))
404576 result = acpi_disable_event(event, ACPI_NOT_ISR);
405577 else if (!strcmp(buf, "enable\n") &&
406− !(status & ACPI_EVENT_FLAG_ENABLED))
578+ !(status & ACPI_EVENT_FLAG_ENABLED))
407579 result = acpi_enable_event(event, ACPI_NOT_ISR);
408580 else if (!strcmp(buf, "clear\n") &&
409− (status & ACPI_EVENT_FLAG_SET))
581+ (status & ACPI_EVENT_FLAG_SET))
410582 result = acpi_clear_event(event);
411583 else
412584 all_counters[index].count = strtoul(buf, NULL, 0);
@@ -430,17 +602,17 @@ void acpi_irq_stats_init(void) · 17 unmodified lines
430602 num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA;
431603
432604 all_attrs = kzalloc(sizeof(struct attribute *) * (num_counters + 1),
433− GFP_KERNEL);
605+ GFP_KERNEL);
434606 if (all_attrs == NULL)
435607 return;
436608
437609 all_counters = kzalloc(sizeof(struct event_counter) * (num_counters),
438− GFP_KERNEL);
610+ GFP_KERNEL);
439611 if (all_counters == NULL)
440612 goto fail;
441613
442614 counter_attrs = kzalloc(sizeof(struct kobj_attribute) * (num_counters),
443− GFP_KERNEL);
615+ GFP_KERNEL);
444616 if (counter_attrs == NULL)
445617 goto fail;
446618
@@ -503,135 +675,11 @@ static void __exit interrupt_stats_exit(void) · 56 unmodified lines
503675 return;
504676 }
505677
506−/* --------------------------------------------------------------------------
507− FS Interface (/proc)
508− -------------------------------------------------------------------------- */
509−#ifdef CONFIG_ACPI_PROCFS
510−#define ACPI_SYSTEM_FILE_INFO "info"
511−#define ACPI_SYSTEM_FILE_EVENT "event"
512−#define ACPI_SYSTEM_FILE_DSDT "dsdt"
513−#define ACPI_SYSTEM_FILE_FADT "fadt"
514−
515−static int acpi_system_read_info(struct seq_file *seq, void *offset)
516−{
517−
518− seq_printf(seq, "version: %x\n", ACPI_CA_VERSION);
519− return 0;
520−}
521−
522−static int acpi_system_info_open_fs(struct inode *inode, struct file *file)
523−{
524− return single_open(file, acpi_system_read_info, PDE(inode)->data);
525−}
526−
527−static const struct file_operations acpi_system_info_ops = {
528− .owner = THIS_MODULE,
529− .open = acpi_system_info_open_fs,
530− .read = seq_read,
531− .llseek = seq_lseek,
532− .release = single_release,
533−};
534−
535−static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t,
536− loff_t *);
537−
538−static const struct file_operations acpi_system_dsdt_ops = {
539− .owner = THIS_MODULE,
540− .read = acpi_system_read_dsdt,
541−};
542−
543−static ssize_t
544−acpi_system_read_dsdt(struct file *file,
545− char __user * buffer, size_t count, loff_t * ppos)
546−{
547− acpi_status status = AE_OK;
548− struct acpi_table_header *dsdt = NULL;
549− ssize_t res;
550−
551− status = acpi_get_table(ACPI_SIG_DSDT, 1, &dsdt);
552− if (ACPI_FAILURE(status))
553− return -ENODEV;
554−
555− res = simple_read_from_buffer(buffer, count, ppos, dsdt, dsdt->length);
556−
557− return res;
558−}
559−
560−static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t,
561− loff_t *);
562−
563−static const struct file_operations acpi_system_fadt_ops = {
564− .owner = THIS_MODULE,
565− .read = acpi_system_read_fadt,
566−};
567−
568−static ssize_t
569−acpi_system_read_fadt(struct file *file,
570− char __user * buffer, size_t count, loff_t * ppos)
571−{
572− acpi_status status = AE_OK;
573− struct acpi_table_header *fadt = NULL;
574− ssize_t res;
575−
576− status = acpi_get_table(ACPI_SIG_FADT, 1, &fadt);
577− if (ACPI_FAILURE(status))
578− return -ENODEV;
579−
580− res = simple_read_from_buffer(buffer, count, ppos, fadt, fadt->length);
581−
582− return res;
583−}
584−
585−static int acpi_system_procfs_init(void)
586−{
587− struct proc_dir_entry *entry;
588− int error = 0;
589−
590− /* 'info' [R] */
591− entry = proc_create(ACPI_SYSTEM_FILE_INFO, S_IRUGO, acpi_root_dir,
592− &acpi_system_info_ops);
593− if (!entry)
594− goto Error;
595−
596− /* 'dsdt' [R] */
597− entry = proc_create(ACPI_SYSTEM_FILE_DSDT, S_IRUSR, acpi_root_dir,
598− &acpi_system_dsdt_ops);
599− if (!entry)
600− goto Error;
601−
602− /* 'fadt' [R] */
603− entry = proc_create(ACPI_SYSTEM_FILE_FADT, S_IRUSR, acpi_root_dir,
604− &acpi_system_fadt_ops);
605− if (!entry)
606− goto Error;
607−
608− Done:
609− return error;
610−
611− Error:
612− remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir);
613− remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir);
614− remove_proc_entry(ACPI_SYSTEM_FILE_INFO, acpi_root_dir);
615−
616− error = -EFAULT;
617− goto Done;
618−}
619−#else
620−static int acpi_system_procfs_init(void)
621−{
622− return 0;
623−}
624−#endif
625−
626−int __init acpi_system_init(void)
678+int __init acpi_sysfs_init(void)
627679 {
628680 int result;
629681
630− result = acpi_system_procfs_init();
631− if (result)
632− return result;
633−
634− result = acpi_system_sysfs_init();
682+ result = acpi_tables_sysfs_init();
635683
636684 return result;
637685 }
drivers/acpi/thermal.c+53−33
@@ -37,10 +37,14 @@ · 36 unmodified lines
3737 #include <linux/init.h>
3838 #include <linux/slab.h>
3939 #include <linux/types.h>
40+
41+#ifdef CONFIG_ACPI_PROCFS
4042 #include <linux/proc_fs.h>
43+#include <linux/seq_file.h>
44+#endif
45+
4146 #include <linux/jiffies.h>
4247 #include <linux/kmod.h>
43−#include <linux/seq_file.h>
4448 #include <linux/reboot.h>
4549 #include <linux/device.h>
4650 #include <asm/uaccess.h>
@@ -102,16 +106,6 @@ static int acpi_thermal_add(struct acpi_device *device); · 55 unmodified lines
102106 static int acpi_thermal_remove(struct acpi_device *device, int type);
103107 static int acpi_thermal_resume(struct acpi_device *device);
104108 static void acpi_thermal_notify(struct acpi_device *device, u32 event);
105−static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file);
106−static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file);
107−static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file);
108−static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file);
109−static ssize_t acpi_thermal_write_cooling_mode(struct file *,
110− const char __user *, size_t,
111− loff_t *);
112−static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file);
113−static ssize_t acpi_thermal_write_polling(struct file *, const char __user *,
114− size_t, loff_t *);
115109
116110 static const struct acpi_device_id thermal_device_ids[] = {
117111 {ACPI_THERMAL_HID, 0},
@@ -201,6 +195,18 @@ struct acpi_thermal { · 83 unmodified lines
201195 struct mutex lock;
202196 };
203197
198+#ifdef CONFIG_ACPI_PROCFS
199+static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file);
200+static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file);
201+static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file);
202+static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file);
203+static ssize_t acpi_thermal_write_cooling_mode(struct file *,
204+ const char __user *, size_t,
205+ loff_t *);
206+static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file);
207+static ssize_t acpi_thermal_write_polling(struct file *, const char __user *,
208+ size_t, loff_t *);
209+
204210 static const struct file_operations acpi_thermal_state_fops = {
205211 .owner = THIS_MODULE,
206212 .open = acpi_thermal_state_open_fs,
@@ -242,6 +248,7 @@ static const struct file_operations acpi_thermal_polling_fops = { · 35 unmodified lines
242248 .llseek = seq_lseek,
243249 .release = single_release,
244250 };
251+#endif /* CONFIG_ACPI_PROCFS*/
245252
246253 /* --------------------------------------------------------------------------
247254 Thermal Zone Management
@@ -287,26 +294,6 @@ static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) · 39 unmodified lines
287294 return 0;
288295 }
289296
290−static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds)
291−{
292−
293− if (!tz)
294− return -EINVAL;
295−
296− tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */
297−
298− tz->thermal_zone->polling_delay = seconds * 1000;
299−
300− if (tz->tz_enabled)
301− thermal_zone_device_update(tz->thermal_zone);
302−
303− ACPI_DEBUG_PRINT((ACPI_DB_INFO,
304− "Polling frequency set to %lu seconds\n",
305− tz->polling_frequency/10));
306−
307− return 0;
308−}
309−
310297 static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
311298 {
312299 acpi_status status = AE_OK;
@@ -973,7 +960,7 @@ static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz) · 660 unmodified lines
973960 /* --------------------------------------------------------------------------
974961 FS Interface (/proc)
975962 -------------------------------------------------------------------------- */
976−
963+#ifdef CONFIG_ACPI_PROCFS
977964 static struct proc_dir_entry *acpi_thermal_dir;
978965
979966 static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset)
@@ -1187,6 +1174,26 @@ static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file) · 207 unmodified lines
11871174 PDE(inode)->data);
11881175 }
11891176
1177+static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds)
1178+{
1179+ if (!tz)
1180+ return -EINVAL;
1181+
1182+ /* Convert value to deci-seconds */
1183+ tz->polling_frequency = seconds * 10;
1184+
1185+ tz->thermal_zone->polling_delay = seconds * 1000;
1186+
1187+ if (tz->tz_enabled)
1188+ thermal_zone_device_update(tz->thermal_zone);
1189+
1190+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
1191+ "Polling frequency set to %lu seconds\n",
1192+ tz->polling_frequency/10));
1193+
1194+ return 0;
1195+}
1196+
11901197 static ssize_t
11911198 acpi_thermal_write_polling(struct file *file,
11921199 const char __user * buffer,
@@ -1295,7 +1302,13 @@ static int acpi_thermal_remove_fs(struct acpi_device *device) · 102 unmodified lines
12951302
12961303 return 0;
12971304 }
1298−
1305+#else
1306+static inline int acpi_thermal_add_fs(struct acpi_device *device) { return 0; }
1307+static inline int acpi_thermal_remove_fs(struct acpi_device *device)
1308+{
1309+ return 0;
1310+}
1311+#endif /* CONFIG_ACPI_PROCFS */
12991312 /* --------------------------------------------------------------------------
13001313 Driver Interface
13011314 -------------------------------------------------------------------------- */
@@ -1566,13 +1579,18 @@ static int __init acpi_thermal_init(void) · 264 unmodified lines
15661579 printk(KERN_NOTICE "ACPI: thermal control disabled\n");
15671580 return -ENODEV;
15681581 }
1582+
1583+#ifdef CONFIG_ACPI_PROCFS
15691584 acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir);
15701585 if (!acpi_thermal_dir)
15711586 return -ENODEV;
1587+#endif
15721588
15731589 result = acpi_bus_register_driver(&acpi_thermal_driver);
15741590 if (result < 0) {
1591+#ifdef CONFIG_ACPI_PROCFS
15751592 remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir);
1593+#endif
15761594 return -ENODEV;
15771595 }
15781596
@@ -1584,7 +1602,9 @@ static void __exit acpi_thermal_exit(void) · 5 unmodified lines
15841602
15851603 acpi_bus_unregister_driver(&acpi_thermal_driver);
15861604
1605+#ifdef CONFIG_ACPI_PROCFS
15871606 remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir);
1607+#endif
15881608
15891609 return;
15901610 }
drivers/acpi/video.c+86−55
@@ -152,7 +152,9 @@ struct acpi_video_bus { · 151 unmodified lines
152152 struct acpi_video_bus_flags flags;
153153 struct list_head video_device_list;
154154 struct mutex device_list_lock; /* protects video_device_list */
155+#ifdef CONFIG_ACPI_PROCFS
155156 struct proc_dir_entry *dir;
157+#endif
156158 struct input_dev *input;
157159 char phys[32]; /* for input device */
158160 struct notifier_block pm_nb;
@@ -208,6 +210,7 @@ struct acpi_video_device { · 49 unmodified lines
208210 struct output_device *output_dev;
209211 };
210212
213+#ifdef CONFIG_ACPI_PROCFS
211214 /* bus */
212215 static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file);
213216 static const struct file_operations acpi_video_bus_info_fops = {
@@ -307,6 +310,7 @@ static const struct file_operations acpi_video_device_EDID_fops = { · 93 unmodified lines
307310 .llseek = seq_lseek,
308311 .release = single_release,
309312 };
313+#endif /* CONFIG_ACPI_PROCFS */
310314
311315 static const char device_decode[][30] = {
312316 "motherboard VGA device",
@@ -449,16 +453,6 @@ static struct thermal_cooling_device_ops video_cooling_ops = { · 136 unmodified lines
449453
450454 /* device */
451455
452−static int
453−acpi_video_device_query(struct acpi_video_device *device, unsigned long long *state)
454−{
455− int status;
456−
457− status = acpi_evaluate_integer(device->dev->handle, "_DGS", NULL, state);
458−
459− return status;
460−}
461−
462456 static int
463457 acpi_video_device_get_state(struct acpi_video_device *device,
464458 unsigned long long *state)
@@ -698,46 +692,6 @@ acpi_video_device_EDID(struct acpi_video_device *device, · 233 unmodified lines
698692
699693 /* bus */
700694
701−static int
702−acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
703−{
704− int status;
705− unsigned long long tmp;
706− union acpi_object arg0 = { ACPI_TYPE_INTEGER };
707− struct acpi_object_list args = { 1, &arg0 };
708−
709−
710− arg0.integer.value = option;
711−
712− status = acpi_evaluate_integer(video->device->handle, "_SPD", &args, &tmp);
713− if (ACPI_SUCCESS(status))
714− status = tmp ? (-EINVAL) : (AE_OK);
715−
716− return status;
717−}
718−
719−static int
720−acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id)
721−{
722− int status;
723−
724− status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id);
725−
726− return status;
727−}
728−
729−static int
730−acpi_video_bus_POST_options(struct acpi_video_bus *video,
731− unsigned long long *options)
732−{
733− int status;
734−
735− status = acpi_evaluate_integer(video->device->handle, "_VPO", NULL, options);
736− *options &= 3;
737−
738− return status;
739−}
740−
741695 /*
742696 * Arg:
743697 * video : video bus device pointer
@@ -1159,6 +1113,7 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) · 415 unmodified lines
11591113 /* --------------------------------------------------------------------------
11601114 FS Interface (/proc)
11611115 -------------------------------------------------------------------------- */
1116+#ifdef CONFIG_ACPI_PROCFS
11621117
11631118 static struct proc_dir_entry *acpi_video_dir;
11641119
@@ -1198,6 +1153,18 @@ acpi_video_device_info_open_fs(struct inode *inode, struct file *file) · 33 unmodified lines
11981153 PDE(inode)->data);
11991154 }
12001155
1156+static int
1157+acpi_video_device_query(struct acpi_video_device *device,
1158+ unsigned long long *state)
1159+{
1160+ int status;
1161+
1162+ status = acpi_evaluate_integer(device->dev->handle, "_DGS",
1163+ NULL, state);
1164+
1165+ return status;
1166+}
1167+
12011168 static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
12021169 {
12031170 int status;
@@ -1492,6 +1459,19 @@ static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file) · 288 unmodified lines
14921459 return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data);
14931460 }
14941461
1462+static int
1463+acpi_video_bus_POST_options(struct acpi_video_bus *video,
1464+ unsigned long long *options)
1465+{
1466+ int status;
1467+
1468+ status = acpi_evaluate_integer(video->device->handle, "_VPO",
1469+ NULL, options);
1470+ *options &= 3;
1471+
1472+ return status;
1473+}
1474+
14951475 static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
14961476 {
14971477 struct acpi_video_bus *video = seq->private;
@@ -1530,6 +1510,16 @@ acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file) · 32 unmodified lines
15301510 PDE(inode)->data);
15311511 }
15321512
1513+static int
1514+acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id)
1515+{
1516+ int status;
1517+
1518+ status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id);
1519+
1520+ return status;
1521+}
1522+
15331523 static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
15341524 {
15351525 struct acpi_video_bus *video = seq->private;
@@ -1572,6 +1562,25 @@ static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file) · 36 unmodified lines
15721562 return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data);
15731563 }
15741564
1565+static int
1566+acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
1567+{
1568+ int status;
1569+ unsigned long long tmp;
1570+ union acpi_object arg0 = { ACPI_TYPE_INTEGER };
1571+ struct acpi_object_list args = { 1, &arg0 };
1572+
1573+
1574+ arg0.integer.value = option;
1575+
1576+ status = acpi_evaluate_integer(video->device->handle, "_SPD",
1577+ &args, &tmp);
1578+ if (ACPI_SUCCESS(status))
1579+ status = tmp ? (-EINVAL) : (AE_OK);
1580+
1581+ return status;
1582+}
1583+
15751584 static ssize_t
15761585 acpi_video_bus_write_POST(struct file *file,
15771586 const char __user * buffer,
@@ -1722,6 +1731,24 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device) · 144 unmodified lines
17221731
17231732 return 0;
17241733 }
1734+#else
1735+static inline int acpi_video_device_add_fs(struct acpi_device *device)
1736+{
1737+ return 0;
1738+}
1739+static inline int acpi_video_device_remove_fs(struct acpi_device *device)
1740+{
1741+ return 0;
1742+}
1743+static inline int acpi_video_bus_add_fs(struct acpi_device *device)
1744+{
1745+ return 0;
1746+}
1747+static inline int acpi_video_bus_remove_fs(struct acpi_device *device)
1748+{
1749+ return 0;
1750+}
1751+#endif /* CONFIG_ACPI_PROCFS */
17251752
17261753 /* --------------------------------------------------------------------------
17271754 Driver Interface
@@ -2140,7 +2167,7 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, · 412 unmodified lines
21402167 status = acpi_video_bus_get_one_device(dev, video);
21412168 if (ACPI_FAILURE(status)) {
21422169 printk(KERN_WARNING PREFIX
2143− "Cant attach device");
2170+ "Cant attach device\n");
21442171 continue;
21452172 }
21462173 }
@@ -2150,19 +2177,19 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, · 3 unmodified lines
21502177 static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
21512178 {
21522179 acpi_status status;
2153− struct acpi_video_bus *video;
2154−
21552180
21562181 if (!device || !device->video)
21572182 return -ENOENT;
21582183
2159− video = device->video;
2160−
21612184 acpi_video_device_remove_fs(device->dev);
21622185
21632186 status = acpi_remove_notify_handler(device->dev->handle,
21642187 ACPI_DEVICE_NOTIFY,
21652188 acpi_video_device_notify);
2189+ if (ACPI_FAILURE(status)) {
2190+ printk(KERN_WARNING PREFIX
2191+ "Cant remove video notify handler\n");
2192+ }
21662193 if (device->backlight) {
21672194 sysfs_remove_link(&device->backlight->dev.kobj, "device");
21682195 backlight_device_unregister(device->backlight);
@@ -2557,9 +2584,11 @@ int acpi_video_register(void) · 388 unmodified lines
25572584 return 0;
25582585 }
25592586
2587+#ifdef CONFIG_ACPI_PROCFS
25602588 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
25612589 if (!acpi_video_dir)
25622590 return -ENODEV;
2591+#endif
25632592
25642593 result = acpi_bus_register_driver(&acpi_video_bus);
25652594 if (result < 0) {
@@ -2588,7 +2617,9 @@ void acpi_video_unregister(void) · 22 unmodified lines
25882617 }
25892618 acpi_bus_unregister_driver(&acpi_video_bus);
25902619
2620+#ifdef CONFIG_ACPI_PROCFS
25912621 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
2622+#endif
25922623
25932624 register_count = 0;
25942625
drivers/acpi/wakeup.c+10−38
@@ -21,45 +21,17 @@ · 20 unmodified lines
2121 ACPI_MODULE_NAME("wakeup_devices")
2222
2323 /**
24− * acpi_enable_wakeup_device_prep - Prepare wake-up devices.
24+ * acpi_enable_wakeup_devices - Enable wake-up device GPEs.
2525 * @sleep_state: ACPI system sleep state.
2626 *
27− * Enable all wake-up devices' power, unless the requested system sleep state is
28− * too deep.
27+ * Enable wakeup device power of devices with the state.enable flag set and set
28+ * the wakeup enable mask bits in the GPE registers that correspond to wakeup
29+ * devices.
2930 */
30−void acpi_enable_wakeup_device_prep(u8 sleep_state)
31+void acpi_enable_wakeup_devices(u8 sleep_state)
3132 {
3233 struct list_head *node, *next;
3334
34− list_for_each_safe(node, next, &acpi_wakeup_device_list) {
35− struct acpi_device *dev = container_of(node,
36− struct acpi_device,
37− wakeup_list);
38−
39− if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled
40− || (sleep_state > (u32) dev->wakeup.sleep_state))
41− continue;
42−
43− acpi_enable_wakeup_device_power(dev, sleep_state);
44− }
45−}
46−
47−/**
48− * acpi_enable_wakeup_device - Enable wake-up device GPEs.
49− * @sleep_state: ACPI system sleep state.
50− *
51− * Enable all wake-up devices' GPEs, with the assumption that
52− * acpi_disable_all_gpes() was executed before, so we don't need to disable any
53− * GPEs here.
54− */
55−void acpi_enable_wakeup_device(u8 sleep_state)
56−{
57− struct list_head *node, *next;
58−
59− /*
60− * Caution: this routine must be invoked when interrupt is disabled
61− * Refer ACPI2.0: P212
62− */
6335 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
6436 struct acpi_device *dev =
6537 container_of(node, struct acpi_device, wakeup_list);
@@ -69,6 +41,9 @@ void acpi_enable_wakeup_device(u8 sleep_state) · 3 unmodified lines
6941 || sleep_state > (u32) dev->wakeup.sleep_state)
7042 continue;
7143
44+ if (dev->wakeup.state.enabled)
45+ acpi_enable_wakeup_device_power(dev, sleep_state);
46+
7247 /* The wake-up power should have been enabled already. */
7348 acpi_gpe_wakeup(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
7449 ACPI_GPE_ENABLE);
@@ -76,13 +51,10 @@ void acpi_enable_wakeup_device(u8 sleep_state) · 1 unmodified line
7651 }
7752
7853 /**
79− * acpi_disable_wakeup_device - Disable devices' wakeup capability.
54+ * acpi_disable_wakeup_devices - Disable devices' wakeup capability.
8055 * @sleep_state: ACPI system sleep state.
81− *
82− * This function only affects devices with wakeup.state.enabled set, which means
83− * that it reverses the changes made by acpi_enable_wakeup_device_prep().
8456 */
85−void acpi_disable_wakeup_device(u8 sleep_state)
57+void acpi_disable_wakeup_devices(u8 sleep_state)
8658 {
8759 struct list_head *node, *next;
8860
drivers/ata/libata-acpi.c+0−6
@@ -145,12 +145,6 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, · 144 unmodified lines
145145 struct ata_eh_info *ehi = &ap->link.eh_info;
146146 int wait = 0;
147147 unsigned long flags;
148− acpi_handle handle;
149−
150− if (dev)
151− handle = dev->acpi_handle;
152− else
153− handle = ap->acpi_handle;
154148
155149 spin_lock_irqsave(ap->lock, flags);
156150 /*
include/acpi/acpixf.h+1−1
@@ -66,7 +66,7 @@ extern u8 acpi_gbl_create_osi_method; · 65 unmodified lines
6666 extern u8 acpi_gbl_use_default_register_widths;
6767 extern acpi_name acpi_gbl_trace_method_name;
6868 extern u32 acpi_gbl_trace_flags;
69−extern u8 acpi_gbl_enable_aml_debug_object;
69+extern u32 acpi_gbl_enable_aml_debug_object;
7070 extern u8 acpi_gbl_copy_dsdt_locally;
7171 extern u8 acpi_gbl_truncate_io_addresses;
7272
include/acpi/processor.h+0−1
@@ -338,7 +338,6 @@ extern struct cpuidle_driver acpi_idle_driver; · 337 unmodified lines
338338
339339 /* in processor_thermal.c */
340340 int acpi_processor_get_limit_info(struct acpi_processor *pr);
341−extern const struct file_operations acpi_processor_limit_fops;
342341 extern struct thermal_cooling_device_ops processor_cooling_ops;
343342 #ifdef CONFIG_CPU_FREQ
344343 void acpi_thermal_cpufreq_init(void);
include/linux/cper.h+4−4
@@ -39,10 +39,10 @@ · 38 unmodified lines
3939 * Severity difinition for error_severity in struct cper_record_header
4040 * and section_severity in struct cper_section_descriptor
4141 */
42−#define CPER_SER_RECOVERABLE 0x0
43−#define CPER_SER_FATAL 0x1
44−#define CPER_SER_CORRECTED 0x2
45−#define CPER_SER_INFORMATIONAL 0x3
42+#define CPER_SEV_RECOVERABLE 0x0
43+#define CPER_SEV_FATAL 0x1
44+#define CPER_SEV_CORRECTED 0x2
45+#define CPER_SEV_INFORMATIONAL 0x3
4646
4747 /*
4848 * Validation bits difinition for validation_bits in struct