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.

+1087 -1495
+2
Documentation/acpi/method-customizing.txt
··· 19 19 "Device", "OperationRegion", are not recognized. 20 20 Note: The same ACPI control method can be overridden for many times, 21 21 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". 22 24 23 25 1. override an existing method 24 26 a) get the ACPI table via ACPI sysfs I/F. e.g. to get the DSDT,
+2 -2
arch/x86/kernel/cpu/mcheck/mce-apei.c
··· 80 80 rcd.hdr.revision = CPER_RECORD_REV; 81 81 rcd.hdr.signature_end = CPER_SIG_END; 82 82 rcd.hdr.section_count = 1; 83 - rcd.hdr.error_severity = CPER_SER_FATAL; 83 + rcd.hdr.error_severity = CPER_SEV_FATAL; 84 84 /* timestamp, platform_id, partition_id are all invalid */ 85 85 rcd.hdr.validation_bits = 0; 86 86 rcd.hdr.record_length = sizeof(rcd); ··· 96 96 rcd.sec_hdr.validation_bits = 0; 97 97 rcd.sec_hdr.flags = CPER_SEC_PRIMARY; 98 98 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; 100 100 101 101 memcpy(&rcd.mce, m, sizeof(*m)); 102 102
+2 -9
drivers/acpi/Kconfig
··· 54 54 they have been replaced by functions in /sys. 55 55 The deprecated files (and their replacements) include: 56 56 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/*) 66 57 /proc/acpi/processor/*/throttling (/sys/class/thermal/ 67 58 cooling_device*/*) 59 + /proc/acpi/video/*/brightness (/sys/class/backlight/) 60 + /proc/acpi/thermal_zone/*/* (/sys/class/thermal/) 68 61 This option has no effect on /proc/acpi/ files 69 62 and functions which do not yet exist in /sys. 70 63
+3 -2
drivers/acpi/Makefile
··· 37 37 acpi-$(CONFIG_ACPI_DOCK) += dock.o 38 38 acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o 39 39 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 42 43 acpi-$(CONFIG_ACPI_NUMA) += numa.o 43 44 acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o 44 45 ifdef CONFIG_ACPI_VIDEO
+4
drivers/acpi/acpica/acevents.h
··· 82 82 83 83 acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info); 84 84 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 + 85 89 struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, 86 90 u32 gpe_number); 87 91
+1 -1
drivers/acpi/acpica/acglobal.h
··· 108 108 /* 109 109 * Optionally enable output from the AML Debug Object. 110 110 */ 111 - u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE); 111 + u32 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE); 112 112 113 113 /* 114 114 * Optionally copy the entire DSDT to local memory (instead of simply
+1
drivers/acpi/acpica/aclocal.h
··· 412 412 acpi_event_handler address; /* Address of handler, if any */ 413 413 void *context; /* Context to be passed to handler */ 414 414 struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ 415 + u8 orig_flags; /* Original misc info about this GPE */ 415 416 }; 416 417 417 418 union acpi_gpe_dispatch_info {
+73
drivers/acpi/acpica/evgpe.c
··· 137 137 138 138 /******************************************************************************* 139 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 + 211 + /******************************************************************************* 212 + * 140 213 * FUNCTION: acpi_ev_low_get_gpe_info 141 214 * 142 215 * PARAMETERS: gpe_number - Raw GPE number
+61 -34
drivers/acpi/acpica/evxface.c
··· 691 691 return_ACPI_STATUS(status); 692 692 } 693 693 694 - /* Ensure that we have a valid GPE number */ 695 - 696 - gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); 697 - if (!gpe_event_info) { 698 - status = AE_BAD_PARAMETER; 699 - goto unlock_and_exit; 700 - } 701 - 702 - /* Make sure that there isn't a handler there already */ 703 - 704 - if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 705 - ACPI_GPE_DISPATCH_HANDLER) { 706 - status = AE_ALREADY_EXISTS; 707 - goto unlock_and_exit; 708 - } 709 - 710 - /* Allocate and init handler object */ 694 + /* Allocate memory for the handler object */ 711 695 712 696 handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); 713 697 if (!handler) { ··· 699 715 goto unlock_and_exit; 700 716 } 701 717 718 + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 719 + 720 + /* Ensure that we have a valid GPE number */ 721 + 722 + gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); 723 + if (!gpe_event_info) { 724 + status = AE_BAD_PARAMETER; 725 + goto free_and_exit; 726 + } 727 + 728 + /* Make sure that there isn't a handler there already */ 729 + 730 + if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 731 + ACPI_GPE_DISPATCH_HANDLER) { 732 + status = AE_ALREADY_EXISTS; 733 + goto free_and_exit; 734 + } 735 + 736 + /* Allocate and init handler object */ 737 + 702 738 handler->address = address; 703 739 handler->context = context; 704 740 handler->method_node = gpe_event_info->dispatch.method_node; 741 + handler->orig_flags = gpe_event_info->flags & 742 + (ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); 743 + 744 + /* 745 + * If the GPE is associated with a method and it cannot wake up the 746 + * system from sleep states, it was enabled automatically during 747 + * initialization, so it has to be disabled now to avoid spurious 748 + * execution of the handler. 749 + */ 750 + 751 + if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD) 752 + && !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) 753 + (void)acpi_raw_disable_gpe(gpe_event_info); 705 754 706 755 /* Install the handler */ 707 756 708 - flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 709 757 gpe_event_info->dispatch.handler = handler; 710 758 711 759 /* Setup up dispatch flags to indicate handler (vs. method) */ ··· 751 735 unlock_and_exit: 752 736 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); 753 737 return_ACPI_STATUS(status); 738 + 739 + free_and_exit: 740 + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 741 + ACPI_FREE(handler); 742 + goto unlock_and_exit; 754 743 } 755 744 756 745 ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) ··· 791 770 return_ACPI_STATUS(AE_BAD_PARAMETER); 792 771 } 793 772 773 + /* Make sure all deferred tasks are completed */ 774 + 775 + acpi_os_wait_events_complete(NULL); 776 + 794 777 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); 795 778 if (ACPI_FAILURE(status)) { 796 779 return_ACPI_STATUS(status); 797 780 } 781 + 782 + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 798 783 799 784 /* Ensure that we have a valid GPE number */ 800 785 ··· 825 798 goto unlock_and_exit; 826 799 } 827 800 828 - /* Make sure all deferred tasks are completed */ 829 - 830 - (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); 831 - acpi_os_wait_events_complete(NULL); 832 - status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); 833 - if (ACPI_FAILURE(status)) { 834 - return_ACPI_STATUS(status); 835 - } 836 - 837 801 /* Remove the handler */ 838 802 839 - flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 840 803 handler = gpe_event_info->dispatch.handler; 841 804 842 805 /* Restore Method node (if any), set dispatch flags */ 843 806 844 807 gpe_event_info->dispatch.method_node = handler->method_node; 845 - gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */ 846 - if (handler->method_node) { 847 - gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD; 848 - } 849 - acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 808 + gpe_event_info->flags &= 809 + ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); 810 + gpe_event_info->flags |= handler->orig_flags; 811 + 812 + /* 813 + * If the GPE was previously associated with a method and it cannot wake 814 + * up the system from sleep states, it should be enabled at this point 815 + * to restore the post-initialization configuration. 816 + */ 817 + 818 + if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD) 819 + && !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) 820 + (void)acpi_raw_enable_gpe(gpe_event_info); 850 821 851 822 /* Now we can free the handler object */ 852 823 853 824 ACPI_FREE(handler); 854 825 855 - unlock_and_exit: 826 + unlock_and_exit: 827 + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 828 + 856 829 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); 857 830 return_ACPI_STATUS(status); 858 831 }
+9 -53
drivers/acpi/acpica/evxfevnt.c
··· 294 294 ******************************************************************************/ 295 295 acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) 296 296 { 297 - acpi_status status = AE_OK; 297 + acpi_status status = AE_BAD_PARAMETER; 298 298 struct acpi_gpe_event_info *gpe_event_info; 299 299 acpi_cpu_flags flags; 300 300 ··· 305 305 /* Ensure that we have a valid GPE number */ 306 306 307 307 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); 311 310 } 312 311 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: 330 312 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 331 313 return_ACPI_STATUS(status); 332 314 } ··· 330 348 ******************************************************************************/ 331 349 acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number) 332 350 { 333 - acpi_status status = AE_OK; 351 + acpi_status status = AE_BAD_PARAMETER; 334 352 struct acpi_gpe_event_info *gpe_event_info; 335 353 acpi_cpu_flags flags; 336 354 ··· 341 359 /* Ensure that we have a valid GPE number */ 342 360 343 361 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); 344 - if (!gpe_event_info) { 345 - status = AE_BAD_PARAMETER; 346 - goto unlock_and_exit; 362 + if (gpe_event_info) { 363 + status = acpi_raw_disable_gpe(gpe_event_info) ; 347 364 } 348 365 349 - /* Hardware-disable a runtime GPE on removal of the last reference */ 350 - 351 - if (!gpe_event_info->runtime_count) { 352 - status = AE_LIMIT; /* There are no references to remove */ 353 - goto unlock_and_exit; 354 - } 355 - 356 - gpe_event_info->runtime_count--; 357 - if (!gpe_event_info->runtime_count) { 358 - status = acpi_ev_update_gpe_enable_mask(gpe_event_info); 359 - if (ACPI_SUCCESS(status)) { 360 - status = 361 - acpi_hw_low_set_gpe(gpe_event_info, 362 - ACPI_GPE_DISABLE); 363 - } 364 - if (ACPI_FAILURE(status)) { 365 - gpe_event_info->runtime_count++; 366 - } 367 - } 368 - 369 - unlock_and_exit: 370 366 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 371 367 return_ACPI_STATUS(status); 372 368 } ··· 371 411 acpi_status status = AE_OK; 372 412 struct acpi_gpe_event_info *gpe_event_info; 373 413 acpi_cpu_flags flags; 374 - u8 disable = 0; 375 414 376 415 ACPI_FUNCTION_TRACE(acpi_gpe_can_wake); 377 416 ··· 389 430 } 390 431 391 432 gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; 392 - disable = (gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD) 393 - && gpe_event_info->runtime_count; 433 + if (gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD) { 434 + (void)acpi_raw_disable_gpe(gpe_event_info); 435 + } 394 436 395 437 unlock_and_exit: 396 438 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 397 - 398 - if (disable) 399 - status = acpi_disable_gpe(gpe_device, gpe_number); 400 - 401 439 return_ACPI_STATUS(status); 402 440 } 403 441 ACPI_EXPORT_SYMBOL(acpi_gpe_can_wake)
+1 -4
drivers/acpi/acpica/utmutex.c
··· 279 279 280 280 acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) 281 281 { 282 - acpi_thread_id this_thread_id; 283 - 284 282 ACPI_FUNCTION_NAME(ut_release_mutex); 285 283 286 - this_thread_id = acpi_os_get_thread_id(); 287 284 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()), 289 286 acpi_ut_get_mutex_name(mutex_id))); 290 287 291 288 if (mutex_id > ACPI_MAX_MUTEX) {
+9
drivers/acpi/apei/Kconfig
··· 28 28 EINJ provides a hardware error injection mechanism, it is 29 29 mainly used for debugging and testing the other parts of 30 30 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.
+1
drivers/acpi/apei/Makefile
··· 1 1 obj-$(CONFIG_ACPI_APEI) += apei.o 2 2 obj-$(CONFIG_ACPI_APEI_GHES) += ghes.o 3 3 obj-$(CONFIG_ACPI_APEI_EINJ) += einj.o 4 + obj-$(CONFIG_ACPI_APEI_ERST_DEBUG) += erst-dbg.o 4 5 5 6 apei-y := apei-base.o hest.o cper.o erst.o
+2 -2
drivers/acpi/apei/apei-base.c
··· 482 482 list_for_each_entry(res, &resources->ioport, list) { 483 483 if (res == res_bak) 484 484 break; 485 - release_mem_region(res->start, res->end - res->start); 485 + release_region(res->start, res->end - res->start); 486 486 } 487 487 res_bak = NULL; 488 488 err_unmap_iomem: 489 489 list_for_each_entry(res, &resources->iomem, list) { 490 490 if (res == res_bak) 491 491 break; 492 - release_region(res->start, res->end - res->start); 492 + release_mem_region(res->start, res->end - res->start); 493 493 } 494 494 return -EINVAL; 495 495 }
+207
drivers/acpi/apei/erst-dbg.c
··· 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");
+97 -87
drivers/acpi/apei/ghes.c
··· 41 41 #include <linux/interrupt.h> 42 42 #include <linux/cper.h> 43 43 #include <linux/kdebug.h> 44 + #include <linux/platform_device.h> 45 + #include <linux/mutex.h> 44 46 #include <acpi/apei.h> 45 47 #include <acpi/atomicio.h> 46 48 #include <acpi/hed.h> ··· 89 87 * used for that. 90 88 */ 91 89 static LIST_HEAD(ghes_sci); 90 + static DEFINE_MUTEX(ghes_list_mutex); 92 91 93 92 static struct ghes *ghes_new(struct acpi_hest_generic *generic) 94 93 { ··· 135 132 } 136 133 137 134 enum { 138 - GHES_SER_NO = 0x0, 139 - GHES_SER_CORRECTED = 0x1, 140 - GHES_SER_RECOVERABLE = 0x2, 141 - GHES_SER_PANIC = 0x3, 135 + GHES_SEV_NO = 0x0, 136 + GHES_SEV_CORRECTED = 0x1, 137 + GHES_SEV_RECOVERABLE = 0x2, 138 + GHES_SEV_PANIC = 0x3, 142 139 }; 143 140 144 141 static inline int ghes_severity(int severity) 145 142 { 146 143 switch (severity) { 147 - case CPER_SER_INFORMATIONAL: 148 - return GHES_SER_NO; 149 - case CPER_SER_CORRECTED: 150 - return GHES_SER_CORRECTED; 151 - case CPER_SER_RECOVERABLE: 152 - return GHES_SER_RECOVERABLE; 153 - case CPER_SER_FATAL: 154 - return GHES_SER_PANIC; 144 + case CPER_SEV_INFORMATIONAL: 145 + return GHES_SEV_NO; 146 + case CPER_SEV_CORRECTED: 147 + return GHES_SEV_CORRECTED; 148 + case CPER_SEV_RECOVERABLE: 149 + return GHES_SEV_RECOVERABLE; 150 + case CPER_SEV_FATAL: 151 + return GHES_SEV_PANIC; 155 152 default: 156 153 /* Unkown, go panic */ 157 - return GHES_SER_PANIC; 154 + return GHES_SEV_PANIC; 158 155 } 159 156 } 160 157 ··· 240 237 241 238 static void ghes_do_proc(struct ghes *ghes) 242 239 { 243 - int ser, processed = 0; 240 + int sev, processed = 0; 244 241 struct acpi_hest_generic_data *gdata; 245 242 246 - ser = ghes_severity(ghes->estatus->error_severity); 243 + sev = ghes_severity(ghes->estatus->error_severity); 247 244 apei_estatus_for_each_section(ghes->estatus, gdata) { 248 245 #ifdef CONFIG_X86_MCE 249 246 if (!uuid_le_cmp(*(uuid_le *)gdata->section_type, 250 247 CPER_SEC_PLATFORM_MEM)) { 251 248 apei_mce_report_mem_error( 252 - ser == GHES_SER_CORRECTED, 249 + sev == GHES_SEV_CORRECTED, 253 250 (struct cper_sec_mem_err *)(gdata+1)); 254 251 processed = 1; 255 252 } ··· 296 293 .notifier_call = ghes_notify_sci, 297 294 }; 298 295 299 - static int hest_ghes_parse(struct acpi_hest_header *hest_hdr, void *data) 296 + static int __devinit ghes_probe(struct platform_device *ghes_dev) 300 297 { 301 298 struct acpi_hest_generic *generic; 302 299 struct ghes *ghes = NULL; 303 - int rc = 0; 300 + int rc = -EINVAL; 304 301 305 - if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR) 306 - return 0; 307 - 308 - generic = (struct acpi_hest_generic *)hest_hdr; 302 + generic = ghes_dev->dev.platform_data; 309 303 if (!generic->enabled) 310 - return 0; 304 + return -ENODEV; 311 305 312 306 if (generic->error_block_length < 313 307 sizeof(struct acpi_hest_generic_status)) { ··· 327 327 ghes = NULL; 328 328 goto err; 329 329 } 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); 343 332 if (list_empty(&ghes_sci)) 344 333 register_acpi_hed_notifier(&ghes_notifier_sci); 345 334 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; 357 362 } 363 + platform_set_drvdata(ghes_dev, ghes); 358 364 359 365 return 0; 360 366 err: 361 - if (ghes) 362 - ghes_fini(ghes); 363 - return rc; 364 - } 365 - 366 - static void ghes_cleanup(void) 367 - { 368 - struct ghes *ghes, *nghes; 369 - 370 - if (!list_empty(&ghes_sci)) 371 - unregister_acpi_hed_notifier(&ghes_notifier_sci); 372 - 373 - synchronize_rcu(); 374 - 375 - list_for_each_entry_safe(ghes, nghes, &ghes_sci, list) { 376 - list_del(&ghes->list); 367 + if (ghes) { 377 368 ghes_fini(ghes); 378 369 kfree(ghes); 379 370 } 371 + return rc; 380 372 } 373 + 374 + static int __devexit ghes_remove(struct platform_device *ghes_dev) 375 + { 376 + struct ghes *ghes; 377 + struct acpi_hest_generic *generic; 378 + 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 + } 394 + 395 + synchronize_rcu(); 396 + ghes_fini(ghes); 397 + kfree(ghes); 398 + 399 + platform_set_drvdata(ghes_dev, NULL); 400 + 401 + return 0; 402 + } 403 + 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 + }; 381 412 382 413 static int __init ghes_init(void) 383 414 { 384 - int rc; 385 - 386 415 if (acpi_disabled) 387 416 return -ENODEV; 388 417 ··· 420 391 return -EINVAL; 421 392 } 422 393 423 - rc = apei_hest_parse(hest_ghes_parse, NULL); 424 - if (rc) { 425 - pr_err(GHES_PFX 426 - "Error during parsing HEST generic hardware error sources.\n"); 427 - goto err_cleanup; 428 - } 429 - 430 - if (list_empty(&ghes_sci)) { 431 - pr_info(GHES_PFX 432 - "No functional generic hardware error sources.\n"); 433 - rc = -ENODEV; 434 - goto err_cleanup; 435 - } 436 - 437 - pr_info(GHES_PFX 438 - "Generic Hardware Error Source support is initialized.\n"); 439 - 440 - return 0; 441 - err_cleanup: 442 - ghes_cleanup(); 443 - return rc; 394 + return platform_driver_register(&ghes_platform_driver); 444 395 } 445 396 446 397 static void __exit ghes_exit(void) 447 398 { 448 - ghes_cleanup(); 399 + platform_driver_unregister(&ghes_platform_driver); 449 400 } 450 401 451 402 module_init(ghes_init); ··· 434 425 MODULE_AUTHOR("Huang Ying"); 435 426 MODULE_DESCRIPTION("APEI Generic Hardware Error Source support"); 436 427 MODULE_LICENSE("GPL"); 428 + MODULE_ALIAS("platform:GHES");
+70 -6
drivers/acpi/apei/hest.c
··· 34 34 #include <linux/kdebug.h> 35 35 #include <linux/highmem.h> 36 36 #include <linux/io.h> 37 + #include <linux/platform_device.h> 37 38 #include <acpi/apei.h> 38 39 39 40 #include "apei-internal.h" ··· 47 46 /* HEST table parsing */ 48 47 49 48 static struct acpi_table_hest *hest_tab; 50 - 51 - static int hest_void_parse(struct acpi_hest_header *hest_hdr, void *data) 52 - { 53 - return 0; 54 - } 55 49 56 50 static int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = { 57 51 [ACPI_HEST_TYPE_IA32_CHECK] = -1, /* need further calculation */ ··· 121 125 } 122 126 EXPORT_SYMBOL_GPL(apei_hest_parse); 123 127 128 + struct ghes_arr { 129 + struct platform_device **ghes_devs; 130 + unsigned int count; 131 + }; 132 + 133 + static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data) 134 + { 135 + int *count = data; 136 + 137 + if (hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR) 138 + (*count)++; 139 + return 0; 140 + } 141 + 142 + static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) 143 + { 144 + struct acpi_hest_generic *generic; 145 + struct platform_device *ghes_dev; 146 + struct ghes_arr *ghes_arr = data; 147 + int rc; 148 + 149 + if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR) 150 + return 0; 151 + generic = (struct acpi_hest_generic *)hest_hdr; 152 + if (!generic->enabled) 153 + return 0; 154 + ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id); 155 + if (!ghes_dev) 156 + return -ENOMEM; 157 + ghes_dev->dev.platform_data = generic; 158 + rc = platform_device_add(ghes_dev); 159 + if (rc) 160 + goto err; 161 + ghes_arr->ghes_devs[ghes_arr->count++] = ghes_dev; 162 + 163 + return 0; 164 + err: 165 + platform_device_put(ghes_dev); 166 + return rc; 167 + } 168 + 169 + static int hest_ghes_dev_register(unsigned int ghes_count) 170 + { 171 + int rc, i; 172 + struct ghes_arr ghes_arr; 173 + 174 + ghes_arr.count = 0; 175 + ghes_arr.ghes_devs = kmalloc(sizeof(void *) * ghes_count, GFP_KERNEL); 176 + if (!ghes_arr.ghes_devs) 177 + return -ENOMEM; 178 + 179 + rc = apei_hest_parse(hest_parse_ghes, &ghes_arr); 180 + if (rc) 181 + goto err; 182 + out: 183 + kfree(ghes_arr.ghes_devs); 184 + return rc; 185 + err: 186 + for (i = 0; i < ghes_arr.count; i++) 187 + platform_device_unregister(ghes_arr.ghes_devs[i]); 188 + goto out; 189 + } 190 + 124 191 static int __init setup_hest_disable(char *str) 125 192 { 126 193 hest_disable = 1; ··· 196 137 { 197 138 acpi_status status; 198 139 int rc = -ENODEV; 140 + unsigned int ghes_count = 0; 199 141 200 142 if (acpi_disabled) 201 143 goto err; ··· 218 158 goto err; 219 159 } 220 160 221 - rc = apei_hest_parse(hest_void_parse, NULL); 161 + rc = apei_hest_parse(hest_parse_ghes_count, &ghes_count); 162 + if (rc) 163 + goto err; 164 + 165 + rc = hest_ghes_dev_register(ghes_count); 222 166 if (rc) 223 167 goto err; 224 168
+2 -2
drivers/acpi/bus.c
··· 1034 1034 acpi_scan_init(); 1035 1035 acpi_ec_init(); 1036 1036 acpi_power_init(); 1037 - acpi_system_init(); 1038 - acpi_debug_init(); 1037 + acpi_sysfs_init(); 1038 + acpi_debugfs_init(); 1039 1039 acpi_sleep_proc_init(); 1040 1040 acpi_wakeup_device_init(); 1041 1041 return result;
-422
drivers/acpi/debug.c
··· 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 - }
+93
drivers/acpi/debugfs.c
··· 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 + }
+2 -1
drivers/acpi/glue.c
··· 100 100 101 101 status = acpi_get_object_info(handle, &info); 102 102 if (ACPI_SUCCESS(status)) { 103 - if (info->address == find->address) 103 + if ((info->address == find->address) 104 + && (info->valid & ACPI_VALID_ADR)) 104 105 find->handle = handle; 105 106 kfree(info); 106 107 }
+4 -4
drivers/acpi/internal.h
··· 27 27 28 28 int init_acpi_device_notify(void); 29 29 int acpi_scan_init(void); 30 - int acpi_system_init(void); 30 + int acpi_sysfs_init(void); 31 31 32 - #ifdef CONFIG_ACPI_DEBUG 33 - int acpi_debug_init(void); 32 + #ifdef CONFIG_DEBUG_FS 33 + int acpi_debugfs_init(void); 34 34 #else 35 - static inline int acpi_debug_init(void) { return 0; } 35 + static inline int acpi_debugfs_init(void) { return 0; } 36 36 #endif 37 37 38 38 /* --------------------------------------------------------------------------
+1 -3
drivers/acpi/numa.c
··· 255 255 256 256 static int __init acpi_parse_srat(struct acpi_table_header *table) 257 257 { 258 - struct acpi_table_srat *srat; 259 - 260 258 if (!table) 261 259 return -EINVAL; 262 260 263 - srat = (struct acpi_table_srat *)table; 261 + /* Real work done in acpi_table_parse_srat below. */ 264 262 265 263 return 0; 266 264 }
+3 -4
drivers/acpi/osl.c
··· 141 141 static void __init acpi_request_region (struct acpi_generic_address *addr, 142 142 unsigned int length, char *desc) 143 143 { 144 - struct resource *res; 145 - 146 144 if (!addr->address || !length) 147 145 return; 148 146 147 + /* Resources are never freed */ 149 148 if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO) 150 - res = request_region(addr->address, length, desc); 149 + request_region(addr->address, length, desc); 151 150 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); 153 152 } 154 153 155 154 static int __init acpi_reserve_resources(void)
+1 -128
drivers/acpi/power.c
··· 40 40 #include <linux/init.h> 41 41 #include <linux/types.h> 42 42 #include <linux/slab.h> 43 - #include <linux/proc_fs.h> 44 - #include <linux/seq_file.h> 45 43 #include <acpi/acpi_bus.h> 46 44 #include <acpi/acpi_drivers.h> 47 45 #include "sleep.h" ··· 62 64 static int acpi_power_add(struct acpi_device *device); 63 65 static int acpi_power_remove(struct acpi_device *device, int type); 64 66 static int acpi_power_resume(struct acpi_device *device); 65 - static int acpi_power_open_fs(struct inode *inode, struct file *file); 66 67 67 68 static const struct acpi_device_id power_device_ids[] = { 68 69 {ACPI_POWER_HID, 0}, ··· 95 98 }; 96 99 97 100 static struct list_head acpi_power_resource_list; 98 - 99 - static const struct file_operations acpi_power_fops = { 100 - .owner = THIS_MODULE, 101 - .open = acpi_power_open_fs, 102 - .read = seq_read, 103 - .llseek = seq_lseek, 104 - .release = single_release, 105 - }; 106 101 107 102 /* -------------------------------------------------------------------------- 108 103 Power Resource Management ··· 243 254 struct acpi_power_resource *resource = NULL; 244 255 struct list_head *node, *next; 245 256 struct acpi_power_reference *ref; 246 - 247 257 248 258 result = acpi_power_get_context(handle, &resource); 249 259 if (result) ··· 530 542 } 531 543 532 544 /* -------------------------------------------------------------------------- 533 - FS Interface (/proc) 534 - -------------------------------------------------------------------------- */ 535 - 536 - static struct proc_dir_entry *acpi_power_dir; 537 - 538 - static int acpi_power_seq_show(struct seq_file *seq, void *offset) 539 - { 540 - int count = 0; 541 - int result = 0, state; 542 - struct acpi_power_resource *resource = NULL; 543 - struct list_head *node, *next; 544 - struct acpi_power_reference *ref; 545 - 546 - 547 - resource = seq->private; 548 - 549 - if (!resource) 550 - goto end; 551 - 552 - result = acpi_power_get_state(resource->device->handle, &state); 553 - if (result) 554 - goto end; 555 - 556 - seq_puts(seq, "state: "); 557 - switch (state) { 558 - case ACPI_POWER_RESOURCE_STATE_ON: 559 - seq_puts(seq, "on\n"); 560 - break; 561 - case ACPI_POWER_RESOURCE_STATE_OFF: 562 - seq_puts(seq, "off\n"); 563 - break; 564 - default: 565 - seq_puts(seq, "unknown\n"); 566 - break; 567 - } 568 - 569 - mutex_lock(&resource->resource_lock); 570 - list_for_each_safe(node, next, &resource->reference) { 571 - ref = container_of(node, struct acpi_power_reference, node); 572 - count++; 573 - } 574 - mutex_unlock(&resource->resource_lock); 575 - 576 - seq_printf(seq, "system level: S%d\n" 577 - "order: %d\n" 578 - "reference count: %d\n", 579 - resource->system_level, 580 - resource->order, count); 581 - 582 - end: 583 - return 0; 584 - } 585 - 586 - static int acpi_power_open_fs(struct inode *inode, struct file *file) 587 - { 588 - return single_open(file, acpi_power_seq_show, PDE(inode)->data); 589 - } 590 - 591 - static int acpi_power_add_fs(struct acpi_device *device) 592 - { 593 - struct proc_dir_entry *entry = NULL; 594 - 595 - 596 - if (!device) 597 - return -EINVAL; 598 - 599 - if (!acpi_device_dir(device)) { 600 - acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 601 - acpi_power_dir); 602 - if (!acpi_device_dir(device)) 603 - return -ENODEV; 604 - } 605 - 606 - /* 'status' [R] */ 607 - entry = proc_create_data(ACPI_POWER_FILE_STATUS, 608 - S_IRUGO, acpi_device_dir(device), 609 - &acpi_power_fops, acpi_driver_data(device)); 610 - if (!entry) 611 - return -EIO; 612 - return 0; 613 - } 614 - 615 - static int acpi_power_remove_fs(struct acpi_device *device) 616 - { 617 - 618 - if (acpi_device_dir(device)) { 619 - remove_proc_entry(ACPI_POWER_FILE_STATUS, 620 - acpi_device_dir(device)); 621 - remove_proc_entry(acpi_device_bid(device), acpi_power_dir); 622 - acpi_device_dir(device) = NULL; 623 - } 624 - 625 - return 0; 626 - } 627 - 628 - /* -------------------------------------------------------------------------- 629 545 Driver Interface 630 546 -------------------------------------------------------------------------- */ 631 547 ··· 582 690 break; 583 691 } 584 692 585 - result = acpi_power_add_fs(device); 586 - if (result) 587 - goto end; 588 - 589 693 printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), 590 694 acpi_device_bid(device), state ? "on" : "off"); 591 695 ··· 602 714 return -EINVAL; 603 715 604 716 resource = acpi_driver_data(device); 605 - 606 - acpi_power_remove_fs(device); 607 717 608 718 mutex_lock(&resource->resource_lock); 609 719 list_for_each_safe(node, next, &resource->reference) { ··· 646 760 647 761 int __init acpi_power_init(void) 648 762 { 649 - int result = 0; 650 - 651 763 INIT_LIST_HEAD(&acpi_power_resource_list); 652 - 653 - acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir); 654 - if (!acpi_power_dir) 655 - return -ENODEV; 656 - 657 - result = acpi_bus_register_driver(&acpi_power_driver); 658 - if (result < 0) { 659 - remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir); 660 - return -ENODEV; 661 - } 662 - 663 - return 0; 764 + return acpi_bus_register_driver(&acpi_power_driver); 664 765 }
-70
drivers/acpi/proc.c
··· 17 17 18 18 /* 19 19 * this file provides support for: 20 - * /proc/acpi/sleep 21 20 * /proc/acpi/alarm 22 21 * /proc/acpi/wakeup 23 22 */ 24 23 25 24 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 */ 78 25 79 26 #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || !defined(CONFIG_X86) 80 27 /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */ ··· 410 463 .release = single_release, 411 464 }; 412 465 413 - #ifdef CONFIG_ACPI_PROCFS 414 - static const struct file_operations acpi_system_sleep_fops = { 415 - .owner = THIS_MODULE, 416 - .open = acpi_system_sleep_open_fs, 417 - .read = seq_read, 418 - .write = acpi_system_write_sleep, 419 - .llseek = seq_lseek, 420 - .release = single_release, 421 - }; 422 - #endif /* CONFIG_ACPI_PROCFS */ 423 - 424 466 #ifdef HAVE_ACPI_LEGACY_ALARM 425 467 static const struct file_operations acpi_system_alarm_fops = { 426 468 .owner = THIS_MODULE, ··· 431 495 432 496 int __init acpi_sleep_proc_init(void) 433 497 { 434 - #ifdef CONFIG_ACPI_PROCFS 435 - /* 'sleep' [R/W] */ 436 - proc_create("sleep", S_IFREG | S_IRUGO | S_IWUSR, 437 - acpi_root_dir, &acpi_system_sleep_fops); 438 - #endif /* CONFIG_ACPI_PROCFS */ 439 - 440 498 #ifdef HAVE_ACPI_LEGACY_ALARM 441 499 /* 'alarm' [R/W] */ 442 500 proc_create("alarm", S_IFREG | S_IRUGO | S_IWUSR,
-85
drivers/acpi/processor_driver.c
··· 83 83 84 84 static int acpi_processor_add(struct acpi_device *device); 85 85 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 89 86 static void acpi_processor_notify(struct acpi_device *device, u32 event); 90 87 static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); 91 88 static int acpi_processor_handle_eject(struct acpi_processor *pr); ··· 110 113 111 114 #define INSTALL_NOTIFY_HANDLER 1 112 115 #define UNINSTALL_NOTIFY_HANDLER 2 113 - #ifdef CONFIG_ACPI_PROCFS 114 - static const struct file_operations acpi_processor_info_fops = { 115 - .owner = THIS_MODULE, 116 - .open = acpi_processor_info_open_fs, 117 - .read = seq_read, 118 - .llseek = seq_lseek, 119 - .release = single_release, 120 - }; 121 - #endif 122 116 123 117 DEFINE_PER_CPU(struct acpi_processor *, processors); 124 118 EXPORT_PER_CPU_SYMBOL(processors); ··· 244 256 return result; 245 257 } 246 258 247 - /* -------------------------------------------------------------------------- 248 - FS Interface (/proc) 249 - -------------------------------------------------------------------------- */ 250 - 251 - #ifdef CONFIG_ACPI_PROCFS 252 259 static struct proc_dir_entry *acpi_processor_dir = NULL; 253 - 254 - static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) 255 - { 256 - struct acpi_processor *pr = seq->private; 257 - 258 - 259 - if (!pr) 260 - goto end; 261 - 262 - seq_printf(seq, "processor id: %d\n" 263 - "acpi id: %d\n" 264 - "bus mastering control: %s\n" 265 - "power management: %s\n" 266 - "throttling control: %s\n" 267 - "limit interface: %s\n", 268 - pr->id, 269 - pr->acpi_id, 270 - pr->flags.bm_control ? "yes" : "no", 271 - pr->flags.power ? "yes" : "no", 272 - pr->flags.throttling ? "yes" : "no", 273 - pr->flags.limit ? "yes" : "no"); 274 - 275 - end: 276 - return 0; 277 - } 278 - 279 - static int acpi_processor_info_open_fs(struct inode *inode, struct file *file) 280 - { 281 - return single_open(file, acpi_processor_info_seq_show, 282 - PDE(inode)->data); 283 - } 284 260 285 261 static int __cpuinit acpi_processor_add_fs(struct acpi_device *device) 286 262 { ··· 258 306 return -ENODEV; 259 307 } 260 308 261 - /* 'info' [R] */ 262 - entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO, 263 - S_IRUGO, acpi_device_dir(device), 264 - &acpi_processor_info_fops, 265 - acpi_driver_data(device)); 266 - if (!entry) 267 - return -EIO; 268 - 269 309 /* 'throttling' [R/W] */ 270 310 entry = proc_create_data(ACPI_PROCESSOR_FILE_THROTTLING, 271 311 S_IFREG | S_IRUGO | S_IWUSR, 272 312 acpi_device_dir(device), 273 313 &acpi_processor_throttling_fops, 274 - acpi_driver_data(device)); 275 - if (!entry) 276 - return -EIO; 277 - 278 - /* 'limit' [R/W] */ 279 - entry = proc_create_data(ACPI_PROCESSOR_FILE_LIMIT, 280 - S_IFREG | S_IRUGO | S_IWUSR, 281 - acpi_device_dir(device), 282 - &acpi_processor_limit_fops, 283 314 acpi_driver_data(device)); 284 315 if (!entry) 285 316 return -EIO; ··· 272 337 { 273 338 274 339 if (acpi_device_dir(device)) { 275 - remove_proc_entry(ACPI_PROCESSOR_FILE_INFO, 276 - acpi_device_dir(device)); 277 340 remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, 278 - acpi_device_dir(device)); 279 - remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, 280 341 acpi_device_dir(device)); 281 342 remove_proc_entry(acpi_device_bid(device), acpi_processor_dir); 282 343 acpi_device_dir(device) = NULL; ··· 280 349 281 350 return 0; 282 351 } 283 - #else 284 - static inline int acpi_processor_add_fs(struct acpi_device *device) 285 - { 286 - return 0; 287 - } 288 - static inline int acpi_processor_remove_fs(struct acpi_device *device) 289 - { 290 - return 0; 291 - } 292 - #endif 293 352 294 353 /* -------------------------------------------------------------------------- 295 354 Driver Interface ··· 842 921 843 922 memset(&errata, 0, sizeof(errata)); 844 923 845 - #ifdef CONFIG_ACPI_PROCFS 846 924 acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); 847 925 if (!acpi_processor_dir) 848 926 return -ENOMEM; 849 - #endif 850 927 851 928 if (!cpuidle_register_driver(&acpi_idle_driver)) { 852 929 printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", ··· 871 952 out_cpuidle: 872 953 cpuidle_unregister_driver(&acpi_idle_driver); 873 954 874 - #ifdef CONFIG_ACPI_PROCFS 875 955 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); 876 - #endif 877 956 878 957 return result; 879 958 } ··· 891 974 892 975 cpuidle_unregister_driver(&acpi_idle_driver); 893 976 894 - #ifdef CONFIG_ACPI_PROCFS 895 977 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); 896 - #endif 897 978 898 979 return; 899 980 }
+1 -101
drivers/acpi/processor_idle.c
··· 33 33 #include <linux/init.h> 34 34 #include <linux/cpufreq.h> 35 35 #include <linux/slab.h> 36 - #include <linux/proc_fs.h> 37 - #include <linux/seq_file.h> 38 36 #include <linux/acpi.h> 39 37 #include <linux/dmi.h> 40 38 #include <linux/moduleparam.h> ··· 79 81 80 82 static unsigned int latency_factor __read_mostly = 2; 81 83 module_param(latency_factor, uint, 0644); 82 - 83 - #ifdef CONFIG_ACPI_PROCFS 84 - static u64 us_to_pm_timer_ticks(s64 t) 85 - { 86 - return div64_u64(t * PM_TIMER_FREQUENCY, 1000000); 87 - } 88 - #endif 89 84 90 85 /* 91 86 * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. ··· 680 689 return 0; 681 690 } 682 691 683 - #ifdef CONFIG_ACPI_PROCFS 684 - static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) 685 - { 686 - struct acpi_processor *pr = seq->private; 687 - unsigned int i; 688 - 689 - 690 - if (!pr) 691 - goto end; 692 - 693 - seq_printf(seq, "active state: C%zd\n" 694 - "max_cstate: C%d\n" 695 - "maximum allowed latency: %d usec\n", 696 - pr->power.state ? pr->power.state - pr->power.states : 0, 697 - max_cstate, pm_qos_request(PM_QOS_CPU_DMA_LATENCY)); 698 - 699 - seq_puts(seq, "states:\n"); 700 - 701 - for (i = 1; i <= pr->power.count; i++) { 702 - seq_printf(seq, " %cC%d: ", 703 - (&pr->power.states[i] == 704 - pr->power.state ? '*' : ' '), i); 705 - 706 - if (!pr->power.states[i].valid) { 707 - seq_puts(seq, "<not supported>\n"); 708 - continue; 709 - } 710 - 711 - switch (pr->power.states[i].type) { 712 - case ACPI_STATE_C1: 713 - seq_printf(seq, "type[C1] "); 714 - break; 715 - case ACPI_STATE_C2: 716 - seq_printf(seq, "type[C2] "); 717 - break; 718 - case ACPI_STATE_C3: 719 - seq_printf(seq, "type[C3] "); 720 - break; 721 - default: 722 - seq_printf(seq, "type[--] "); 723 - break; 724 - } 725 - 726 - seq_puts(seq, "promotion[--] "); 727 - 728 - seq_puts(seq, "demotion[--] "); 729 - 730 - seq_printf(seq, "latency[%03d] usage[%08d] duration[%020Lu]\n", 731 - pr->power.states[i].latency, 732 - pr->power.states[i].usage, 733 - us_to_pm_timer_ticks(pr->power.states[i].time)); 734 - } 735 - 736 - end: 737 - return 0; 738 - } 739 - 740 - static int acpi_processor_power_open_fs(struct inode *inode, struct file *file) 741 - { 742 - return single_open(file, acpi_processor_power_seq_show, 743 - PDE(inode)->data); 744 - } 745 - 746 - static const struct file_operations acpi_processor_power_fops = { 747 - .owner = THIS_MODULE, 748 - .open = acpi_processor_power_open_fs, 749 - .read = seq_read, 750 - .llseek = seq_lseek, 751 - .release = single_release, 752 - }; 753 - #endif 754 - 755 692 /** 756 693 * acpi_idle_bm_check - checks if bus master activity was detected 757 694 */ ··· 722 803 } else if (cx->entry_method == ACPI_CSTATE_HALT) { 723 804 acpi_safe_halt(); 724 805 } else { 725 - int unused; 726 806 /* IO port based C-state */ 727 807 inb(cx->address); 728 808 /* Dummy wait op - must do something useless after P_LVL2 read 729 809 because chipsets cannot guarantee that STPCLK# signal 730 810 gets asserted in time to freeze execution properly. */ 731 - unused = inl(acpi_gbl_FADT.xpm_timer_block.address); 811 + inl(acpi_gbl_FADT.xpm_timer_block.address); 732 812 } 733 813 start_critical_timings(); 734 814 } ··· 1090 1172 { 1091 1173 acpi_status status = 0; 1092 1174 static int first_run; 1093 - #ifdef CONFIG_ACPI_PROCFS 1094 - struct proc_dir_entry *entry = NULL; 1095 - #endif 1096 1175 1097 1176 if (boot_option_idle_override) 1098 1177 return 0; ··· 1138 1223 if (cpuidle_register_device(&pr->power.dev)) 1139 1224 return -EIO; 1140 1225 } 1141 - #ifdef CONFIG_ACPI_PROCFS 1142 - /* 'power' [R] */ 1143 - entry = proc_create_data(ACPI_PROCESSOR_FILE_POWER, 1144 - S_IRUGO, acpi_device_dir(device), 1145 - &acpi_processor_power_fops, 1146 - acpi_driver_data(device)); 1147 - if (!entry) 1148 - return -EIO; 1149 - #endif 1150 1226 return 0; 1151 1227 } 1152 1228 ··· 1149 1243 1150 1244 cpuidle_unregister_device(&pr->power.dev); 1151 1245 pr->flags.power_setup_done = 0; 1152 - 1153 - #ifdef CONFIG_ACPI_PROCFS 1154 - if (acpi_device_dir(device)) 1155 - remove_proc_entry(ACPI_PROCESSOR_FILE_POWER, 1156 - acpi_device_dir(device)); 1157 - #endif 1158 1246 1159 1247 return 0; 1160 1248 }
-83
drivers/acpi/processor_thermal.c
··· 30 30 #include <linux/module.h> 31 31 #include <linux/init.h> 32 32 #include <linux/cpufreq.h> 33 - #include <linux/proc_fs.h> 34 - #include <linux/seq_file.h> 35 33 #include <linux/sysdev.h> 36 34 37 35 #include <asm/uaccess.h> ··· 436 438 .get_cur_state = processor_get_cur_state, 437 439 .set_cur_state = processor_set_cur_state, 438 440 }; 439 - 440 - /* /proc interface */ 441 - #ifdef CONFIG_ACPI_PROCFS 442 - static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) 443 - { 444 - struct acpi_processor *pr = seq->private; 445 - 446 - if (!pr) 447 - goto end; 448 - 449 - if (!pr->flags.limit) { 450 - seq_puts(seq, "<not supported>\n"); 451 - goto end; 452 - } 453 - 454 - seq_printf(seq, "active limit: P%d:T%d\n" 455 - "user limit: P%d:T%d\n" 456 - "thermal limit: P%d:T%d\n", 457 - pr->limit.state.px, pr->limit.state.tx, 458 - pr->limit.user.px, pr->limit.user.tx, 459 - pr->limit.thermal.px, pr->limit.thermal.tx); 460 - 461 - end: 462 - return 0; 463 - } 464 - 465 - static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file) 466 - { 467 - return single_open(file, acpi_processor_limit_seq_show, 468 - PDE(inode)->data); 469 - } 470 - 471 - static ssize_t acpi_processor_write_limit(struct file * file, 472 - const char __user * buffer, 473 - size_t count, loff_t * data) 474 - { 475 - int result = 0; 476 - struct seq_file *m = file->private_data; 477 - struct acpi_processor *pr = m->private; 478 - char limit_string[25] = { '\0' }; 479 - int px = 0; 480 - int tx = 0; 481 - 482 - 483 - if (!pr || (count > sizeof(limit_string) - 1)) { 484 - return -EINVAL; 485 - } 486 - 487 - if (copy_from_user(limit_string, buffer, count)) { 488 - return -EFAULT; 489 - } 490 - 491 - limit_string[count] = '\0'; 492 - 493 - if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) { 494 - printk(KERN_ERR PREFIX "Invalid data format\n"); 495 - return -EINVAL; 496 - } 497 - 498 - if (pr->flags.throttling) { 499 - if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) { 500 - printk(KERN_ERR PREFIX "Invalid tx\n"); 501 - return -EINVAL; 502 - } 503 - pr->limit.user.tx = tx; 504 - } 505 - 506 - result = acpi_processor_apply_limit(pr); 507 - 508 - return count; 509 - } 510 - 511 - const struct file_operations acpi_processor_limit_fops = { 512 - .owner = THIS_MODULE, 513 - .open = acpi_processor_limit_open_fs, 514 - .read = seq_read, 515 - .write = acpi_processor_write_limit, 516 - .llseek = seq_lseek, 517 - .release = single_release, 518 - }; 519 - #endif
-2
drivers/acpi/processor_throttling.c
··· 1215 1215 } 1216 1216 1217 1217 /* proc interface */ 1218 - #ifdef CONFIG_ACPI_PROCFS 1219 1218 static int acpi_processor_throttling_seq_show(struct seq_file *seq, 1220 1219 void *offset) 1221 1220 { ··· 1322 1323 .llseek = seq_lseek, 1323 1324 .release = single_release, 1324 1325 }; 1325 - #endif
+21 -39
drivers/acpi/sleep.c
··· 70 70 71 71 } 72 72 ACPI_FLUSH_CPU_CACHE(); 73 - acpi_enable_wakeup_device_prep(acpi_state); 74 73 #endif 75 74 printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n", 76 75 acpi_state); 76 + acpi_enable_wakeup_devices(acpi_state); 77 77 acpi_enter_sleep_state_prep(acpi_state); 78 78 return 0; 79 79 } ··· 119 119 } 120 120 121 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 + 131 + /** 122 132 * __acpi_pm_prepare - Prepare the platform to enter the target state. 123 133 * 124 134 * If necessary, set the firmware waking vector and do arch-specific ··· 137 127 static int __acpi_pm_prepare(void) 138 128 { 139 129 int error = acpi_sleep_prepare(acpi_target_sleep_state); 140 - 141 - suspend_nvs_save(); 142 - 143 130 if (error) 144 131 acpi_target_sleep_state = ACPI_STATE_S0; 132 + 145 133 return error; 146 134 } 147 135 ··· 150 142 static int acpi_pm_prepare(void) 151 143 { 152 144 int error = __acpi_pm_prepare(); 153 - 154 145 if (!error) 155 - acpi_pm_freeze(); 146 + acpi_pm_pre_suspend(); 156 147 157 148 return error; 158 149 } ··· 166 159 { 167 160 u32 acpi_state = acpi_target_sleep_state; 168 161 169 - suspend_nvs_free(); 170 162 acpi_ec_unblock_transactions(); 171 163 172 164 if (acpi_state == ACPI_STATE_S0) ··· 173 167 174 168 printk(KERN_INFO PREFIX "Waking up from system sleep state S%d\n", 175 169 acpi_state); 176 - acpi_disable_wakeup_device(acpi_state); 170 + acpi_disable_wakeup_devices(acpi_state); 177 171 acpi_leave_sleep_state(acpi_state); 178 172 179 173 /* reset firmware waking vector */ ··· 187 181 */ 188 182 static void acpi_pm_end(void) 189 183 { 184 + suspend_nvs_free(); 190 185 /* 191 186 * This is necessary in case acpi_pm_finish() is not called during a 192 187 * failing transition to a sleep state. ··· 258 251 } 259 252 260 253 local_irq_save(flags); 261 - acpi_enable_wakeup_device(acpi_state); 262 254 switch (acpi_state) { 263 255 case ACPI_STATE_S1: 264 256 barrier(); ··· 303 297 return ACPI_SUCCESS(status) ? 0 : -EFAULT; 304 298 } 305 299 306 - static void acpi_suspend_finish(void) 307 - { 308 - acpi_pm_finish(); 309 - } 310 - 311 300 static int acpi_suspend_state_valid(suspend_state_t pm_state) 312 301 { 313 302 u32 acpi_state; ··· 324 323 .begin = acpi_suspend_begin, 325 324 .prepare_late = acpi_pm_prepare, 326 325 .enter = acpi_suspend_enter, 327 - .wake = acpi_suspend_finish, 326 + .wake = acpi_pm_finish, 328 327 .end = acpi_pm_end, 329 328 }; 330 329 ··· 337 336 static int acpi_suspend_begin_old(suspend_state_t pm_state) 338 337 { 339 338 int error = acpi_suspend_begin(pm_state); 340 - 341 339 if (!error) 342 340 error = __acpi_pm_prepare(); 341 + 343 342 return error; 344 343 } 345 344 ··· 350 349 static struct platform_suspend_ops acpi_suspend_ops_old = { 351 350 .valid = acpi_suspend_state_valid, 352 351 .begin = acpi_suspend_begin_old, 353 - .prepare_late = acpi_pm_freeze, 352 + .prepare_late = acpi_pm_pre_suspend, 354 353 .enter = acpi_suspend_enter, 355 - .wake = acpi_suspend_finish, 354 + .wake = acpi_pm_finish, 356 355 .end = acpi_pm_end, 357 356 .recover = acpi_pm_finish, 358 357 }; ··· 424 423 return error; 425 424 } 426 425 427 - static int acpi_hibernation_pre_snapshot(void) 428 - { 429 - int error = acpi_pm_prepare(); 430 - 431 - if (!error) 432 - suspend_nvs_save(); 433 - 434 - return error; 435 - } 436 - 437 426 static int acpi_hibernation_enter(void) 438 427 { 439 428 acpi_status status = AE_OK; ··· 432 441 ACPI_FLUSH_CPU_CACHE(); 433 442 434 443 local_irq_save(flags); 435 - acpi_enable_wakeup_device(ACPI_STATE_S4); 436 444 /* This shouldn't return. If it returns, we have a problem */ 437 445 status = acpi_enter_sleep_state(ACPI_STATE_S4); 438 446 /* Reprogram control registers and execute _BFS */ ··· 471 481 static struct platform_hibernation_ops acpi_hibernation_ops = { 472 482 .begin = acpi_hibernation_begin, 473 483 .end = acpi_pm_end, 474 - .pre_snapshot = acpi_hibernation_pre_snapshot, 484 + .pre_snapshot = acpi_pm_prepare, 475 485 .finish = acpi_pm_finish, 476 486 .prepare = acpi_pm_prepare, 477 487 .enter = acpi_hibernation_enter, ··· 507 517 return error; 508 518 } 509 519 510 - static int acpi_hibernation_pre_snapshot_old(void) 511 - { 512 - acpi_pm_freeze(); 513 - suspend_nvs_save(); 514 - return 0; 515 - } 516 - 517 520 /* 518 521 * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has 519 522 * been requested. ··· 514 531 static struct platform_hibernation_ops acpi_hibernation_ops_old = { 515 532 .begin = acpi_hibernation_begin_old, 516 533 .end = acpi_pm_end, 517 - .pre_snapshot = acpi_hibernation_pre_snapshot_old, 534 + .pre_snapshot = acpi_pm_pre_suspend, 518 535 .prepare = acpi_pm_freeze, 519 536 .finish = acpi_pm_finish, 520 537 .enter = acpi_hibernation_enter, ··· 669 686 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ 670 687 printk(KERN_DEBUG "%s called\n", __func__); 671 688 local_irq_disable(); 672 - acpi_enable_wakeup_device(ACPI_STATE_S5); 673 689 acpi_enter_sleep_state(ACPI_STATE_S5); 674 690 } 675 691
+2 -3
drivers/acpi/sleep.h
··· 2 2 extern u8 sleep_states[]; 3 3 extern int acpi_suspend(u32 state); 4 4 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); 8 7 9 8 extern struct list_head acpi_wakeup_device_list; 10 9 extern struct mutex acpi_device_lock;
+258 -210
drivers/acpi/system.c drivers/acpi/sysfs.c
··· 1 1 /* 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. 24 3 */ 25 4 26 - #include <linux/proc_fs.h> 27 - #include <linux/seq_file.h> 28 - #include <linux/slab.h> 29 5 #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> 33 8 #include <acpi/acpi_drivers.h> 9 + 10 + #define _COMPONENT ACPI_SYSTEM_COMPONENT 11 + ACPI_MODULE_NAME("sysfs"); 34 12 35 13 #define PREFIX "ACPI: " 36 14 37 - #define _COMPONENT ACPI_SYSTEM_COMPONENT 38 - ACPI_MODULE_NAME("system"); 39 - 40 - #define ACPI_SYSTEM_CLASS "system" 41 - #define ACPI_SYSTEM_DEVICE_NAME "System" 42 - 43 - u32 acpi_irq_handled; 44 - u32 acpi_irq_not_handled; 45 - 15 + #ifdef CONFIG_ACPI_DEBUG 46 16 /* 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 48 24 */ 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 */ 49 216 static int param_get_acpica_version(char *buffer, struct kernel_param *kp) 50 217 { 51 218 int result; ··· 224 57 225 58 module_param_call(acpica_version, NULL, param_get_acpica_version, NULL, 0444); 226 59 227 - /* -------------------------------------------------------------------------- 228 - FS Interface (/sys) 229 - -------------------------------------------------------------------------- */ 60 + /* 61 + * ACPI table sysfs I/F: 62 + * /sys/firmware/acpi/tables/ 63 + * /sys/firmware/acpi/tables/dynamic/ 64 + */ 65 + 230 66 static LIST_HEAD(acpi_table_attr_list); 231 67 static struct kobject *tables_kobj; 232 68 static struct kobject *dynamic_tables_kobj; ··· 256 86 else 257 87 memcpy(name, "\0\0\0\0", 4); 258 88 259 - status = 260 - acpi_get_table(name, table_attr->instance, 261 - &table_header); 89 + status = acpi_get_table(name, table_attr->instance, &table_header); 262 90 if (ACPI_FAILURE(status)) 263 91 return -ENODEV; 264 92 265 93 return memory_read_from_buffer(buf, count, &offset, 266 - table_header, table_header->length); 94 + table_header, table_header->length); 267 95 } 268 96 269 97 static void acpi_table_attr_init(struct acpi_table_attr *table_attr, ··· 273 105 sysfs_attr_init(&table_attr->attr.attr); 274 106 if (table_header->signature[0] != '\0') 275 107 memcpy(table_attr->name, table_header->signature, 276 - ACPI_NAME_SIZE); 108 + ACPI_NAME_SIZE); 277 109 else 278 110 memcpy(table_attr->name, "NULL", 4); 279 111 ··· 285 117 table_attr->instance++; 286 118 287 119 if (table_attr->instance > 1 || (table_attr->instance == 1 && 288 - !acpi_get_table 289 - (table_header->signature, 2, &header))) 120 + !acpi_get_table 121 + (table_header->signature, 2, &header))) 290 122 sprintf(table_attr->name + ACPI_NAME_SIZE, "%d", 291 123 table_attr->instance); 292 124 ··· 306 138 switch (event) { 307 139 case ACPI_TABLE_EVENT_LOAD: 308 140 table_attr = 309 - kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL); 141 + kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL); 310 142 if (!table_attr) 311 143 return AE_NO_MEMORY; 312 144 313 145 acpi_table_attr_init(table_attr, table); 314 146 if (sysfs_create_bin_file(dynamic_tables_kobj, 315 - &table_attr->attr)) { 147 + &table_attr->attr)) { 316 148 kfree(table_attr); 317 149 return AE_ERROR; 318 150 } else 319 - list_add_tail(&table_attr->node, 320 - &acpi_table_attr_list); 151 + list_add_tail(&table_attr->node, &acpi_table_attr_list); 321 152 break; 322 153 case ACPI_TABLE_EVENT_UNLOAD: 323 154 /* ··· 331 164 return AE_OK; 332 165 } 333 166 334 - static int acpi_system_sysfs_init(void) 167 + static int acpi_tables_sysfs_init(void) 335 168 { 336 169 struct acpi_table_attr *table_attr; 337 170 struct acpi_table_header *table_header = NULL; ··· 380 213 } 381 214 382 215 /* 383 - * Detailed ACPI IRQ counters in /sys/firmware/acpi/interrupts/ 384 - * See Documentation/ABI/testing/sysfs-firmware-acpi 216 + * Detailed ACPI IRQ counters: 217 + * /sys/firmware/acpi/interrupts/ 385 218 */ 386 219 220 + u32 acpi_irq_handled; 221 + u32 acpi_irq_not_handled; 222 + 387 223 #define COUNT_GPE 0 388 - #define COUNT_SCI 1 /* acpi_irq_handled */ 389 - #define COUNT_SCI_NOT 2 /* acpi_irq_not_handled */ 390 - #define COUNT_ERROR 3 /* other */ 224 + #define COUNT_SCI 1 /* acpi_irq_handled */ 225 + #define COUNT_SCI_NOT 2 /* acpi_irq_not_handled */ 226 + #define COUNT_ERROR 3 /* other */ 391 227 #define NUM_COUNTERS_EXTRA 4 392 228 393 229 struct event_counter { ··· 407 237 static struct attribute_group interrupt_stats_attr_group = { 408 238 .name = "interrupts", 409 239 }; 240 + 410 241 static struct kobj_attribute *counter_attrs; 411 242 412 243 static void delete_gpe_attr_array(void) ··· 440 269 if (gpe_number < num_gpes) 441 270 all_counters[gpe_number].count++; 442 271 else 443 - all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR]. 444 - count++; 272 + all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + 273 + COUNT_ERROR].count++; 445 274 446 275 return; 447 276 } ··· 454 283 if (event_number < ACPI_NUM_FIXED_EVENTS) 455 284 all_counters[num_gpes + event_number].count++; 456 285 else 457 - all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR]. 458 - count++; 286 + all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + 287 + COUNT_ERROR].count++; 459 288 460 289 return; 461 290 } 462 291 463 - static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle) 292 + static int get_status(u32 index, acpi_event_status *status, 293 + acpi_handle *handle) 464 294 { 465 295 int result = 0; 466 296 ··· 472 300 result = acpi_get_gpe_device(index, handle); 473 301 if (result) { 474 302 ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, 475 - "Invalid GPE 0x%x\n", index)); 303 + "Invalid GPE 0x%x\n", index)); 476 304 goto end; 477 305 } 478 306 result = acpi_get_gpe_status(*handle, index, status); ··· 484 312 } 485 313 486 314 static ssize_t counter_show(struct kobject *kobj, 487 - struct kobj_attribute *attr, char *buf) 315 + struct kobj_attribute *attr, char *buf) 488 316 { 489 317 int index = attr - counter_attrs; 490 318 int size; ··· 493 321 int result = 0; 494 322 495 323 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count = 496 - acpi_irq_handled; 324 + acpi_irq_handled; 497 325 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT].count = 498 - acpi_irq_not_handled; 326 + acpi_irq_not_handled; 499 327 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = 500 - acpi_gpe_count; 501 - 328 + acpi_gpe_count; 502 329 size = sprintf(buf, "%8d", all_counters[index].count); 503 330 504 331 /* "gpe_all" or "sci" */ ··· 509 338 goto end; 510 339 511 340 if (!(status & ACPI_EVENT_FLAG_HANDLE)) 512 - size += sprintf(buf + size, " invalid"); 341 + size += sprintf(buf + size, " invalid"); 513 342 else if (status & ACPI_EVENT_FLAG_ENABLED) 514 - size += sprintf(buf + size, " enabled"); 343 + size += sprintf(buf + size, " enabled"); 515 344 else if (status & ACPI_EVENT_FLAG_WAKE_ENABLED) 516 - size += sprintf(buf + size, " wake_enabled"); 345 + size += sprintf(buf + size, " wake_enabled"); 517 346 else 518 - size += sprintf(buf + size, " disabled"); 347 + size += sprintf(buf + size, " disabled"); 519 348 520 349 end: 521 350 size += sprintf(buf + size, "\n"); ··· 528 357 * enable/disable/clear a gpe/fixed event in user space. 529 358 */ 530 359 static ssize_t counter_set(struct kobject *kobj, 531 - struct kobj_attribute *attr, const char *buf, size_t size) 360 + struct kobj_attribute *attr, const char *buf, 361 + size_t size) 532 362 { 533 363 int index = attr - counter_attrs; 534 364 acpi_event_status status; ··· 553 381 554 382 if (!(status & ACPI_EVENT_FLAG_HANDLE)) { 555 383 printk(KERN_WARNING PREFIX 556 - "Can not change Invalid GPE/Fixed Event status\n"); 384 + "Can not change Invalid GPE/Fixed Event status\n"); 557 385 return -EINVAL; 558 386 } 559 387 560 388 if (index < num_gpes) { 561 389 if (!strcmp(buf, "disable\n") && 562 - (status & ACPI_EVENT_FLAG_ENABLED)) 390 + (status & ACPI_EVENT_FLAG_ENABLED)) 563 391 result = acpi_disable_gpe(handle, index); 564 392 else if (!strcmp(buf, "enable\n") && 565 - !(status & ACPI_EVENT_FLAG_ENABLED)) 393 + !(status & ACPI_EVENT_FLAG_ENABLED)) 566 394 result = acpi_enable_gpe(handle, index); 567 395 else if (!strcmp(buf, "clear\n") && 568 - (status & ACPI_EVENT_FLAG_SET)) 396 + (status & ACPI_EVENT_FLAG_SET)) 569 397 result = acpi_clear_gpe(handle, index); 570 398 else 571 399 all_counters[index].count = strtoul(buf, NULL, 0); 572 400 } else if (index < num_gpes + ACPI_NUM_FIXED_EVENTS) { 573 401 int event = index - num_gpes; 574 402 if (!strcmp(buf, "disable\n") && 575 - (status & ACPI_EVENT_FLAG_ENABLED)) 403 + (status & ACPI_EVENT_FLAG_ENABLED)) 576 404 result = acpi_disable_event(event, ACPI_NOT_ISR); 577 405 else if (!strcmp(buf, "enable\n") && 578 - !(status & ACPI_EVENT_FLAG_ENABLED)) 406 + !(status & ACPI_EVENT_FLAG_ENABLED)) 579 407 result = acpi_enable_event(event, ACPI_NOT_ISR); 580 408 else if (!strcmp(buf, "clear\n") && 581 - (status & ACPI_EVENT_FLAG_SET)) 409 + (status & ACPI_EVENT_FLAG_SET)) 582 410 result = acpi_clear_event(event); 583 411 else 584 412 all_counters[index].count = strtoul(buf, NULL, 0); ··· 602 430 num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA; 603 431 604 432 all_attrs = kzalloc(sizeof(struct attribute *) * (num_counters + 1), 605 - GFP_KERNEL); 433 + GFP_KERNEL); 606 434 if (all_attrs == NULL) 607 435 return; 608 436 609 437 all_counters = kzalloc(sizeof(struct event_counter) * (num_counters), 610 - GFP_KERNEL); 438 + GFP_KERNEL); 611 439 if (all_counters == NULL) 612 440 goto fail; 613 441 614 442 counter_attrs = kzalloc(sizeof(struct kobj_attribute) * (num_counters), 615 - GFP_KERNEL); 443 + GFP_KERNEL); 616 444 if (counter_attrs == NULL) 617 445 goto fail; 618 446 ··· 675 503 return; 676 504 } 677 505 678 - /* -------------------------------------------------------------------------- 679 - FS Interface (/proc) 680 - -------------------------------------------------------------------------- */ 681 - #ifdef CONFIG_ACPI_PROCFS 682 - #define ACPI_SYSTEM_FILE_INFO "info" 683 - #define ACPI_SYSTEM_FILE_EVENT "event" 684 - #define ACPI_SYSTEM_FILE_DSDT "dsdt" 685 - #define ACPI_SYSTEM_FILE_FADT "fadt" 686 - 687 - static int acpi_system_read_info(struct seq_file *seq, void *offset) 688 - { 689 - 690 - seq_printf(seq, "version: %x\n", ACPI_CA_VERSION); 691 - return 0; 692 - } 693 - 694 - static int acpi_system_info_open_fs(struct inode *inode, struct file *file) 695 - { 696 - return single_open(file, acpi_system_read_info, PDE(inode)->data); 697 - } 698 - 699 - static const struct file_operations acpi_system_info_ops = { 700 - .owner = THIS_MODULE, 701 - .open = acpi_system_info_open_fs, 702 - .read = seq_read, 703 - .llseek = seq_lseek, 704 - .release = single_release, 705 - }; 706 - 707 - static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t, 708 - loff_t *); 709 - 710 - static const struct file_operations acpi_system_dsdt_ops = { 711 - .owner = THIS_MODULE, 712 - .read = acpi_system_read_dsdt, 713 - }; 714 - 715 - static ssize_t 716 - acpi_system_read_dsdt(struct file *file, 717 - char __user * buffer, size_t count, loff_t * ppos) 718 - { 719 - acpi_status status = AE_OK; 720 - struct acpi_table_header *dsdt = NULL; 721 - ssize_t res; 722 - 723 - status = acpi_get_table(ACPI_SIG_DSDT, 1, &dsdt); 724 - if (ACPI_FAILURE(status)) 725 - return -ENODEV; 726 - 727 - res = simple_read_from_buffer(buffer, count, ppos, dsdt, dsdt->length); 728 - 729 - return res; 730 - } 731 - 732 - static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t, 733 - loff_t *); 734 - 735 - static const struct file_operations acpi_system_fadt_ops = { 736 - .owner = THIS_MODULE, 737 - .read = acpi_system_read_fadt, 738 - }; 739 - 740 - static ssize_t 741 - acpi_system_read_fadt(struct file *file, 742 - char __user * buffer, size_t count, loff_t * ppos) 743 - { 744 - acpi_status status = AE_OK; 745 - struct acpi_table_header *fadt = NULL; 746 - ssize_t res; 747 - 748 - status = acpi_get_table(ACPI_SIG_FADT, 1, &fadt); 749 - if (ACPI_FAILURE(status)) 750 - return -ENODEV; 751 - 752 - res = simple_read_from_buffer(buffer, count, ppos, fadt, fadt->length); 753 - 754 - return res; 755 - } 756 - 757 - static int acpi_system_procfs_init(void) 758 - { 759 - struct proc_dir_entry *entry; 760 - int error = 0; 761 - 762 - /* 'info' [R] */ 763 - entry = proc_create(ACPI_SYSTEM_FILE_INFO, S_IRUGO, acpi_root_dir, 764 - &acpi_system_info_ops); 765 - if (!entry) 766 - goto Error; 767 - 768 - /* 'dsdt' [R] */ 769 - entry = proc_create(ACPI_SYSTEM_FILE_DSDT, S_IRUSR, acpi_root_dir, 770 - &acpi_system_dsdt_ops); 771 - if (!entry) 772 - goto Error; 773 - 774 - /* 'fadt' [R] */ 775 - entry = proc_create(ACPI_SYSTEM_FILE_FADT, S_IRUSR, acpi_root_dir, 776 - &acpi_system_fadt_ops); 777 - if (!entry) 778 - goto Error; 779 - 780 - Done: 781 - return error; 782 - 783 - Error: 784 - remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir); 785 - remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir); 786 - remove_proc_entry(ACPI_SYSTEM_FILE_INFO, acpi_root_dir); 787 - 788 - error = -EFAULT; 789 - goto Done; 790 - } 791 - #else 792 - static int acpi_system_procfs_init(void) 793 - { 794 - return 0; 795 - } 796 - #endif 797 - 798 - int __init acpi_system_init(void) 506 + int __init acpi_sysfs_init(void) 799 507 { 800 508 int result; 801 509 802 - result = acpi_system_procfs_init(); 803 - if (result) 804 - return result; 805 - 806 - result = acpi_system_sysfs_init(); 510 + result = acpi_tables_sysfs_init(); 807 511 808 512 return result; 809 513 }
+53 -33
drivers/acpi/thermal.c
··· 37 37 #include <linux/init.h> 38 38 #include <linux/slab.h> 39 39 #include <linux/types.h> 40 + 41 + #ifdef CONFIG_ACPI_PROCFS 40 42 #include <linux/proc_fs.h> 43 + #include <linux/seq_file.h> 44 + #endif 45 + 41 46 #include <linux/jiffies.h> 42 47 #include <linux/kmod.h> 43 - #include <linux/seq_file.h> 44 48 #include <linux/reboot.h> 45 49 #include <linux/device.h> 46 50 #include <asm/uaccess.h> ··· 106 102 static int acpi_thermal_remove(struct acpi_device *device, int type); 107 103 static int acpi_thermal_resume(struct acpi_device *device); 108 104 static void acpi_thermal_notify(struct acpi_device *device, u32 event); 109 - static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); 110 - static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); 111 - static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); 112 - static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); 113 - static ssize_t acpi_thermal_write_cooling_mode(struct file *, 114 - const char __user *, size_t, 115 - loff_t *); 116 - static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file); 117 - static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, 118 - size_t, loff_t *); 119 105 120 106 static const struct acpi_device_id thermal_device_ids[] = { 121 107 {ACPI_THERMAL_HID, 0}, ··· 195 201 struct mutex lock; 196 202 }; 197 203 204 + #ifdef CONFIG_ACPI_PROCFS 205 + static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); 206 + static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); 207 + static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); 208 + static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); 209 + static ssize_t acpi_thermal_write_cooling_mode(struct file *, 210 + const char __user *, size_t, 211 + loff_t *); 212 + static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file); 213 + static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, 214 + size_t, loff_t *); 215 + 198 216 static const struct file_operations acpi_thermal_state_fops = { 199 217 .owner = THIS_MODULE, 200 218 .open = acpi_thermal_state_open_fs, ··· 248 242 .llseek = seq_lseek, 249 243 .release = single_release, 250 244 }; 245 + #endif /* CONFIG_ACPI_PROCFS*/ 251 246 252 247 /* -------------------------------------------------------------------------- 253 248 Thermal Zone Management ··· 290 283 tz->polling_frequency = tmp; 291 284 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", 292 285 tz->polling_frequency)); 293 - 294 - return 0; 295 - } 296 - 297 - static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) 298 - { 299 - 300 - if (!tz) 301 - return -EINVAL; 302 - 303 - tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */ 304 - 305 - tz->thermal_zone->polling_delay = seconds * 1000; 306 - 307 - if (tz->tz_enabled) 308 - thermal_zone_device_update(tz->thermal_zone); 309 - 310 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 311 - "Polling frequency set to %lu seconds\n", 312 - tz->polling_frequency/10)); 313 286 314 287 return 0; 315 288 } ··· 960 973 /* -------------------------------------------------------------------------- 961 974 FS Interface (/proc) 962 975 -------------------------------------------------------------------------- */ 963 - 976 + #ifdef CONFIG_ACPI_PROCFS 964 977 static struct proc_dir_entry *acpi_thermal_dir; 965 978 966 979 static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) ··· 1174 1187 PDE(inode)->data); 1175 1188 } 1176 1189 1190 + static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) 1191 + { 1192 + if (!tz) 1193 + return -EINVAL; 1194 + 1195 + /* Convert value to deci-seconds */ 1196 + tz->polling_frequency = seconds * 10; 1197 + 1198 + tz->thermal_zone->polling_delay = seconds * 1000; 1199 + 1200 + if (tz->tz_enabled) 1201 + thermal_zone_device_update(tz->thermal_zone); 1202 + 1203 + ACPI_DEBUG_PRINT((ACPI_DB_INFO, 1204 + "Polling frequency set to %lu seconds\n", 1205 + tz->polling_frequency/10)); 1206 + 1207 + return 0; 1208 + } 1209 + 1177 1210 static ssize_t 1178 1211 acpi_thermal_write_polling(struct file *file, 1179 1212 const char __user * buffer, ··· 1302 1295 1303 1296 return 0; 1304 1297 } 1305 - 1298 + #else 1299 + static inline int acpi_thermal_add_fs(struct acpi_device *device) { return 0; } 1300 + static inline int acpi_thermal_remove_fs(struct acpi_device *device) 1301 + { 1302 + return 0; 1303 + } 1304 + #endif /* CONFIG_ACPI_PROCFS */ 1306 1305 /* -------------------------------------------------------------------------- 1307 1306 Driver Interface 1308 1307 -------------------------------------------------------------------------- */ ··· 1579 1566 printk(KERN_NOTICE "ACPI: thermal control disabled\n"); 1580 1567 return -ENODEV; 1581 1568 } 1569 + 1570 + #ifdef CONFIG_ACPI_PROCFS 1582 1571 acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); 1583 1572 if (!acpi_thermal_dir) 1584 1573 return -ENODEV; 1574 + #endif 1585 1575 1586 1576 result = acpi_bus_register_driver(&acpi_thermal_driver); 1587 1577 if (result < 0) { 1578 + #ifdef CONFIG_ACPI_PROCFS 1588 1579 remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); 1580 + #endif 1589 1581 return -ENODEV; 1590 1582 } 1591 1583 ··· 1602 1584 1603 1585 acpi_bus_unregister_driver(&acpi_thermal_driver); 1604 1586 1587 + #ifdef CONFIG_ACPI_PROCFS 1605 1588 remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); 1589 + #endif 1606 1590 1607 1591 return; 1608 1592 }
+86 -55
drivers/acpi/video.c
··· 152 152 struct acpi_video_bus_flags flags; 153 153 struct list_head video_device_list; 154 154 struct mutex device_list_lock; /* protects video_device_list */ 155 + #ifdef CONFIG_ACPI_PROCFS 155 156 struct proc_dir_entry *dir; 157 + #endif 156 158 struct input_dev *input; 157 159 char phys[32]; /* for input device */ 158 160 struct notifier_block pm_nb; ··· 210 208 struct output_device *output_dev; 211 209 }; 212 210 211 + #ifdef CONFIG_ACPI_PROCFS 213 212 /* bus */ 214 213 static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); 215 214 static const struct file_operations acpi_video_bus_info_fops = { ··· 310 307 .llseek = seq_lseek, 311 308 .release = single_release, 312 309 }; 310 + #endif /* CONFIG_ACPI_PROCFS */ 313 311 314 312 static const char device_decode[][30] = { 315 313 "motherboard VGA device", ··· 452 448 -------------------------------------------------------------------------- */ 453 449 454 450 /* device */ 455 - 456 - static int 457 - acpi_video_device_query(struct acpi_video_device *device, unsigned long long *state) 458 - { 459 - int status; 460 - 461 - status = acpi_evaluate_integer(device->dev->handle, "_DGS", NULL, state); 462 - 463 - return status; 464 - } 465 451 466 452 static int 467 453 acpi_video_device_get_state(struct acpi_video_device *device, ··· 691 697 } 692 698 693 699 /* bus */ 694 - 695 - static int 696 - acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) 697 - { 698 - int status; 699 - unsigned long long tmp; 700 - union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 701 - struct acpi_object_list args = { 1, &arg0 }; 702 - 703 - 704 - arg0.integer.value = option; 705 - 706 - status = acpi_evaluate_integer(video->device->handle, "_SPD", &args, &tmp); 707 - if (ACPI_SUCCESS(status)) 708 - status = tmp ? (-EINVAL) : (AE_OK); 709 - 710 - return status; 711 - } 712 - 713 - static int 714 - acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id) 715 - { 716 - int status; 717 - 718 - status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id); 719 - 720 - return status; 721 - } 722 - 723 - static int 724 - acpi_video_bus_POST_options(struct acpi_video_bus *video, 725 - unsigned long long *options) 726 - { 727 - int status; 728 - 729 - status = acpi_evaluate_integer(video->device->handle, "_VPO", NULL, options); 730 - *options &= 3; 731 - 732 - return status; 733 - } 734 700 735 701 /* 736 702 * Arg: ··· 1113 1159 /* -------------------------------------------------------------------------- 1114 1160 FS Interface (/proc) 1115 1161 -------------------------------------------------------------------------- */ 1162 + #ifdef CONFIG_ACPI_PROCFS 1116 1163 1117 1164 static struct proc_dir_entry *acpi_video_dir; 1118 1165 ··· 1151 1196 { 1152 1197 return single_open(file, acpi_video_device_info_seq_show, 1153 1198 PDE(inode)->data); 1199 + } 1200 + 1201 + static int 1202 + acpi_video_device_query(struct acpi_video_device *device, 1203 + unsigned long long *state) 1204 + { 1205 + int status; 1206 + 1207 + status = acpi_evaluate_integer(device->dev->handle, "_DGS", 1208 + NULL, state); 1209 + 1210 + return status; 1154 1211 } 1155 1212 1156 1213 static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) ··· 1459 1492 return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data); 1460 1493 } 1461 1494 1495 + static int 1496 + acpi_video_bus_POST_options(struct acpi_video_bus *video, 1497 + unsigned long long *options) 1498 + { 1499 + int status; 1500 + 1501 + status = acpi_evaluate_integer(video->device->handle, "_VPO", 1502 + NULL, options); 1503 + *options &= 3; 1504 + 1505 + return status; 1506 + } 1507 + 1462 1508 static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) 1463 1509 { 1464 1510 struct acpi_video_bus *video = seq->private; ··· 1508 1528 { 1509 1529 return single_open(file, acpi_video_bus_POST_info_seq_show, 1510 1530 PDE(inode)->data); 1531 + } 1532 + 1533 + static int 1534 + acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id) 1535 + { 1536 + int status; 1537 + 1538 + status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id); 1539 + 1540 + return status; 1511 1541 } 1512 1542 1513 1543 static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) ··· 1560 1570 static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file) 1561 1571 { 1562 1572 return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data); 1573 + } 1574 + 1575 + static int 1576 + acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) 1577 + { 1578 + int status; 1579 + unsigned long long tmp; 1580 + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 1581 + struct acpi_object_list args = { 1, &arg0 }; 1582 + 1583 + 1584 + arg0.integer.value = option; 1585 + 1586 + status = acpi_evaluate_integer(video->device->handle, "_SPD", 1587 + &args, &tmp); 1588 + if (ACPI_SUCCESS(status)) 1589 + status = tmp ? (-EINVAL) : (AE_OK); 1590 + 1591 + return status; 1563 1592 } 1564 1593 1565 1594 static ssize_t ··· 1731 1722 1732 1723 return 0; 1733 1724 } 1725 + #else 1726 + static inline int acpi_video_device_add_fs(struct acpi_device *device) 1727 + { 1728 + return 0; 1729 + } 1730 + static inline int acpi_video_device_remove_fs(struct acpi_device *device) 1731 + { 1732 + return 0; 1733 + } 1734 + static inline int acpi_video_bus_add_fs(struct acpi_device *device) 1735 + { 1736 + return 0; 1737 + } 1738 + static inline int acpi_video_bus_remove_fs(struct acpi_device *device) 1739 + { 1740 + return 0; 1741 + } 1742 + #endif /* CONFIG_ACPI_PROCFS */ 1734 1743 1735 1744 /* -------------------------------------------------------------------------- 1736 1745 Driver Interface ··· 2167 2140 status = acpi_video_bus_get_one_device(dev, video); 2168 2141 if (ACPI_FAILURE(status)) { 2169 2142 printk(KERN_WARNING PREFIX 2170 - "Cant attach device"); 2143 + "Cant attach device\n"); 2171 2144 continue; 2172 2145 } 2173 2146 } ··· 2177 2150 static int acpi_video_bus_put_one_device(struct acpi_video_device *device) 2178 2151 { 2179 2152 acpi_status status; 2180 - struct acpi_video_bus *video; 2181 - 2182 2153 2183 2154 if (!device || !device->video) 2184 2155 return -ENOENT; 2185 - 2186 - video = device->video; 2187 2156 2188 2157 acpi_video_device_remove_fs(device->dev); 2189 2158 2190 2159 status = acpi_remove_notify_handler(device->dev->handle, 2191 2160 ACPI_DEVICE_NOTIFY, 2192 2161 acpi_video_device_notify); 2162 + if (ACPI_FAILURE(status)) { 2163 + printk(KERN_WARNING PREFIX 2164 + "Cant remove video notify handler\n"); 2165 + } 2193 2166 if (device->backlight) { 2194 2167 sysfs_remove_link(&device->backlight->dev.kobj, "device"); 2195 2168 backlight_device_unregister(device->backlight); ··· 2584 2557 return 0; 2585 2558 } 2586 2559 2560 + #ifdef CONFIG_ACPI_PROCFS 2587 2561 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); 2588 2562 if (!acpi_video_dir) 2589 2563 return -ENODEV; 2564 + #endif 2590 2565 2591 2566 result = acpi_bus_register_driver(&acpi_video_bus); 2592 2567 if (result < 0) { ··· 2617 2588 } 2618 2589 acpi_bus_unregister_driver(&acpi_video_bus); 2619 2590 2591 + #ifdef CONFIG_ACPI_PROCFS 2620 2592 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); 2593 + #endif 2621 2594 2622 2595 register_count = 0; 2623 2596
+10 -38
drivers/acpi/wakeup.c
··· 21 21 ACPI_MODULE_NAME("wakeup_devices") 22 22 23 23 /** 24 - * acpi_enable_wakeup_device_prep - Prepare wake-up devices. 24 + * acpi_enable_wakeup_devices - Enable wake-up device GPEs. 25 25 * @sleep_state: ACPI system sleep state. 26 26 * 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. 29 30 */ 30 - void acpi_enable_wakeup_device_prep(u8 sleep_state) 31 + void acpi_enable_wakeup_devices(u8 sleep_state) 31 32 { 32 33 struct list_head *node, *next; 33 34 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 - */ 63 35 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 64 36 struct acpi_device *dev = 65 37 container_of(node, struct acpi_device, wakeup_list); ··· 41 69 || sleep_state > (u32) dev->wakeup.sleep_state) 42 70 continue; 43 71 72 + if (dev->wakeup.state.enabled) 73 + acpi_enable_wakeup_device_power(dev, sleep_state); 74 + 44 75 /* The wake-up power should have been enabled already. */ 45 76 acpi_gpe_wakeup(dev->wakeup.gpe_device, dev->wakeup.gpe_number, 46 77 ACPI_GPE_ENABLE); ··· 51 76 } 52 77 53 78 /** 54 - * acpi_disable_wakeup_device - Disable devices' wakeup capability. 79 + * acpi_disable_wakeup_devices - Disable devices' wakeup capability. 55 80 * @sleep_state: ACPI system sleep state. 56 - * 57 - * This function only affects devices with wakeup.state.enabled set, which means 58 - * that it reverses the changes made by acpi_enable_wakeup_device_prep(). 59 81 */ 60 - void acpi_disable_wakeup_device(u8 sleep_state) 82 + void acpi_disable_wakeup_devices(u8 sleep_state) 61 83 { 62 84 struct list_head *node, *next; 63 85
-6
drivers/ata/libata-acpi.c
··· 145 145 struct ata_eh_info *ehi = &ap->link.eh_info; 146 146 int wait = 0; 147 147 unsigned long flags; 148 - acpi_handle handle; 149 - 150 - if (dev) 151 - handle = dev->acpi_handle; 152 - else 153 - handle = ap->acpi_handle; 154 148 155 149 spin_lock_irqsave(ap->lock, flags); 156 150 /*
+1 -1
include/acpi/acpixf.h
··· 66 66 extern u8 acpi_gbl_use_default_register_widths; 67 67 extern acpi_name acpi_gbl_trace_method_name; 68 68 extern u32 acpi_gbl_trace_flags; 69 - extern u8 acpi_gbl_enable_aml_debug_object; 69 + extern u32 acpi_gbl_enable_aml_debug_object; 70 70 extern u8 acpi_gbl_copy_dsdt_locally; 71 71 extern u8 acpi_gbl_truncate_io_addresses; 72 72
-1
include/acpi/processor.h
··· 338 338 339 339 /* in processor_thermal.c */ 340 340 int acpi_processor_get_limit_info(struct acpi_processor *pr); 341 - extern const struct file_operations acpi_processor_limit_fops; 342 341 extern struct thermal_cooling_device_ops processor_cooling_ops; 343 342 #ifdef CONFIG_CPU_FREQ 344 343 void acpi_thermal_cpufreq_init(void);
+4 -4
include/linux/cper.h
··· 39 39 * Severity difinition for error_severity in struct cper_record_header 40 40 * and section_severity in struct cper_section_descriptor 41 41 */ 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 46 46 47 47 /* 48 48 * Validation bits difinition for validation_bits in struct