aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-27 20:10:20 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-27 20:10:20 -0400
commit8e32e47dbb98fd24e4c541753427a576e6ab5bb3 (patch)
treeae9e3eb57380171a25af431dea1e4665ef9c7abf
parent959f58544b7f20c92d5eb43d1232c96c15c01bfb (diff)
parent7744da5e90a2782ff0d48628c2cb120efcd300f3 (diff)
Merge branch 'acpi-cleanup'
* acpi-cleanup: (34 commits) ACPI / proc: Remove alarm proc file ACPI: Remove CONFIG_ACPI_PROCFS_POWER and cm_sbsc.c ACPI / SBS: Remove SBS's proc directory ACPI / Battery: Remove battery's proc directory ACP / fan: trivial style cleanup ACPI / processor: remove superfluous pr == NULL checks ACPI / mm: use NUMA_NO_NODE toshiba_acpi: convert acpi_evaluate_object() to acpi_evaluate_integer() intel-smartconnect: convert acpi_evaluate_object() to acpi_evaluate_integer() intel-rst: convert acpi_evaluate_object() to acpi_evaluate_integer() fujitsu-laptop: convert acpi_evaluate_object() to acpi_evaluate_integer() i2c-hid: convert acpi_evaluate_object() to acpi_evaluate_integer() ACPI: dock: convert acpi_evaluate_object() to acpi_evaluate_integer() acpi_processor: convert acpi_evaluate_object() to acpi_evaluate_integer() pnpacpi: convert acpi_get_handle() to acpi_has_method() wmi: convert acpi_get_handle() to acpi_has_method() toshiba_acpi: convert acpi_get_handle() to acpi_has_method() sony-laptop: convert acpi_get_handle() to acpi_has_method() intel_menlow: convert acpi_get_handle() to acpi_has_method() fujitsu-laptop: convert acpi_get_handle() to acpi_has_method() ...
-rw-r--r--arch/x86/platform/olpc/olpc-xo15-sci.c9
-rw-r--r--drivers/acpi/Kconfig17
-rw-r--r--drivers/acpi/Makefile1
-rw-r--r--drivers/acpi/acpi_memhotplug.c2
-rw-r--r--drivers/acpi/acpi_processor.c6
-rw-r--r--drivers/acpi/battery.c328
-rw-r--r--drivers/acpi/cm_sbs.c105
-rw-r--r--drivers/acpi/dock.c6
-rw-r--r--drivers/acpi/fan.c2
-rw-r--r--drivers/acpi/numa.c4
-rw-r--r--drivers/acpi/proc.c305
-rw-r--r--drivers/acpi/processor_idle.c15
-rw-r--r--drivers/acpi/sbs.c325
-rw-r--r--drivers/cpufreq/pcc-cpufreq.c5
-rw-r--r--drivers/gpio/gpiolib-acpi.c9
-rw-r--r--drivers/gpu/drm/i915/intel_acpi.c6
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_acpi.c7
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c18
-rw-r--r--drivers/pci/hotplug/acpi_pcihp.c7
-rw-r--r--drivers/pci/pci-acpi.c3
-rw-r--r--drivers/platform/x86/eeepc-laptop.c8
-rw-r--r--drivers/platform/x86/fujitsu-laptop.c44
-rw-r--r--drivers/platform/x86/intel-rst.c48
-rw-r--r--drivers/platform/x86/intel-smartconnect.c27
-rw-r--r--drivers/platform/x86/intel_menlow.c8
-rw-r--r--drivers/platform/x86/sony-laptop.c28
-rw-r--r--drivers/platform/x86/topstar-laptop.c8
-rw-r--r--drivers/platform/x86/toshiba_acpi.c44
-rw-r--r--drivers/platform/x86/wmi.c30
-rw-r--r--drivers/pnp/pnpacpi/core.c11
30 files changed, 90 insertions, 1346 deletions
diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c b/arch/x86/platform/olpc/olpc-xo15-sci.c
index fef7d0ba7e3a..649a12befba9 100644
--- a/arch/x86/platform/olpc/olpc-xo15-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
@@ -40,16 +40,9 @@ static bool lid_wake_on_close;
40 */ 40 */
41static int set_lid_wake_behavior(bool wake_on_close) 41static int set_lid_wake_behavior(bool wake_on_close)
42{ 42{
43 struct acpi_object_list arg_list;
44 union acpi_object arg;
45 acpi_status status; 43 acpi_status status;
46 44
47 arg_list.count = 1; 45 status = acpi_execute_simple_method(NULL, "\\_SB.PCI0.LID.LIDW", wake_on_close);
48 arg_list.pointer = &arg;
49 arg.type = ACPI_TYPE_INTEGER;
50 arg.integer.value = wake_on_close;
51
52 status = acpi_evaluate_object(NULL, "\\_SB.PCI0.LID.LIDW", &arg_list, NULL);
53 if (ACPI_FAILURE(status)) { 46 if (ACPI_FAILURE(status)) {
54 pr_warning(PFX "failed to set lid behavior\n"); 47 pr_warning(PFX "failed to set lid behavior\n");
55 return 1; 48 return 1;
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 6efe2ac6902f..10e399f97189 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -56,23 +56,6 @@ config ACPI_PROCFS
56 56
57 Say N to delete /proc/acpi/ files that have moved to /sys/ 57 Say N to delete /proc/acpi/ files that have moved to /sys/
58 58
59config ACPI_PROCFS_POWER
60 bool "Deprecated power /proc/acpi directories"
61 depends on PROC_FS
62 help
63 For backwards compatibility, this option allows
64 deprecated power /proc/acpi/ directories to exist, even when
65 they have been replaced by functions in /sys.
66 The deprecated directories (and their replacements) include:
67 /proc/acpi/battery/* (/sys/class/power_supply/*)
68 /proc/acpi/ac_adapter/* (sys/class/power_supply/*)
69 This option has no effect on /proc/acpi/ directories
70 and functions, which do not yet exist in /sys
71 This option, together with the proc directories, will be
72 deleted in 2.6.39.
73
74 Say N to delete power /proc/acpi/ directories that have moved to /sys/
75
76config ACPI_EC_DEBUGFS 59config ACPI_EC_DEBUGFS
77 tristate "EC read/write access through /sys/kernel/debug/ec" 60 tristate "EC read/write access through /sys/kernel/debug/ec"
78 default n 61 default n
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index cdaf68b58b00..a55fc06db4ae 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -47,7 +47,6 @@ acpi-y += sysfs.o
47acpi-$(CONFIG_X86) += acpi_cmos_rtc.o 47acpi-$(CONFIG_X86) += acpi_cmos_rtc.o
48acpi-$(CONFIG_DEBUG_FS) += debugfs.o 48acpi-$(CONFIG_DEBUG_FS) += debugfs.o
49acpi-$(CONFIG_ACPI_NUMA) += numa.o 49acpi-$(CONFIG_ACPI_NUMA) += numa.o
50acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
51ifdef CONFIG_ACPI_VIDEO 50ifdef CONFIG_ACPI_VIDEO
52acpi-y += video_detect.o 51acpi-y += video_detect.o
53endif 52endif
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 999adb5499c7..c00a3a73409b 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -281,7 +281,7 @@ static void acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
281 if (!info->enabled) 281 if (!info->enabled)
282 continue; 282 continue;
283 283
284 if (nid < 0) 284 if (nid == NUMA_NO_NODE)
285 nid = memory_add_physaddr_to_nid(info->start_addr); 285 nid = memory_add_physaddr_to_nid(info->start_addr);
286 286
287 acpi_unbind_memory_blocks(info, handle); 287 acpi_unbind_memory_blocks(info, handle);
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index f29e06efa479..357abdc1406a 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -219,6 +219,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
219 int cpu_index, device_declaration = 0; 219 int cpu_index, device_declaration = 0;
220 acpi_status status = AE_OK; 220 acpi_status status = AE_OK;
221 static int cpu0_initialized; 221 static int cpu0_initialized;
222 unsigned long long value;
222 223
223 if (num_online_cpus() > 1) 224 if (num_online_cpus() > 1)
224 errata.smp = TRUE; 225 errata.smp = TRUE;
@@ -258,7 +259,6 @@ static int acpi_processor_get_info(struct acpi_device *device)
258 * Declared with "Device" statement; match _UID. 259 * Declared with "Device" statement; match _UID.
259 * Note that we don't handle string _UIDs yet. 260 * Note that we don't handle string _UIDs yet.
260 */ 261 */
261 unsigned long long value;
262 status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, 262 status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID,
263 NULL, &value); 263 NULL, &value);
264 if (ACPI_FAILURE(status)) { 264 if (ACPI_FAILURE(status)) {
@@ -332,9 +332,9 @@ static int acpi_processor_get_info(struct acpi_device *device)
332 * ensure we get the right value in the "physical id" field 332 * ensure we get the right value in the "physical id" field
333 * of /proc/cpuinfo 333 * of /proc/cpuinfo
334 */ 334 */
335 status = acpi_evaluate_object(pr->handle, "_SUN", NULL, &buffer); 335 status = acpi_evaluate_integer(pr->handle, "_SUN", NULL, &value);
336 if (ACPI_SUCCESS(status)) 336 if (ACPI_SUCCESS(status))
337 arch_fix_phys_package_id(pr->id, object.integer.value); 337 arch_fix_phys_package_id(pr->id, value);
338 338
339 return 0; 339 return 0;
340} 340}
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 2c9958cd7a43..fbf1aceda8b8 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -36,12 +36,6 @@
36#include <linux/suspend.h> 36#include <linux/suspend.h>
37#include <asm/unaligned.h> 37#include <asm/unaligned.h>
38 38
39#ifdef CONFIG_ACPI_PROCFS_POWER
40#include <linux/proc_fs.h>
41#include <linux/seq_file.h>
42#include <asm/uaccess.h>
43#endif
44
45#include <acpi/acpi_bus.h> 39#include <acpi/acpi_bus.h>
46#include <acpi/acpi_drivers.h> 40#include <acpi/acpi_drivers.h>
47#include <linux/power_supply.h> 41#include <linux/power_supply.h>
@@ -72,19 +66,6 @@ static unsigned int cache_time = 1000;
72module_param(cache_time, uint, 0644); 66module_param(cache_time, uint, 0644);
73MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); 67MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
74 68
75#ifdef CONFIG_ACPI_PROCFS_POWER
76extern struct proc_dir_entry *acpi_lock_battery_dir(void);
77extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
78
79enum acpi_battery_files {
80 info_tag = 0,
81 state_tag,
82 alarm_tag,
83 ACPI_BATTERY_NUMFILES,
84};
85
86#endif
87
88static const struct acpi_device_id battery_device_ids[] = { 69static const struct acpi_device_id battery_device_ids[] = {
89 {"PNP0C0A", 0}, 70 {"PNP0C0A", 0},
90 {"", 0}, 71 {"", 0},
@@ -320,14 +301,6 @@ static enum power_supply_property energy_battery_props[] = {
320 POWER_SUPPLY_PROP_SERIAL_NUMBER, 301 POWER_SUPPLY_PROP_SERIAL_NUMBER,
321}; 302};
322 303
323#ifdef CONFIG_ACPI_PROCFS_POWER
324inline char *acpi_battery_units(struct acpi_battery *battery)
325{
326 return (battery->power_unit == ACPI_BATTERY_POWER_UNIT_MA) ?
327 "mA" : "mW";
328}
329#endif
330
331/* -------------------------------------------------------------------------- 304/* --------------------------------------------------------------------------
332 Battery Management 305 Battery Management
333 -------------------------------------------------------------------------- */ 306 -------------------------------------------------------------------------- */
@@ -741,279 +714,6 @@ static void acpi_battery_refresh(struct acpi_battery *battery)
741} 714}
742 715
743/* -------------------------------------------------------------------------- 716/* --------------------------------------------------------------------------
744 FS Interface (/proc)
745 -------------------------------------------------------------------------- */
746
747#ifdef CONFIG_ACPI_PROCFS_POWER
748static struct proc_dir_entry *acpi_battery_dir;
749
750static int acpi_battery_print_info(struct seq_file *seq, int result)
751{
752 struct acpi_battery *battery = seq->private;
753
754 if (result)
755 goto end;
756
757 seq_printf(seq, "present: %s\n",
758 acpi_battery_present(battery) ? "yes" : "no");
759 if (!acpi_battery_present(battery))
760 goto end;
761 if (battery->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
762 seq_printf(seq, "design capacity: unknown\n");
763 else
764 seq_printf(seq, "design capacity: %d %sh\n",
765 battery->design_capacity,
766 acpi_battery_units(battery));
767
768 if (battery->full_charge_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
769 seq_printf(seq, "last full capacity: unknown\n");
770 else
771 seq_printf(seq, "last full capacity: %d %sh\n",
772 battery->full_charge_capacity,
773 acpi_battery_units(battery));
774
775 seq_printf(seq, "battery technology: %srechargeable\n",
776 (!battery->technology)?"non-":"");
777
778 if (battery->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
779 seq_printf(seq, "design voltage: unknown\n");
780 else
781 seq_printf(seq, "design voltage: %d mV\n",
782 battery->design_voltage);
783 seq_printf(seq, "design capacity warning: %d %sh\n",
784 battery->design_capacity_warning,
785 acpi_battery_units(battery));
786 seq_printf(seq, "design capacity low: %d %sh\n",
787 battery->design_capacity_low,
788 acpi_battery_units(battery));
789 seq_printf(seq, "cycle count: %i\n", battery->cycle_count);
790 seq_printf(seq, "capacity granularity 1: %d %sh\n",
791 battery->capacity_granularity_1,
792 acpi_battery_units(battery));
793 seq_printf(seq, "capacity granularity 2: %d %sh\n",
794 battery->capacity_granularity_2,
795 acpi_battery_units(battery));
796 seq_printf(seq, "model number: %s\n", battery->model_number);
797 seq_printf(seq, "serial number: %s\n", battery->serial_number);
798 seq_printf(seq, "battery type: %s\n", battery->type);
799 seq_printf(seq, "OEM info: %s\n", battery->oem_info);
800 end:
801 if (result)
802 seq_printf(seq, "ERROR: Unable to read battery info\n");
803 return result;
804}
805
806static int acpi_battery_print_state(struct seq_file *seq, int result)
807{
808 struct acpi_battery *battery = seq->private;
809
810 if (result)
811 goto end;
812
813 seq_printf(seq, "present: %s\n",
814 acpi_battery_present(battery) ? "yes" : "no");
815 if (!acpi_battery_present(battery))
816 goto end;
817
818 seq_printf(seq, "capacity state: %s\n",
819 (battery->state & 0x04) ? "critical" : "ok");
820 if ((battery->state & 0x01) && (battery->state & 0x02))
821 seq_printf(seq,
822 "charging state: charging/discharging\n");
823 else if (battery->state & 0x01)
824 seq_printf(seq, "charging state: discharging\n");
825 else if (battery->state & 0x02)
826 seq_printf(seq, "charging state: charging\n");
827 else
828 seq_printf(seq, "charging state: charged\n");
829
830 if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN)
831 seq_printf(seq, "present rate: unknown\n");
832 else
833 seq_printf(seq, "present rate: %d %s\n",
834 battery->rate_now, acpi_battery_units(battery));
835
836 if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN)
837 seq_printf(seq, "remaining capacity: unknown\n");
838 else
839 seq_printf(seq, "remaining capacity: %d %sh\n",
840 battery->capacity_now, acpi_battery_units(battery));
841 if (battery->voltage_now == ACPI_BATTERY_VALUE_UNKNOWN)
842 seq_printf(seq, "present voltage: unknown\n");
843 else
844 seq_printf(seq, "present voltage: %d mV\n",
845 battery->voltage_now);
846 end:
847 if (result)
848 seq_printf(seq, "ERROR: Unable to read battery state\n");
849
850 return result;
851}
852
853static int acpi_battery_print_alarm(struct seq_file *seq, int result)
854{
855 struct acpi_battery *battery = seq->private;
856
857 if (result)
858 goto end;
859
860 if (!acpi_battery_present(battery)) {
861 seq_printf(seq, "present: no\n");
862 goto end;
863 }
864 seq_printf(seq, "alarm: ");
865 if (!battery->alarm)
866 seq_printf(seq, "unsupported\n");
867 else
868 seq_printf(seq, "%u %sh\n", battery->alarm,
869 acpi_battery_units(battery));
870 end:
871 if (result)
872 seq_printf(seq, "ERROR: Unable to read battery alarm\n");
873 return result;
874}
875
876static ssize_t acpi_battery_write_alarm(struct file *file,
877 const char __user * buffer,
878 size_t count, loff_t * ppos)
879{
880 int result = 0;
881 char alarm_string[12] = { '\0' };
882 struct seq_file *m = file->private_data;
883 struct acpi_battery *battery = m->private;
884
885 if (!battery || (count > sizeof(alarm_string) - 1))
886 return -EINVAL;
887 if (!acpi_battery_present(battery)) {
888 result = -ENODEV;
889 goto end;
890 }
891 if (copy_from_user(alarm_string, buffer, count)) {
892 result = -EFAULT;
893 goto end;
894 }
895 alarm_string[count] = '\0';
896 battery->alarm = simple_strtol(alarm_string, NULL, 0);
897 result = acpi_battery_set_alarm(battery);
898 end:
899 if (!result)
900 return count;
901 return result;
902}
903
904typedef int(*print_func)(struct seq_file *seq, int result);
905
906static print_func acpi_print_funcs[ACPI_BATTERY_NUMFILES] = {
907 acpi_battery_print_info,
908 acpi_battery_print_state,
909 acpi_battery_print_alarm,
910};
911
912static int acpi_battery_read(int fid, struct seq_file *seq)
913{
914 struct acpi_battery *battery = seq->private;
915 int result = acpi_battery_update(battery);
916 return acpi_print_funcs[fid](seq, result);
917}
918
919#define DECLARE_FILE_FUNCTIONS(_name) \
920static int acpi_battery_read_##_name(struct seq_file *seq, void *offset) \
921{ \
922 return acpi_battery_read(_name##_tag, seq); \
923} \
924static int acpi_battery_##_name##_open_fs(struct inode *inode, struct file *file) \
925{ \
926 return single_open(file, acpi_battery_read_##_name, PDE_DATA(inode)); \
927}
928
929DECLARE_FILE_FUNCTIONS(info);
930DECLARE_FILE_FUNCTIONS(state);
931DECLARE_FILE_FUNCTIONS(alarm);
932
933#undef DECLARE_FILE_FUNCTIONS
934
935#define FILE_DESCRIPTION_RO(_name) \
936 { \
937 .name = __stringify(_name), \
938 .mode = S_IRUGO, \
939 .ops = { \
940 .open = acpi_battery_##_name##_open_fs, \
941 .read = seq_read, \
942 .llseek = seq_lseek, \
943 .release = single_release, \
944 .owner = THIS_MODULE, \
945 }, \
946 }
947
948#define FILE_DESCRIPTION_RW(_name) \
949 { \
950 .name = __stringify(_name), \
951 .mode = S_IFREG | S_IRUGO | S_IWUSR, \
952 .ops = { \
953 .open = acpi_battery_##_name##_open_fs, \
954 .read = seq_read, \
955 .llseek = seq_lseek, \
956 .write = acpi_battery_write_##_name, \
957 .release = single_release, \
958 .owner = THIS_MODULE, \
959 }, \
960 }
961
962static const struct battery_file {
963 struct file_operations ops;
964 umode_t mode;
965 const char *name;
966} acpi_battery_file[] = {
967 FILE_DESCRIPTION_RO(info),
968 FILE_DESCRIPTION_RO(state),
969 FILE_DESCRIPTION_RW(alarm),
970};
971
972#undef FILE_DESCRIPTION_RO
973#undef FILE_DESCRIPTION_RW
974
975static int acpi_battery_add_fs(struct acpi_device *device)
976{
977 struct proc_dir_entry *entry = NULL;
978 int i;
979
980 printk(KERN_WARNING PREFIX "Deprecated procfs I/F for battery is loaded,"
981 " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
982 if (!acpi_device_dir(device)) {
983 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
984 acpi_battery_dir);
985 if (!acpi_device_dir(device))
986 return -ENODEV;
987 }
988
989 for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) {
990 entry = proc_create_data(acpi_battery_file[i].name,
991 acpi_battery_file[i].mode,
992 acpi_device_dir(device),
993 &acpi_battery_file[i].ops,
994 acpi_driver_data(device));
995 if (!entry)
996 return -ENODEV;
997 }
998 return 0;
999}
1000
1001static void acpi_battery_remove_fs(struct acpi_device *device)
1002{
1003 int i;
1004 if (!acpi_device_dir(device))
1005 return;
1006 for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i)
1007 remove_proc_entry(acpi_battery_file[i].name,
1008 acpi_device_dir(device));
1009
1010 remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
1011 acpi_device_dir(device) = NULL;
1012}
1013
1014#endif
1015
1016/* --------------------------------------------------------------------------
1017 Driver Interface 717 Driver Interface
1018 -------------------------------------------------------------------------- */ 718 -------------------------------------------------------------------------- */
1019 719
@@ -1075,15 +775,6 @@ static int acpi_battery_add(struct acpi_device *device)
1075 result = acpi_battery_update(battery); 775 result = acpi_battery_update(battery);
1076 if (result) 776 if (result)
1077 goto fail; 777 goto fail;
1078#ifdef CONFIG_ACPI_PROCFS_POWER
1079 result = acpi_battery_add_fs(device);
1080#endif
1081 if (result) {
1082#ifdef CONFIG_ACPI_PROCFS_POWER
1083 acpi_battery_remove_fs(device);
1084#endif
1085 goto fail;
1086 }
1087 778
1088 printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n", 779 printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
1089 ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), 780 ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
@@ -1110,9 +801,6 @@ static int acpi_battery_remove(struct acpi_device *device)
1110 return -EINVAL; 801 return -EINVAL;
1111 battery = acpi_driver_data(device); 802 battery = acpi_driver_data(device);
1112 unregister_pm_notifier(&battery->pm_nb); 803 unregister_pm_notifier(&battery->pm_nb);
1113#ifdef CONFIG_ACPI_PROCFS_POWER
1114 acpi_battery_remove_fs(device);
1115#endif
1116 sysfs_remove_battery(battery); 804 sysfs_remove_battery(battery);
1117 mutex_destroy(&battery->lock); 805 mutex_destroy(&battery->lock);
1118 mutex_destroy(&battery->sysfs_lock); 806 mutex_destroy(&battery->sysfs_lock);
@@ -1158,18 +846,7 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
1158{ 846{
1159 if (acpi_disabled) 847 if (acpi_disabled)
1160 return; 848 return;
1161#ifdef CONFIG_ACPI_PROCFS_POWER 849 acpi_bus_register_driver(&acpi_battery_driver);
1162 acpi_battery_dir = acpi_lock_battery_dir();
1163 if (!acpi_battery_dir)
1164 return;
1165#endif
1166 if (acpi_bus_register_driver(&acpi_battery_driver) < 0) {
1167#ifdef CONFIG_ACPI_PROCFS_POWER
1168 acpi_unlock_battery_dir(acpi_battery_dir);
1169#endif
1170 return;
1171 }
1172 return;
1173} 850}
1174 851
1175static int __init acpi_battery_init(void) 852static int __init acpi_battery_init(void)
@@ -1181,9 +858,6 @@ static int __init acpi_battery_init(void)
1181static void __exit acpi_battery_exit(void) 858static void __exit acpi_battery_exit(void)
1182{ 859{
1183 acpi_bus_unregister_driver(&acpi_battery_driver); 860 acpi_bus_unregister_driver(&acpi_battery_driver);
1184#ifdef CONFIG_ACPI_PROCFS_POWER
1185 acpi_unlock_battery_dir(acpi_battery_dir);
1186#endif
1187} 861}
1188 862
1189module_init(acpi_battery_init); 863module_init(acpi_battery_init);
diff --git a/drivers/acpi/cm_sbs.c b/drivers/acpi/cm_sbs.c
deleted file mode 100644
index 6c9ee68e46fb..000000000000
--- a/drivers/acpi/cm_sbs.c
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 *
18 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 */
20
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/init.h>
24#include <linux/acpi.h>
25#include <linux/types.h>
26#include <linux/proc_fs.h>
27#include <linux/seq_file.h>
28#include <acpi/acpi_bus.h>
29#include <acpi/acpi_drivers.h>
30
31#define PREFIX "ACPI: "
32
33ACPI_MODULE_NAME("cm_sbs");
34#define ACPI_AC_CLASS "ac_adapter"
35#define ACPI_BATTERY_CLASS "battery"
36#define _COMPONENT ACPI_SBS_COMPONENT
37static struct proc_dir_entry *acpi_ac_dir;
38static struct proc_dir_entry *acpi_battery_dir;
39
40static DEFINE_MUTEX(cm_sbs_mutex);
41
42static int lock_ac_dir_cnt;
43static int lock_battery_dir_cnt;
44
45struct proc_dir_entry *acpi_lock_ac_dir(void)
46{
47 mutex_lock(&cm_sbs_mutex);
48 if (!acpi_ac_dir)
49 acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
50 if (acpi_ac_dir) {
51 lock_ac_dir_cnt++;
52 } else {
53 printk(KERN_ERR PREFIX
54 "Cannot create %s\n", ACPI_AC_CLASS);
55 }
56 mutex_unlock(&cm_sbs_mutex);
57 return acpi_ac_dir;
58}
59EXPORT_SYMBOL(acpi_lock_ac_dir);
60
61void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir_param)
62{
63 mutex_lock(&cm_sbs_mutex);
64 if (acpi_ac_dir_param)
65 lock_ac_dir_cnt--;
66 if (lock_ac_dir_cnt == 0 && acpi_ac_dir_param && acpi_ac_dir) {
67 remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
68 acpi_ac_dir = NULL;
69 }
70 mutex_unlock(&cm_sbs_mutex);
71}
72EXPORT_SYMBOL(acpi_unlock_ac_dir);
73
74struct proc_dir_entry *acpi_lock_battery_dir(void)
75{
76 mutex_lock(&cm_sbs_mutex);
77 if (!acpi_battery_dir) {
78 acpi_battery_dir =
79 proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
80 }
81 if (acpi_battery_dir) {
82 lock_battery_dir_cnt++;
83 } else {
84 printk(KERN_ERR PREFIX
85 "Cannot create %s\n", ACPI_BATTERY_CLASS);
86 }
87 mutex_unlock(&cm_sbs_mutex);
88 return acpi_battery_dir;
89}
90EXPORT_SYMBOL(acpi_lock_battery_dir);
91
92void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param)
93{
94 mutex_lock(&cm_sbs_mutex);
95 if (acpi_battery_dir_param)
96 lock_battery_dir_cnt--;
97 if (lock_battery_dir_cnt == 0 && acpi_battery_dir_param
98 && acpi_battery_dir) {
99 remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
100 acpi_battery_dir = NULL;
101 }
102 mutex_unlock(&cm_sbs_mutex);
103 return;
104}
105EXPORT_SYMBOL(acpi_unlock_battery_dir);
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 05ea4be01a83..ca86c1ce7c8a 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -441,7 +441,7 @@ static void handle_dock(struct dock_station *ds, int dock)
441 acpi_status status; 441 acpi_status status;
442 struct acpi_object_list arg_list; 442 struct acpi_object_list arg_list;
443 union acpi_object arg; 443 union acpi_object arg;
444 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 444 unsigned long long value;
445 445
446 acpi_handle_info(ds->handle, "%s\n", dock ? "docking" : "undocking"); 446 acpi_handle_info(ds->handle, "%s\n", dock ? "docking" : "undocking");
447 447
@@ -450,12 +450,10 @@ static void handle_dock(struct dock_station *ds, int dock)
450 arg_list.pointer = &arg; 450 arg_list.pointer = &arg;
451 arg.type = ACPI_TYPE_INTEGER; 451 arg.type = ACPI_TYPE_INTEGER;
452 arg.integer.value = dock; 452 arg.integer.value = dock;
453 status = acpi_evaluate_object(ds->handle, "_DCK", &arg_list, &buffer); 453 status = acpi_evaluate_integer(ds->handle, "_DCK", &arg_list, &value);
454 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) 454 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND)
455 acpi_handle_err(ds->handle, "Failed to execute _DCK (0x%x)\n", 455 acpi_handle_err(ds->handle, "Failed to execute _DCK (0x%x)\n",
456 status); 456 status);
457
458 kfree(buffer.pointer);
459} 457}
460 458
461static inline void dock(struct dock_station *ds) 459static inline void dock(struct dock_station *ds)
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index 41ade6570bc0..ba3da88cee45 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -168,7 +168,7 @@ static int acpi_fan_add(struct acpi_device *device)
168 acpi_device_name(device), acpi_device_bid(device), 168 acpi_device_name(device), acpi_device_bid(device),
169 !device->power.state ? "on" : "off"); 169 !device->power.state ? "on" : "off");
170 170
171 end: 171end:
172 return result; 172 return result;
173} 173}
174 174
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 2e82e5d76930..a2343a1d9e0b 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -73,7 +73,7 @@ int acpi_map_pxm_to_node(int pxm)
73{ 73{
74 int node = pxm_to_node_map[pxm]; 74 int node = pxm_to_node_map[pxm];
75 75
76 if (node < 0) { 76 if (node == NUMA_NO_NODE) {
77 if (nodes_weight(nodes_found_map) >= MAX_NUMNODES) 77 if (nodes_weight(nodes_found_map) >= MAX_NUMNODES)
78 return NUMA_NO_NODE; 78 return NUMA_NO_NODE;
79 node = first_unset_node(nodes_found_map); 79 node = first_unset_node(nodes_found_map);
@@ -334,7 +334,7 @@ int acpi_get_pxm(acpi_handle h)
334 334
335int acpi_get_node(acpi_handle *handle) 335int acpi_get_node(acpi_handle *handle)
336{ 336{
337 int pxm, node = -1; 337 int pxm, node = NUMA_NO_NODE;
338 338
339 pxm = acpi_get_pxm(handle); 339 pxm = acpi_get_pxm(handle);
340 if (pxm >= 0 && pxm < MAX_PXM_DOMAINS) 340 if (pxm >= 0 && pxm < MAX_PXM_DOMAINS)
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
index 04a13784dd20..6a5b152ad4d0 100644
--- a/drivers/acpi/proc.c
+++ b/drivers/acpi/proc.c
@@ -8,289 +8,17 @@
8#include <acpi/acpi_bus.h> 8#include <acpi/acpi_bus.h>
9#include <acpi/acpi_drivers.h> 9#include <acpi/acpi_drivers.h>
10 10
11#ifdef CONFIG_X86
12#include <linux/mc146818rtc.h>
13#endif
14
15#include "sleep.h" 11#include "sleep.h"
16 12
17#define _COMPONENT ACPI_SYSTEM_COMPONENT 13#define _COMPONENT ACPI_SYSTEM_COMPONENT
18 14
19/* 15/*
20 * this file provides support for: 16 * this file provides support for:
21 * /proc/acpi/alarm
22 * /proc/acpi/wakeup 17 * /proc/acpi/wakeup
23 */ 18 */
24 19
25ACPI_MODULE_NAME("sleep") 20ACPI_MODULE_NAME("sleep")
26 21
27#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || !defined(CONFIG_X86)
28/* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */
29#else
30#define HAVE_ACPI_LEGACY_ALARM
31#endif
32
33#ifdef HAVE_ACPI_LEGACY_ALARM
34
35static u32 cmos_bcd_read(int offset, int rtc_control);
36
37static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)
38{
39 u32 sec, min, hr;
40 u32 day, mo, yr, cent = 0;
41 u32 today = 0;
42 unsigned char rtc_control = 0;
43 unsigned long flags;
44
45 spin_lock_irqsave(&rtc_lock, flags);
46
47 rtc_control = CMOS_READ(RTC_CONTROL);
48 sec = cmos_bcd_read(RTC_SECONDS_ALARM, rtc_control);
49 min = cmos_bcd_read(RTC_MINUTES_ALARM, rtc_control);
50 hr = cmos_bcd_read(RTC_HOURS_ALARM, rtc_control);
51
52 /* If we ever get an FACP with proper values... */
53 if (acpi_gbl_FADT.day_alarm) {
54 /* ACPI spec: only low 6 its should be cared */
55 day = CMOS_READ(acpi_gbl_FADT.day_alarm) & 0x3F;
56 if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
57 day = bcd2bin(day);
58 } else
59 day = cmos_bcd_read(RTC_DAY_OF_MONTH, rtc_control);
60 if (acpi_gbl_FADT.month_alarm)
61 mo = cmos_bcd_read(acpi_gbl_FADT.month_alarm, rtc_control);
62 else {
63 mo = cmos_bcd_read(RTC_MONTH, rtc_control);
64 today = cmos_bcd_read(RTC_DAY_OF_MONTH, rtc_control);
65 }
66 if (acpi_gbl_FADT.century)
67 cent = cmos_bcd_read(acpi_gbl_FADT.century, rtc_control);
68
69 yr = cmos_bcd_read(RTC_YEAR, rtc_control);
70
71 spin_unlock_irqrestore(&rtc_lock, flags);
72
73 /* we're trusting the FADT (see above) */
74 if (!acpi_gbl_FADT.century)
75 /* If we're not trusting the FADT, we should at least make it
76 * right for _this_ century... ehm, what is _this_ century?
77 *
78 * TBD:
79 * ASAP: find piece of code in the kernel, e.g. star tracker driver,
80 * which we can trust to determine the century correctly. Atom
81 * watch driver would be nice, too...
82 *
83 * if that has not happened, change for first release in 2050:
84 * if (yr<50)
85 * yr += 2100;
86 * else
87 * yr += 2000; // current line of code
88 *
89 * if that has not happened either, please do on 2099/12/31:23:59:59
90 * s/2000/2100
91 *
92 */
93 yr += 2000;
94 else
95 yr += cent * 100;
96
97 /*
98 * Show correct dates for alarms up to a month into the future.
99 * This solves issues for nearly all situations with the common
100 * 30-day alarm clocks in PC hardware.
101 */
102 if (day < today) {
103 if (mo < 12) {
104 mo += 1;
105 } else {
106 mo = 1;
107 yr += 1;
108 }
109 }
110
111 seq_printf(seq, "%4.4u-", yr);
112 (mo > 12) ? seq_puts(seq, "**-") : seq_printf(seq, "%2.2u-", mo);
113 (day > 31) ? seq_puts(seq, "** ") : seq_printf(seq, "%2.2u ", day);
114 (hr > 23) ? seq_puts(seq, "**:") : seq_printf(seq, "%2.2u:", hr);
115 (min > 59) ? seq_puts(seq, "**:") : seq_printf(seq, "%2.2u:", min);
116 (sec > 59) ? seq_puts(seq, "**\n") : seq_printf(seq, "%2.2u\n", sec);
117
118 return 0;
119}
120
121static int acpi_system_alarm_open_fs(struct inode *inode, struct file *file)
122{
123 return single_open(file, acpi_system_alarm_seq_show, PDE_DATA(inode));
124}
125
126static int get_date_field(char **p, u32 * value)
127{
128 char *next = NULL;
129 char *string_end = NULL;
130 int result = -EINVAL;
131
132 /*
133 * Try to find delimeter, only to insert null. The end of the
134 * string won't have one, but is still valid.
135 */
136 if (*p == NULL)
137 return result;
138
139 next = strpbrk(*p, "- :");
140 if (next)
141 *next++ = '\0';
142
143 *value = simple_strtoul(*p, &string_end, 10);
144
145 /* Signal success if we got a good digit */
146 if (string_end != *p)
147 result = 0;
148
149 if (next)
150 *p = next;
151 else
152 *p = NULL;
153
154 return result;
155}
156
157/* Read a possibly BCD register, always return binary */
158static u32 cmos_bcd_read(int offset, int rtc_control)
159{
160 u32 val = CMOS_READ(offset);
161 if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
162 val = bcd2bin(val);
163 return val;
164}
165
166/* Write binary value into possibly BCD register */
167static void cmos_bcd_write(u32 val, int offset, int rtc_control)
168{
169 if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
170 val = bin2bcd(val);
171 CMOS_WRITE(val, offset);
172}
173
174static ssize_t
175acpi_system_write_alarm(struct file *file,
176 const char __user * buffer, size_t count, loff_t * ppos)
177{
178 int result = 0;
179 char alarm_string[30] = { '\0' };
180 char *p = alarm_string;
181 u32 sec, min, hr, day, mo, yr;
182 int adjust = 0;
183 unsigned char rtc_control = 0;
184
185 if (count > sizeof(alarm_string) - 1)
186 return -EINVAL;
187
188 if (copy_from_user(alarm_string, buffer, count))
189 return -EFAULT;
190
191 alarm_string[count] = '\0';
192
193 /* check for time adjustment */
194 if (alarm_string[0] == '+') {
195 p++;
196 adjust = 1;
197 }
198
199 if ((result = get_date_field(&p, &yr)))
200 goto end;
201 if ((result = get_date_field(&p, &mo)))
202 goto end;
203 if ((result = get_date_field(&p, &day)))
204 goto end;
205 if ((result = get_date_field(&p, &hr)))
206 goto end;
207 if ((result = get_date_field(&p, &min)))
208 goto end;
209 if ((result = get_date_field(&p, &sec)))
210 goto end;
211
212 spin_lock_irq(&rtc_lock);
213
214 rtc_control = CMOS_READ(RTC_CONTROL);
215
216 if (adjust) {
217 yr += cmos_bcd_read(RTC_YEAR, rtc_control);
218 mo += cmos_bcd_read(RTC_MONTH, rtc_control);
219 day += cmos_bcd_read(RTC_DAY_OF_MONTH, rtc_control);
220 hr += cmos_bcd_read(RTC_HOURS, rtc_control);
221 min += cmos_bcd_read(RTC_MINUTES, rtc_control);
222 sec += cmos_bcd_read(RTC_SECONDS, rtc_control);
223 }
224
225 spin_unlock_irq(&rtc_lock);
226
227 if (sec > 59) {
228 min += sec/60;
229 sec = sec%60;
230 }
231 if (min > 59) {
232 hr += min/60;
233 min = min%60;
234 }
235 if (hr > 23) {
236 day += hr/24;
237 hr = hr%24;
238 }
239 if (day > 31) {
240 mo += day/32;
241 day = day%32;
242 }
243 if (mo > 12) {
244 yr += mo/13;
245 mo = mo%13;
246 }
247
248 spin_lock_irq(&rtc_lock);
249 /*
250 * Disable alarm interrupt before setting alarm timer or else
251 * when ACPI_EVENT_RTC is enabled, a spurious ACPI interrupt occurs
252 */
253 rtc_control &= ~RTC_AIE;
254 CMOS_WRITE(rtc_control, RTC_CONTROL);
255 CMOS_READ(RTC_INTR_FLAGS);
256
257 /* write the fields the rtc knows about */
258 cmos_bcd_write(hr, RTC_HOURS_ALARM, rtc_control);
259 cmos_bcd_write(min, RTC_MINUTES_ALARM, rtc_control);
260 cmos_bcd_write(sec, RTC_SECONDS_ALARM, rtc_control);
261
262 /*
263 * If the system supports an enhanced alarm it will have non-zero
264 * offsets into the CMOS RAM here -- which for some reason are pointing
265 * to the RTC area of memory.
266 */
267 if (acpi_gbl_FADT.day_alarm)
268 cmos_bcd_write(day, acpi_gbl_FADT.day_alarm, rtc_control);
269 if (acpi_gbl_FADT.month_alarm)
270 cmos_bcd_write(mo, acpi_gbl_FADT.month_alarm, rtc_control);
271 if (acpi_gbl_FADT.century) {
272 if (adjust)
273 yr += cmos_bcd_read(acpi_gbl_FADT.century, rtc_control) * 100;
274 cmos_bcd_write(yr / 100, acpi_gbl_FADT.century, rtc_control);
275 }
276 /* enable the rtc alarm interrupt */
277 rtc_control |= RTC_AIE;
278 CMOS_WRITE(rtc_control, RTC_CONTROL);
279 CMOS_READ(RTC_INTR_FLAGS);
280
281 spin_unlock_irq(&rtc_lock);
282
283 acpi_clear_event(ACPI_EVENT_RTC);
284 acpi_enable_event(ACPI_EVENT_RTC, 0);
285
286 *ppos += count;
287
288 result = 0;
289 end:
290 return result ? result : count;
291}
292#endif /* HAVE_ACPI_LEGACY_ALARM */
293
294static int 22static int
295acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) 23acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
296{ 24{
@@ -417,41 +145,8 @@ static const struct file_operations acpi_system_wakeup_device_fops = {
417 .release = single_release, 145 .release = single_release,
418}; 146};
419 147
420#ifdef HAVE_ACPI_LEGACY_ALARM
421static const struct file_operations acpi_system_alarm_fops = {
422 .owner = THIS_MODULE,
423 .open = acpi_system_alarm_open_fs,
424 .read = seq_read,
425 .write = acpi_system_write_alarm,
426 .llseek = seq_lseek,
427 .release = single_release,
428};
429
430static u32 rtc_handler(void *context)
431{
432 acpi_clear_event(ACPI_EVENT_RTC);
433 acpi_disable_event(ACPI_EVENT_RTC, 0);
434
435 return ACPI_INTERRUPT_HANDLED;
436}
437#endif /* HAVE_ACPI_LEGACY_ALARM */
438
439int __init acpi_sleep_proc_init(void) 148int __init acpi_sleep_proc_init(void)
440{ 149{
441#ifdef HAVE_ACPI_LEGACY_ALARM
442 /* 'alarm' [R/W] */
443 proc_create("alarm", S_IFREG | S_IRUGO | S_IWUSR,
444 acpi_root_dir, &acpi_system_alarm_fops);
445
446 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL);
447 /*
448 * Disable the RTC event after installing RTC handler.
449 * Only when RTC alarm is set will it be enabled.
450 */
451 acpi_clear_event(ACPI_EVENT_RTC);
452 acpi_disable_event(ACPI_EVENT_RTC, 0);
453#endif /* HAVE_ACPI_LEGACY_ALARM */
454
455 /* 'wakeup device' [R/W] */ 150 /* 'wakeup device' [R/W] */
456 proc_create("wakeup", S_IFREG | S_IRUGO | S_IWUSR, 151 proc_create("wakeup", S_IFREG | S_IRUGO | S_IWUSR,
457 acpi_root_dir, &acpi_system_wakeup_device_fops); 152 acpi_root_dir, &acpi_system_wakeup_device_fops);
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index f98dd00b51a9..35c8f2bbcc40 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -272,9 +272,6 @@ static void tsc_check_state(int state) { return; }
272static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) 272static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
273{ 273{
274 274
275 if (!pr)
276 return -EINVAL;
277
278 if (!pr->pblk) 275 if (!pr->pblk)
279 return -ENODEV; 276 return -ENODEV;
280 277
@@ -1076,12 +1073,8 @@ int acpi_processor_hotplug(struct acpi_processor *pr)
1076 if (disabled_by_idle_boot_param()) 1073 if (disabled_by_idle_boot_param())
1077 return 0; 1074 return 0;
1078 1075
1079 if (!pr) 1076 if (nocst)
1080 return -EINVAL;
1081
1082 if (nocst) {
1083 return -ENODEV; 1077 return -ENODEV;
1084 }
1085 1078
1086 if (!pr->flags.power_setup_done) 1079 if (!pr->flags.power_setup_done)
1087 return -ENODEV; 1080 return -ENODEV;
@@ -1108,9 +1101,6 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1108 if (disabled_by_idle_boot_param()) 1101 if (disabled_by_idle_boot_param())
1109 return 0; 1102 return 0;
1110 1103
1111 if (!pr)
1112 return -EINVAL;
1113
1114 if (nocst) 1104 if (nocst)
1115 return -ENODEV; 1105 return -ENODEV;
1116 1106
@@ -1183,9 +1173,6 @@ int acpi_processor_power_init(struct acpi_processor *pr)
1183 first_run++; 1173 first_run++;
1184 } 1174 }
1185 1175
1186 if (!pr)
1187 return -EINVAL;
1188
1189 if (acpi_gbl_FADT.cst_control && !nocst) { 1176 if (acpi_gbl_FADT.cst_control && !nocst) {
1190 status = 1177 status =
1191 acpi_os_write_port(acpi_gbl_FADT.smi_command, acpi_gbl_FADT.cst_control, 8); 1178 acpi_os_write_port(acpi_gbl_FADT.smi_command, acpi_gbl_FADT.cst_control, 8);
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index aef7e1cd1e5d..d465ae6cdd00 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -30,12 +30,6 @@
30#include <linux/moduleparam.h> 30#include <linux/moduleparam.h>
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32 32
33#ifdef CONFIG_ACPI_PROCFS_POWER
34#include <linux/proc_fs.h>
35#include <linux/seq_file.h>
36#include <asm/uaccess.h>
37#endif
38
39#include <linux/acpi.h> 33#include <linux/acpi.h>
40#include <linux/timer.h> 34#include <linux/timer.h>
41#include <linux/jiffies.h> 35#include <linux/jiffies.h>
@@ -67,11 +61,6 @@ static unsigned int cache_time = 1000;
67module_param(cache_time, uint, 0644); 61module_param(cache_time, uint, 0644);
68MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); 62MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
69 63
70extern struct proc_dir_entry *acpi_lock_ac_dir(void);
71extern struct proc_dir_entry *acpi_lock_battery_dir(void);
72extern void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
73extern void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
74
75#define MAX_SBS_BAT 4 64#define MAX_SBS_BAT 4
76#define ACPI_SBS_BLOCK_MAX 32 65#define ACPI_SBS_BLOCK_MAX 32
77 66
@@ -84,9 +73,6 @@ MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
84struct acpi_battery { 73struct acpi_battery {
85 struct power_supply bat; 74 struct power_supply bat;
86 struct acpi_sbs *sbs; 75 struct acpi_sbs *sbs;
87#ifdef CONFIG_ACPI_PROCFS_POWER
88 struct proc_dir_entry *proc_entry;
89#endif
90 unsigned long update_time; 76 unsigned long update_time;
91 char name[8]; 77 char name[8];
92 char manufacturer_name[ACPI_SBS_BLOCK_MAX]; 78 char manufacturer_name[ACPI_SBS_BLOCK_MAX];
@@ -119,9 +105,6 @@ struct acpi_sbs {
119 struct acpi_device *device; 105 struct acpi_device *device;
120 struct acpi_smb_hc *hc; 106 struct acpi_smb_hc *hc;
121 struct mutex lock; 107 struct mutex lock;
122#ifdef CONFIG_ACPI_PROCFS_POWER
123 struct proc_dir_entry *charger_entry;
124#endif
125 struct acpi_battery battery[MAX_SBS_BAT]; 108 struct acpi_battery battery[MAX_SBS_BAT];
126 u8 batteries_supported:4; 109 u8 batteries_supported:4;
127 u8 manager_present:1; 110 u8 manager_present:1;
@@ -482,261 +465,6 @@ static struct device_attribute alarm_attr = {
482}; 465};
483 466
484/* -------------------------------------------------------------------------- 467/* --------------------------------------------------------------------------
485 FS Interface (/proc/acpi)
486 -------------------------------------------------------------------------- */
487
488#ifdef CONFIG_ACPI_PROCFS_POWER
489/* Generic Routines */
490static int
491acpi_sbs_add_fs(struct proc_dir_entry **dir,
492 struct proc_dir_entry *parent_dir,
493 char *dir_name,
494 const struct file_operations *info_fops,
495 const struct file_operations *state_fops,
496 const struct file_operations *alarm_fops, void *data)
497{
498 printk(KERN_WARNING PREFIX "Deprecated procfs I/F for SBS is loaded,"
499 " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
500 if (!*dir) {
501 *dir = proc_mkdir(dir_name, parent_dir);
502 if (!*dir) {
503 return -ENODEV;
504 }
505 }
506
507 /* 'info' [R] */
508 if (info_fops)
509 proc_create_data(ACPI_SBS_FILE_INFO, S_IRUGO, *dir,
510 info_fops, data);
511
512 /* 'state' [R] */
513 if (state_fops)
514 proc_create_data(ACPI_SBS_FILE_STATE, S_IRUGO, *dir,
515 state_fops, data);
516
517 /* 'alarm' [R/W] */
518 if (alarm_fops)
519 proc_create_data(ACPI_SBS_FILE_ALARM, S_IRUGO, *dir,
520 alarm_fops, data);
521 return 0;
522}
523
524/* Smart Battery Interface */
525static struct proc_dir_entry *acpi_battery_dir = NULL;
526
527static inline char *acpi_battery_units(struct acpi_battery *battery)
528{
529 return acpi_battery_mode(battery) ? " mW" : " mA";
530}
531
532
533static int acpi_battery_read_info(struct seq_file *seq, void *offset)
534{
535 struct acpi_battery *battery = seq->private;
536 struct acpi_sbs *sbs = battery->sbs;
537 int result = 0;
538
539 mutex_lock(&sbs->lock);
540
541 seq_printf(seq, "present: %s\n",
542 (battery->present) ? "yes" : "no");
543 if (!battery->present)
544 goto end;
545
546 seq_printf(seq, "design capacity: %i%sh\n",
547 battery->design_capacity * acpi_battery_scale(battery),
548 acpi_battery_units(battery));
549 seq_printf(seq, "last full capacity: %i%sh\n",
550 battery->full_charge_capacity * acpi_battery_scale(battery),
551 acpi_battery_units(battery));
552 seq_printf(seq, "battery technology: rechargeable\n");
553 seq_printf(seq, "design voltage: %i mV\n",
554 battery->design_voltage * acpi_battery_vscale(battery));
555 seq_printf(seq, "design capacity warning: unknown\n");
556 seq_printf(seq, "design capacity low: unknown\n");
557 seq_printf(seq, "cycle count: %i\n", battery->cycle_count);
558 seq_printf(seq, "capacity granularity 1: unknown\n");
559 seq_printf(seq, "capacity granularity 2: unknown\n");
560 seq_printf(seq, "model number: %s\n", battery->device_name);
561 seq_printf(seq, "serial number: %i\n",
562 battery->serial_number);
563 seq_printf(seq, "battery type: %s\n",
564 battery->device_chemistry);
565 seq_printf(seq, "OEM info: %s\n",
566 battery->manufacturer_name);
567 end:
568 mutex_unlock(&sbs->lock);
569 return result;
570}
571
572static int acpi_battery_info_open_fs(struct inode *inode, struct file *file)
573{
574 return single_open(file, acpi_battery_read_info, PDE_DATA(inode));
575}
576
577static int acpi_battery_read_state(struct seq_file *seq, void *offset)
578{
579 struct acpi_battery *battery = seq->private;
580 struct acpi_sbs *sbs = battery->sbs;
581 int rate;
582
583 mutex_lock(&sbs->lock);
584 seq_printf(seq, "present: %s\n",
585 (battery->present) ? "yes" : "no");
586 if (!battery->present)
587 goto end;
588
589 acpi_battery_get_state(battery);
590 seq_printf(seq, "capacity state: %s\n",
591 (battery->state & 0x0010) ? "critical" : "ok");
592 seq_printf(seq, "charging state: %s\n",
593 (battery->rate_now < 0) ? "discharging" :
594 ((battery->rate_now > 0) ? "charging" : "charged"));
595 rate = abs(battery->rate_now) * acpi_battery_ipscale(battery);
596 rate *= (acpi_battery_mode(battery))?(battery->voltage_now *
597 acpi_battery_vscale(battery)/1000):1;
598 seq_printf(seq, "present rate: %d%s\n", rate,
599 acpi_battery_units(battery));
600 seq_printf(seq, "remaining capacity: %i%sh\n",
601 battery->capacity_now * acpi_battery_scale(battery),
602 acpi_battery_units(battery));
603 seq_printf(seq, "present voltage: %i mV\n",
604 battery->voltage_now * acpi_battery_vscale(battery));
605
606 end:
607 mutex_unlock(&sbs->lock);
608 return 0;
609}
610
611static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
612{
613 return single_open(file, acpi_battery_read_state, PDE_DATA(inode));
614}
615
616static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
617{
618 struct acpi_battery *battery = seq->private;
619 struct acpi_sbs *sbs = battery->sbs;
620 int result = 0;
621
622 mutex_lock(&sbs->lock);
623
624 if (!battery->present) {
625 seq_printf(seq, "present: no\n");
626 goto end;
627 }
628
629 acpi_battery_get_alarm(battery);
630 seq_printf(seq, "alarm: ");
631 if (battery->alarm_capacity)
632 seq_printf(seq, "%i%sh\n",
633 battery->alarm_capacity *
634 acpi_battery_scale(battery),
635 acpi_battery_units(battery));
636 else
637 seq_printf(seq, "disabled\n");
638 end:
639 mutex_unlock(&sbs->lock);
640 return result;
641}
642
643static ssize_t
644acpi_battery_write_alarm(struct file *file, const char __user * buffer,
645 size_t count, loff_t * ppos)
646{
647 struct seq_file *seq = file->private_data;
648 struct acpi_battery *battery = seq->private;
649 struct acpi_sbs *sbs = battery->sbs;
650 char alarm_string[12] = { '\0' };
651 int result = 0;
652 mutex_lock(&sbs->lock);
653 if (!battery->present) {
654 result = -ENODEV;
655 goto end;
656 }
657 if (count > sizeof(alarm_string) - 1) {
658 result = -EINVAL;
659 goto end;
660 }
661 if (copy_from_user(alarm_string, buffer, count)) {
662 result = -EFAULT;
663 goto end;
664 }
665 alarm_string[count] = 0;
666 battery->alarm_capacity = simple_strtoul(alarm_string, NULL, 0) /
667 acpi_battery_scale(battery);
668 acpi_battery_set_alarm(battery);
669 end:
670 mutex_unlock(&sbs->lock);
671 if (result)
672 return result;
673 return count;
674}
675
676static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file)
677{
678 return single_open(file, acpi_battery_read_alarm, PDE_DATA(inode));
679}
680
681static const struct file_operations acpi_battery_info_fops = {
682 .open = acpi_battery_info_open_fs,
683 .read = seq_read,
684 .llseek = seq_lseek,
685 .release = single_release,
686 .owner = THIS_MODULE,
687};
688
689static const struct file_operations acpi_battery_state_fops = {
690 .open = acpi_battery_state_open_fs,
691 .read = seq_read,
692 .llseek = seq_lseek,
693 .release = single_release,
694 .owner = THIS_MODULE,
695};
696
697static const struct file_operations acpi_battery_alarm_fops = {
698 .open = acpi_battery_alarm_open_fs,
699 .read = seq_read,
700 .write = acpi_battery_write_alarm,
701 .llseek = seq_lseek,
702 .release = single_release,
703 .owner = THIS_MODULE,
704};
705
706/* Legacy AC Adapter Interface */
707
708static struct proc_dir_entry *acpi_ac_dir = NULL;
709
710static int acpi_ac_read_state(struct seq_file *seq, void *offset)
711{
712
713 struct acpi_sbs *sbs = seq->private;
714
715 mutex_lock(&sbs->lock);
716
717 seq_printf(seq, "state: %s\n",
718 sbs->charger_present ? "on-line" : "off-line");
719
720 mutex_unlock(&sbs->lock);
721 return 0;
722}
723
724static int acpi_ac_state_open_fs(struct inode *inode, struct file *file)
725{
726 return single_open(file, acpi_ac_read_state, PDE_DATA(inode));
727}
728
729static const struct file_operations acpi_ac_state_fops = {
730 .open = acpi_ac_state_open_fs,
731 .read = seq_read,
732 .llseek = seq_lseek,
733 .release = single_release,
734 .owner = THIS_MODULE,
735};
736
737#endif
738
739/* --------------------------------------------------------------------------
740 Driver Interface 468 Driver Interface
741 -------------------------------------------------------------------------- */ 469 -------------------------------------------------------------------------- */
742static int acpi_battery_read(struct acpi_battery *battery) 470static int acpi_battery_read(struct acpi_battery *battery)
@@ -781,12 +509,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
781 return result; 509 return result;
782 510
783 sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id); 511 sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id);
784#ifdef CONFIG_ACPI_PROCFS_POWER
785 acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir,
786 battery->name, &acpi_battery_info_fops,
787 &acpi_battery_state_fops, &acpi_battery_alarm_fops,
788 battery);
789#endif
790 battery->bat.name = battery->name; 512 battery->bat.name = battery->name;
791 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; 513 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
792 if (!acpi_battery_mode(battery)) { 514 if (!acpi_battery_mode(battery)) {
@@ -822,10 +544,6 @@ static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
822 device_remove_file(battery->bat.dev, &alarm_attr); 544 device_remove_file(battery->bat.dev, &alarm_attr);
823 power_supply_unregister(&battery->bat); 545 power_supply_unregister(&battery->bat);
824 } 546 }
825#ifdef CONFIG_ACPI_PROCFS_POWER
826 proc_remove(battery->proc_entry);
827 battery->proc_entry = NULL;
828#endif
829} 547}
830 548
831static int acpi_charger_add(struct acpi_sbs *sbs) 549static int acpi_charger_add(struct acpi_sbs *sbs)
@@ -835,13 +553,7 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
835 result = acpi_ac_get_present(sbs); 553 result = acpi_ac_get_present(sbs);
836 if (result) 554 if (result)
837 goto end; 555 goto end;
838#ifdef CONFIG_ACPI_PROCFS_POWER 556
839 result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir,
840 ACPI_AC_DIR_NAME, NULL,
841 &acpi_ac_state_fops, NULL, sbs);
842 if (result)
843 goto end;
844#endif
845 sbs->charger.name = "sbs-charger"; 557 sbs->charger.name = "sbs-charger";
846 sbs->charger.type = POWER_SUPPLY_TYPE_MAINS; 558 sbs->charger.type = POWER_SUPPLY_TYPE_MAINS;
847 sbs->charger.properties = sbs_ac_props; 559 sbs->charger.properties = sbs_ac_props;
@@ -859,10 +571,6 @@ static void acpi_charger_remove(struct acpi_sbs *sbs)
859{ 571{
860 if (sbs->charger.dev) 572 if (sbs->charger.dev)
861 power_supply_unregister(&sbs->charger); 573 power_supply_unregister(&sbs->charger);
862#ifdef CONFIG_ACPI_PROCFS_POWER
863 proc_remove(sbs->charger_entry);
864 sbs->charger_entry = NULL;
865#endif
866} 574}
867 575
868static void acpi_sbs_callback(void *context) 576static void acpi_sbs_callback(void *context)
@@ -950,20 +658,6 @@ static int acpi_sbs_remove(struct acpi_device *device)
950 return 0; 658 return 0;
951} 659}
952 660
953static void acpi_sbs_rmdirs(void)
954{
955#ifdef CONFIG_ACPI_PROCFS_POWER
956 if (acpi_ac_dir) {
957 acpi_unlock_ac_dir(acpi_ac_dir);
958 acpi_ac_dir = NULL;
959 }
960 if (acpi_battery_dir) {
961 acpi_unlock_battery_dir(acpi_battery_dir);
962 acpi_battery_dir = NULL;
963 }
964#endif
965}
966
967#ifdef CONFIG_PM_SLEEP 661#ifdef CONFIG_PM_SLEEP
968static int acpi_sbs_resume(struct device *dev) 662static int acpi_sbs_resume(struct device *dev)
969{ 663{
@@ -995,28 +689,17 @@ static int __init acpi_sbs_init(void)
995 689
996 if (acpi_disabled) 690 if (acpi_disabled)
997 return -ENODEV; 691 return -ENODEV;
998#ifdef CONFIG_ACPI_PROCFS_POWER 692
999 acpi_ac_dir = acpi_lock_ac_dir();
1000 if (!acpi_ac_dir)
1001 return -ENODEV;
1002 acpi_battery_dir = acpi_lock_battery_dir();
1003 if (!acpi_battery_dir) {
1004 acpi_sbs_rmdirs();
1005 return -ENODEV;
1006 }
1007#endif
1008 result = acpi_bus_register_driver(&acpi_sbs_driver); 693 result = acpi_bus_register_driver(&acpi_sbs_driver);
1009 if (result < 0) { 694 if (result < 0)
1010 acpi_sbs_rmdirs();
1011 return -ENODEV; 695 return -ENODEV;
1012 } 696
1013 return 0; 697 return 0;
1014} 698}
1015 699
1016static void __exit acpi_sbs_exit(void) 700static void __exit acpi_sbs_exit(void)
1017{ 701{
1018 acpi_bus_unregister_driver(&acpi_sbs_driver); 702 acpi_bus_unregister_driver(&acpi_sbs_driver);
1019 acpi_sbs_rmdirs();
1020 return; 703 return;
1021} 704}
1022 705
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
index d81c4e5ea0ad..70438de5c0e4 100644
--- a/drivers/cpufreq/pcc-cpufreq.c
+++ b/drivers/cpufreq/pcc-cpufreq.c
@@ -396,15 +396,14 @@ static int __init pcc_cpufreq_probe(void)
396 struct pcc_memory_resource *mem_resource; 396 struct pcc_memory_resource *mem_resource;
397 struct pcc_register_resource *reg_resource; 397 struct pcc_register_resource *reg_resource;
398 union acpi_object *out_obj, *member; 398 union acpi_object *out_obj, *member;
399 acpi_handle handle, osc_handle, pcch_handle; 399 acpi_handle handle, osc_handle;
400 int ret = 0; 400 int ret = 0;
401 401
402 status = acpi_get_handle(NULL, "\\_SB", &handle); 402 status = acpi_get_handle(NULL, "\\_SB", &handle);
403 if (ACPI_FAILURE(status)) 403 if (ACPI_FAILURE(status))
404 return -ENODEV; 404 return -ENODEV;
405 405
406 status = acpi_get_handle(handle, "PCCH", &pcch_handle); 406 if (!acpi_has_method(handle, "PCCH"))
407 if (ACPI_FAILURE(status))
408 return -ENODEV; 407 return -ENODEV;
409 408
410 status = acpi_get_handle(handle, "_OSC", &osc_handle); 409 status = acpi_get_handle(handle, "_OSC", &osc_handle);
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 5c1ef2b3ef18..f2beb728ed8f 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -73,15 +73,8 @@ static irqreturn_t acpi_gpio_irq_handler(int irq, void *data)
73static irqreturn_t acpi_gpio_irq_handler_evt(int irq, void *data) 73static irqreturn_t acpi_gpio_irq_handler_evt(int irq, void *data)
74{ 74{
75 struct acpi_gpio_evt_pin *evt_pin = data; 75 struct acpi_gpio_evt_pin *evt_pin = data;
76 struct acpi_object_list args;
77 union acpi_object arg;
78 76
79 arg.type = ACPI_TYPE_INTEGER; 77 acpi_execute_simple_method(evt_pin->evt_handle, NULL, evt_pin->pin);
80 arg.integer.value = evt_pin->pin;
81 args.count = 1;
82 args.pointer = &arg;
83
84 acpi_evaluate_object(evt_pin->evt_handle, NULL, &args, NULL);
85 78
86 return IRQ_HANDLED; 79 return IRQ_HANDLED;
87} 80}
diff --git a/drivers/gpu/drm/i915/intel_acpi.c b/drivers/gpu/drm/i915/intel_acpi.c
index 57fe1ae32a0d..43959edd4291 100644
--- a/drivers/gpu/drm/i915/intel_acpi.c
+++ b/drivers/gpu/drm/i915/intel_acpi.c
@@ -193,16 +193,14 @@ out:
193 193
194static bool intel_dsm_pci_probe(struct pci_dev *pdev) 194static bool intel_dsm_pci_probe(struct pci_dev *pdev)
195{ 195{
196 acpi_handle dhandle, intel_handle; 196 acpi_handle dhandle;
197 acpi_status status;
198 int ret; 197 int ret;
199 198
200 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); 199 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);
201 if (!dhandle) 200 if (!dhandle)
202 return false; 201 return false;
203 202
204 status = acpi_get_handle(dhandle, "_DSM", &intel_handle); 203 if (!acpi_has_method(dhandle, "_DSM")) {
205 if (ACPI_FAILURE(status)) {
206 DRM_DEBUG_KMS("no _DSM method for intel device\n"); 204 DRM_DEBUG_KMS("no _DSM method for intel device\n");
207 return false; 205 return false;
208 } 206 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index dd7d2e182719..cfbeee607b3a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -253,18 +253,15 @@ static struct vga_switcheroo_handler nouveau_dsm_handler = {
253 253
254static int nouveau_dsm_pci_probe(struct pci_dev *pdev) 254static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
255{ 255{
256 acpi_handle dhandle, nvidia_handle; 256 acpi_handle dhandle;
257 acpi_status status;
258 int retval = 0; 257 int retval = 0;
259 258
260 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); 259 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);
261 if (!dhandle) 260 if (!dhandle)
262 return false; 261 return false;
263 262
264 status = acpi_get_handle(dhandle, "_DSM", &nvidia_handle); 263 if (!acpi_has_method(dhandle, "_DSM"))
265 if (ACPI_FAILURE(status)) {
266 return false; 264 return false;
267 }
268 265
269 if (nouveau_test_dsm(dhandle, nouveau_dsm, NOUVEAU_DSM_POWER)) 266 if (nouveau_test_dsm(dhandle, nouveau_dsm, NOUVEAU_DSM_POWER))
270 retval |= NOUVEAU_DSM_HAS_MUX; 267 retval |= NOUVEAU_DSM_HAS_MUX;
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index c1336193b04b..fd7ce374f812 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -854,10 +854,10 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
854 0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45, 854 0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45,
855 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE, 855 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE,
856 }; 856 };
857 struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL }; 857 union acpi_object params[4];
858 union acpi_object params[4], *obj;
859 struct acpi_object_list input; 858 struct acpi_object_list input;
860 struct acpi_device *adev; 859 struct acpi_device *adev;
860 unsigned long long value;
861 acpi_handle handle; 861 acpi_handle handle;
862 862
863 handle = ACPI_HANDLE(&client->dev); 863 handle = ACPI_HANDLE(&client->dev);
@@ -878,22 +878,14 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
878 params[3].package.count = 0; 878 params[3].package.count = 0;
879 params[3].package.elements = NULL; 879 params[3].package.elements = NULL;
880 880
881 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DSM", &input, &buf))) { 881 if (ACPI_FAILURE(acpi_evaluate_integer(handle, "_DSM", &input,
882 &value))) {
882 dev_err(&client->dev, "device _DSM execution failed\n"); 883 dev_err(&client->dev, "device _DSM execution failed\n");
883 return -ENODEV; 884 return -ENODEV;
884 } 885 }
885 886
886 obj = (union acpi_object *)buf.pointer; 887 pdata->hid_descriptor_address = value;
887 if (obj->type != ACPI_TYPE_INTEGER) {
888 dev_err(&client->dev, "device _DSM returned invalid type: %d\n",
889 obj->type);
890 kfree(buf.pointer);
891 return -EINVAL;
892 }
893
894 pdata->hid_descriptor_address = obj->integer.value;
895 888
896 kfree(buf.pointer);
897 return 0; 889 return 0;
898} 890}
899 891
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c
index 2a47e82821da..5440131cd4ee 100644
--- a/drivers/pci/hotplug/acpi_pcihp.c
+++ b/drivers/pci/hotplug/acpi_pcihp.c
@@ -411,13 +411,10 @@ EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware);
411static int pcihp_is_ejectable(acpi_handle handle) 411static int pcihp_is_ejectable(acpi_handle handle)
412{ 412{
413 acpi_status status; 413 acpi_status status;
414 acpi_handle tmp;
415 unsigned long long removable; 414 unsigned long long removable;
416 status = acpi_get_handle(handle, "_ADR", &tmp); 415 if (!acpi_has_method(handle, "_ADR"))
417 if (ACPI_FAILURE(status))
418 return 0; 416 return 0;
419 status = acpi_get_handle(handle, "_EJ0", &tmp); 417 if (acpi_has_method(handle, "_EJ0"))
420 if (ACPI_SUCCESS(status))
421 return 1; 418 return 1;
422 status = acpi_evaluate_integer(handle, "_RMV", NULL, &removable); 419 status = acpi_evaluate_integer(handle, "_RMV", NULL, &removable);
423 if (ACPI_SUCCESS(status) && removable) 420 if (ACPI_SUCCESS(status) && removable)
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index b0299e6d9a3f..dfd1f59de729 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -181,7 +181,6 @@ static bool acpi_pci_power_manageable(struct pci_dev *dev)
181static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) 181static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
182{ 182{
183 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); 183 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);
184 acpi_handle tmp;
185 static const u8 state_conv[] = { 184 static const u8 state_conv[] = {
186 [PCI_D0] = ACPI_STATE_D0, 185 [PCI_D0] = ACPI_STATE_D0,
187 [PCI_D1] = ACPI_STATE_D1, 186 [PCI_D1] = ACPI_STATE_D1,
@@ -192,7 +191,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
192 int error = -EINVAL; 191 int error = -EINVAL;
193 192
194 /* If the ACPI device has _EJ0, ignore the device */ 193 /* If the ACPI device has _EJ0, ignore the device */
195 if (!handle || ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) 194 if (!handle || acpi_has_method(handle, "_EJ0"))
196 return -ENODEV; 195 return -ENODEV;
197 196
198 switch (state) { 197 switch (state) {
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index a6afd4108beb..aefcc32e5634 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -190,16 +190,10 @@ struct eeepc_laptop {
190 */ 190 */
191static int write_acpi_int(acpi_handle handle, const char *method, int val) 191static int write_acpi_int(acpi_handle handle, const char *method, int val)
192{ 192{
193 struct acpi_object_list params;
194 union acpi_object in_obj;
195 acpi_status status; 193 acpi_status status;
196 194
197 params.count = 1; 195 status = acpi_execute_simple_method(handle, (char *)method, val);
198 params.pointer = &in_obj;
199 in_obj.type = ACPI_TYPE_INTEGER;
200 in_obj.integer.value = val;
201 196
202 status = acpi_evaluate_object(handle, (char *)method, &params, NULL);
203 return (status == AE_OK ? 0 : -1); 197 return (status == AE_OK ? 0 : -1);
204} 198}
205 199
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 52b8a97efde1..9d30d69aa78f 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -219,8 +219,7 @@ static int call_fext_func(int cmd, int arg0, int arg1, int arg2)
219 { .type = ACPI_TYPE_INTEGER } 219 { .type = ACPI_TYPE_INTEGER }
220 }; 220 };
221 struct acpi_object_list arg_list = { 4, &params[0] }; 221 struct acpi_object_list arg_list = { 4, &params[0] };
222 struct acpi_buffer output; 222 unsigned long long value;
223 union acpi_object out_obj;
224 acpi_handle handle = NULL; 223 acpi_handle handle = NULL;
225 224
226 status = acpi_get_handle(fujitsu_hotkey->acpi_handle, "FUNC", &handle); 225 status = acpi_get_handle(fujitsu_hotkey->acpi_handle, "FUNC", &handle);
@@ -235,10 +234,7 @@ static int call_fext_func(int cmd, int arg0, int arg1, int arg2)
235 params[2].integer.value = arg1; 234 params[2].integer.value = arg1;
236 params[3].integer.value = arg2; 235 params[3].integer.value = arg2;
237 236
238 output.length = sizeof(out_obj); 237 status = acpi_evaluate_integer(handle, NULL, &arg_list, &value);
239 output.pointer = &out_obj;
240
241 status = acpi_evaluate_object(handle, NULL, &arg_list, &output);
242 if (ACPI_FAILURE(status)) { 238 if (ACPI_FAILURE(status)) {
243 vdbg_printk(FUJLAPTOP_DBG_WARN, 239 vdbg_printk(FUJLAPTOP_DBG_WARN,
244 "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) call failed\n", 240 "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) call failed\n",
@@ -246,18 +242,10 @@ static int call_fext_func(int cmd, int arg0, int arg1, int arg2)
246 return -ENODEV; 242 return -ENODEV;
247 } 243 }
248 244
249 if (out_obj.type != ACPI_TYPE_INTEGER) {
250 vdbg_printk(FUJLAPTOP_DBG_WARN,
251 "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) did not "
252 "return an integer\n",
253 cmd, arg0, arg1, arg2);
254 return -ENODEV;
255 }
256
257 vdbg_printk(FUJLAPTOP_DBG_TRACE, 245 vdbg_printk(FUJLAPTOP_DBG_TRACE,
258 "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) returned 0x%x\n", 246 "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) returned 0x%x\n",
259 cmd, arg0, arg1, arg2, (int)out_obj.integer.value); 247 cmd, arg0, arg1, arg2, (int)value);
260 return out_obj.integer.value; 248 return value;
261} 249}
262 250
263#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 251#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
@@ -317,8 +305,6 @@ static enum led_brightness kblamps_get(struct led_classdev *cdev)
317static int set_lcd_level(int level) 305static int set_lcd_level(int level)
318{ 306{
319 acpi_status status = AE_OK; 307 acpi_status status = AE_OK;
320 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
321 struct acpi_object_list arg_list = { 1, &arg0 };
322 acpi_handle handle = NULL; 308 acpi_handle handle = NULL;
323 309
324 vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBLL [%d]\n", 310 vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBLL [%d]\n",
@@ -333,9 +319,8 @@ static int set_lcd_level(int level)
333 return -ENODEV; 319 return -ENODEV;
334 } 320 }
335 321
336 arg0.integer.value = level;
337 322
338 status = acpi_evaluate_object(handle, NULL, &arg_list, NULL); 323 status = acpi_execute_simple_method(handle, NULL, level);
339 if (ACPI_FAILURE(status)) 324 if (ACPI_FAILURE(status))
340 return -ENODEV; 325 return -ENODEV;
341 326
@@ -345,8 +330,6 @@ static int set_lcd_level(int level)
345static int set_lcd_level_alt(int level) 330static int set_lcd_level_alt(int level)
346{ 331{
347 acpi_status status = AE_OK; 332 acpi_status status = AE_OK;
348 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
349 struct acpi_object_list arg_list = { 1, &arg0 };
350 acpi_handle handle = NULL; 333 acpi_handle handle = NULL;
351 334
352 vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBL2 [%d]\n", 335 vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBL2 [%d]\n",
@@ -361,9 +344,7 @@ static int set_lcd_level_alt(int level)
361 return -ENODEV; 344 return -ENODEV;
362 } 345 }
363 346
364 arg0.integer.value = level; 347 status = acpi_execute_simple_method(handle, NULL, level);
365
366 status = acpi_evaluate_object(handle, NULL, &arg_list, NULL);
367 if (ACPI_FAILURE(status)) 348 if (ACPI_FAILURE(status))
368 return -ENODEV; 349 return -ENODEV;
369 350
@@ -586,11 +567,10 @@ static struct platform_driver fujitsupf_driver = {
586 567
587static void dmi_check_cb_common(const struct dmi_system_id *id) 568static void dmi_check_cb_common(const struct dmi_system_id *id)
588{ 569{
589 acpi_handle handle;
590 pr_info("Identified laptop model '%s'\n", id->ident); 570 pr_info("Identified laptop model '%s'\n", id->ident);
591 if (use_alt_lcd_levels == -1) { 571 if (use_alt_lcd_levels == -1) {
592 if (ACPI_SUCCESS(acpi_get_handle(NULL, 572 if (acpi_has_method(NULL,
593 "\\_SB.PCI0.LPCB.FJEX.SBL2", &handle))) 573 "\\_SB.PCI0.LPCB.FJEX.SBL2"))
594 use_alt_lcd_levels = 1; 574 use_alt_lcd_levels = 1;
595 else 575 else
596 use_alt_lcd_levels = 0; 576 use_alt_lcd_levels = 0;
@@ -653,7 +633,6 @@ static struct dmi_system_id fujitsu_dmi_table[] = {
653 633
654static int acpi_fujitsu_add(struct acpi_device *device) 634static int acpi_fujitsu_add(struct acpi_device *device)
655{ 635{
656 acpi_handle handle;
657 int result = 0; 636 int result = 0;
658 int state = 0; 637 int state = 0;
659 struct input_dev *input; 638 struct input_dev *input;
@@ -702,8 +681,7 @@ static int acpi_fujitsu_add(struct acpi_device *device)
702 681
703 fujitsu->dev = device; 682 fujitsu->dev = device;
704 683
705 if (ACPI_SUCCESS 684 if (acpi_has_method(device->handle, METHOD_NAME__INI)) {
706 (acpi_get_handle(device->handle, METHOD_NAME__INI, &handle))) {
707 vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n"); 685 vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n");
708 if (ACPI_FAILURE 686 if (ACPI_FAILURE
709 (acpi_evaluate_object 687 (acpi_evaluate_object
@@ -803,7 +781,6 @@ static void acpi_fujitsu_notify(struct acpi_device *device, u32 event)
803 781
804static int acpi_fujitsu_hotkey_add(struct acpi_device *device) 782static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
805{ 783{
806 acpi_handle handle;
807 int result = 0; 784 int result = 0;
808 int state = 0; 785 int state = 0;
809 struct input_dev *input; 786 struct input_dev *input;
@@ -866,8 +843,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
866 843
867 fujitsu_hotkey->dev = device; 844 fujitsu_hotkey->dev = device;
868 845
869 if (ACPI_SUCCESS 846 if (acpi_has_method(device->handle, METHOD_NAME__INI)) {
870 (acpi_get_handle(device->handle, METHOD_NAME__INI, &handle))) {
871 vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n"); 847 vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n");
872 if (ACPI_FAILURE 848 if (ACPI_FAILURE
873 (acpi_evaluate_object 849 (acpi_evaluate_object
diff --git a/drivers/platform/x86/intel-rst.c b/drivers/platform/x86/intel-rst.c
index 41b740cb28bc..a2083a9e5662 100644
--- a/drivers/platform/x86/intel-rst.c
+++ b/drivers/platform/x86/intel-rst.c
@@ -29,24 +29,16 @@ static ssize_t irst_show_wakeup_events(struct device *dev,
29 char *buf) 29 char *buf)
30{ 30{
31 struct acpi_device *acpi; 31 struct acpi_device *acpi;
32 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; 32 unsigned long long value;
33 union acpi_object *result;
34 acpi_status status; 33 acpi_status status;
35 34
36 acpi = to_acpi_device(dev); 35 acpi = to_acpi_device(dev);
37 36
38 status = acpi_evaluate_object(acpi->handle, "GFFS", NULL, &output); 37 status = acpi_evaluate_integer(acpi->handle, "GFFS", NULL, &value);
39 if (!ACPI_SUCCESS(status)) 38 if (!ACPI_SUCCESS(status))
40 return -EINVAL; 39 return -EINVAL;
41 40
42 result = output.pointer; 41 return sprintf(buf, "%lld\n", value);
43
44 if (result->type != ACPI_TYPE_INTEGER) {
45 kfree(result);
46 return -EINVAL;
47 }
48
49 return sprintf(buf, "%lld\n", result->integer.value);
50} 42}
51 43
52static ssize_t irst_store_wakeup_events(struct device *dev, 44static ssize_t irst_store_wakeup_events(struct device *dev,
@@ -54,8 +46,6 @@ static ssize_t irst_store_wakeup_events(struct device *dev,
54 const char *buf, size_t count) 46 const char *buf, size_t count)
55{ 47{
56 struct acpi_device *acpi; 48 struct acpi_device *acpi;
57 struct acpi_object_list input;
58 union acpi_object param;
59 acpi_status status; 49 acpi_status status;
60 unsigned long value; 50 unsigned long value;
61 int error; 51 int error;
@@ -67,13 +57,7 @@ static ssize_t irst_store_wakeup_events(struct device *dev,
67 if (error) 57 if (error)
68 return error; 58 return error;
69 59
70 param.type = ACPI_TYPE_INTEGER; 60 status = acpi_execute_simple_method(acpi->handle, "SFFS", value);
71 param.integer.value = value;
72
73 input.count = 1;
74 input.pointer = &param;
75
76 status = acpi_evaluate_object(acpi->handle, "SFFS", &input, NULL);
77 61
78 if (!ACPI_SUCCESS(status)) 62 if (!ACPI_SUCCESS(status))
79 return -EINVAL; 63 return -EINVAL;
@@ -91,24 +75,16 @@ static ssize_t irst_show_wakeup_time(struct device *dev,
91 struct device_attribute *attr, char *buf) 75 struct device_attribute *attr, char *buf)
92{ 76{
93 struct acpi_device *acpi; 77 struct acpi_device *acpi;
94 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; 78 unsigned long long value;
95 union acpi_object *result;
96 acpi_status status; 79 acpi_status status;
97 80
98 acpi = to_acpi_device(dev); 81 acpi = to_acpi_device(dev);
99 82
100 status = acpi_evaluate_object(acpi->handle, "GFTV", NULL, &output); 83 status = acpi_evaluate_integer(acpi->handle, "GFTV", NULL, &value);
101 if (!ACPI_SUCCESS(status)) 84 if (!ACPI_SUCCESS(status))
102 return -EINVAL; 85 return -EINVAL;
103 86
104 result = output.pointer; 87 return sprintf(buf, "%lld\n", value);
105
106 if (result->type != ACPI_TYPE_INTEGER) {
107 kfree(result);
108 return -EINVAL;
109 }
110
111 return sprintf(buf, "%lld\n", result->integer.value);
112} 88}
113 89
114static ssize_t irst_store_wakeup_time(struct device *dev, 90static ssize_t irst_store_wakeup_time(struct device *dev,
@@ -116,8 +92,6 @@ static ssize_t irst_store_wakeup_time(struct device *dev,
116 const char *buf, size_t count) 92 const char *buf, size_t count)
117{ 93{
118 struct acpi_device *acpi; 94 struct acpi_device *acpi;
119 struct acpi_object_list input;
120 union acpi_object param;
121 acpi_status status; 95 acpi_status status;
122 unsigned long value; 96 unsigned long value;
123 int error; 97 int error;
@@ -129,13 +103,7 @@ static ssize_t irst_store_wakeup_time(struct device *dev,
129 if (error) 103 if (error)
130 return error; 104 return error;
131 105
132 param.type = ACPI_TYPE_INTEGER; 106 status = acpi_execute_simple_method(acpi->handle, "SFTV", value);
133 param.integer.value = value;
134
135 input.count = 1;
136 input.pointer = &param;
137
138 status = acpi_evaluate_object(acpi->handle, "SFTV", &input, NULL);
139 107
140 if (!ACPI_SUCCESS(status)) 108 if (!ACPI_SUCCESS(status))
141 return -EINVAL; 109 return -EINVAL;
diff --git a/drivers/platform/x86/intel-smartconnect.c b/drivers/platform/x86/intel-smartconnect.c
index 52259dcabecb..1838400dc036 100644
--- a/drivers/platform/x86/intel-smartconnect.c
+++ b/drivers/platform/x86/intel-smartconnect.c
@@ -25,37 +25,18 @@ MODULE_LICENSE("GPL");
25 25
26static int smartconnect_acpi_init(struct acpi_device *acpi) 26static int smartconnect_acpi_init(struct acpi_device *acpi)
27{ 27{
28 struct acpi_object_list input; 28 unsigned long long value;
29 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
30 union acpi_object *result;
31 union acpi_object param;
32 acpi_status status; 29 acpi_status status;
33 30
34 status = acpi_evaluate_object(acpi->handle, "GAOS", NULL, &output); 31 status = acpi_evaluate_integer(acpi->handle, "GAOS", NULL, &value);
35 if (!ACPI_SUCCESS(status)) 32 if (!ACPI_SUCCESS(status))
36 return -EINVAL; 33 return -EINVAL;
37 34
38 result = output.pointer; 35 if (value & 0x1) {
39
40 if (result->type != ACPI_TYPE_INTEGER) {
41 kfree(result);
42 return -EINVAL;
43 }
44
45 if (result->integer.value & 0x1) {
46 param.type = ACPI_TYPE_INTEGER;
47 param.integer.value = 0;
48
49 input.count = 1;
50 input.pointer = &param;
51
52 dev_info(&acpi->dev, "Disabling Intel Smart Connect\n"); 36 dev_info(&acpi->dev, "Disabling Intel Smart Connect\n");
53 status = acpi_evaluate_object(acpi->handle, "SAOS", &input, 37 status = acpi_execute_simple_method(acpi->handle, "SAOS", 0);
54 NULL);
55 } 38 }
56 39
57 kfree(result);
58
59 return 0; 40 return 0;
60} 41}
61 42
diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c
index d6cfc1558c2f..11244f8703c4 100644
--- a/drivers/platform/x86/intel_menlow.c
+++ b/drivers/platform/x86/intel_menlow.c
@@ -156,19 +156,15 @@ static struct thermal_cooling_device_ops memory_cooling_ops = {
156static int intel_menlow_memory_add(struct acpi_device *device) 156static int intel_menlow_memory_add(struct acpi_device *device)
157{ 157{
158 int result = -ENODEV; 158 int result = -ENODEV;
159 acpi_status status = AE_OK;
160 acpi_handle dummy;
161 struct thermal_cooling_device *cdev; 159 struct thermal_cooling_device *cdev;
162 160
163 if (!device) 161 if (!device)
164 return -EINVAL; 162 return -EINVAL;
165 163
166 status = acpi_get_handle(device->handle, MEMORY_GET_BANDWIDTH, &dummy); 164 if (!acpi_has_method(device->handle, MEMORY_GET_BANDWIDTH))
167 if (ACPI_FAILURE(status))
168 goto end; 165 goto end;
169 166
170 status = acpi_get_handle(device->handle, MEMORY_SET_BANDWIDTH, &dummy); 167 if (!acpi_has_method(device->handle, MEMORY_SET_BANDWIDTH))
171 if (ACPI_FAILURE(status))
172 goto end; 168 goto end;
173 169
174 cdev = thermal_cooling_device_register("Memory controller", device, 170 cdev = thermal_cooling_device_register("Memory controller", device,
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 13ec195f0ca6..47caab0ea7a1 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1508,7 +1508,6 @@ static void sony_nc_function_resume(void)
1508static int sony_nc_resume(struct device *dev) 1508static int sony_nc_resume(struct device *dev)
1509{ 1509{
1510 struct sony_nc_value *item; 1510 struct sony_nc_value *item;
1511 acpi_handle handle;
1512 1511
1513 for (item = sony_nc_values; item->name; item++) { 1512 for (item = sony_nc_values; item->name; item++) {
1514 int ret; 1513 int ret;
@@ -1523,15 +1522,13 @@ static int sony_nc_resume(struct device *dev)
1523 } 1522 }
1524 } 1523 }
1525 1524
1526 if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "ECON", 1525 if (acpi_has_method(sony_nc_acpi_handle, "ECON")) {
1527 &handle))) {
1528 int arg = 1; 1526 int arg = 1;
1529 if (sony_nc_int_call(sony_nc_acpi_handle, "ECON", &arg, NULL)) 1527 if (sony_nc_int_call(sony_nc_acpi_handle, "ECON", &arg, NULL))
1530 dprintk("ECON Method failed\n"); 1528 dprintk("ECON Method failed\n");
1531 } 1529 }
1532 1530
1533 if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "SN00", 1531 if (acpi_has_method(sony_nc_acpi_handle, "SN00"))
1534 &handle)))
1535 sony_nc_function_resume(); 1532 sony_nc_function_resume();
1536 1533
1537 return 0; 1534 return 0;
@@ -2682,7 +2679,6 @@ static void sony_nc_backlight_ng_read_limits(int handle,
2682 2679
2683static void sony_nc_backlight_setup(void) 2680static void sony_nc_backlight_setup(void)
2684{ 2681{
2685 acpi_handle unused;
2686 int max_brightness = 0; 2682 int max_brightness = 0;
2687 const struct backlight_ops *ops = NULL; 2683 const struct backlight_ops *ops = NULL;
2688 struct backlight_properties props; 2684 struct backlight_properties props;
@@ -2717,8 +2713,7 @@ static void sony_nc_backlight_setup(void)
2717 sony_nc_backlight_ng_read_limits(0x14c, &sony_bl_props); 2713 sony_nc_backlight_ng_read_limits(0x14c, &sony_bl_props);
2718 max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; 2714 max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset;
2719 2715
2720 } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", 2716 } else if (acpi_has_method(sony_nc_acpi_handle, "GBRT")) {
2721 &unused))) {
2722 ops = &sony_backlight_ops; 2717 ops = &sony_backlight_ops;
2723 max_brightness = SONY_MAX_BRIGHTNESS - 1; 2718 max_brightness = SONY_MAX_BRIGHTNESS - 1;
2724 2719
@@ -2750,7 +2745,6 @@ static int sony_nc_add(struct acpi_device *device)
2750{ 2745{
2751 acpi_status status; 2746 acpi_status status;
2752 int result = 0; 2747 int result = 0;
2753 acpi_handle handle;
2754 struct sony_nc_value *item; 2748 struct sony_nc_value *item;
2755 2749
2756 pr_info("%s v%s\n", SONY_NC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION); 2750 pr_info("%s v%s\n", SONY_NC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION);
@@ -2790,15 +2784,13 @@ static int sony_nc_add(struct acpi_device *device)
2790 goto outplatform; 2784 goto outplatform;
2791 } 2785 }
2792 2786
2793 if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "ECON", 2787 if (acpi_has_method(sony_nc_acpi_handle, "ECON")) {
2794 &handle))) {
2795 int arg = 1; 2788 int arg = 1;
2796 if (sony_nc_int_call(sony_nc_acpi_handle, "ECON", &arg, NULL)) 2789 if (sony_nc_int_call(sony_nc_acpi_handle, "ECON", &arg, NULL))
2797 dprintk("ECON Method failed\n"); 2790 dprintk("ECON Method failed\n");
2798 } 2791 }
2799 2792
2800 if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "SN00", 2793 if (acpi_has_method(sony_nc_acpi_handle, "SN00")) {
2801 &handle))) {
2802 dprintk("Doing SNC setup\n"); 2794 dprintk("Doing SNC setup\n");
2803 /* retrieve the available handles */ 2795 /* retrieve the available handles */
2804 result = sony_nc_handles_setup(sony_pf_device); 2796 result = sony_nc_handles_setup(sony_pf_device);
@@ -2821,9 +2813,8 @@ static int sony_nc_add(struct acpi_device *device)
2821 2813
2822 /* find the available acpiget as described in the DSDT */ 2814 /* find the available acpiget as described in the DSDT */
2823 for (; item->acpiget && *item->acpiget; ++item->acpiget) { 2815 for (; item->acpiget && *item->acpiget; ++item->acpiget) {
2824 if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, 2816 if (acpi_has_method(sony_nc_acpi_handle,
2825 *item->acpiget, 2817 *item->acpiget)) {
2826 &handle))) {
2827 dprintk("Found %s getter: %s\n", 2818 dprintk("Found %s getter: %s\n",
2828 item->name, *item->acpiget); 2819 item->name, *item->acpiget);
2829 item->devattr.attr.mode |= S_IRUGO; 2820 item->devattr.attr.mode |= S_IRUGO;
@@ -2833,9 +2824,8 @@ static int sony_nc_add(struct acpi_device *device)
2833 2824
2834 /* find the available acpiset as described in the DSDT */ 2825 /* find the available acpiset as described in the DSDT */
2835 for (; item->acpiset && *item->acpiset; ++item->acpiset) { 2826 for (; item->acpiset && *item->acpiset; ++item->acpiset) {
2836 if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, 2827 if (acpi_has_method(sony_nc_acpi_handle,
2837 *item->acpiset, 2828 *item->acpiset)) {
2838 &handle))) {
2839 dprintk("Found %s setter: %s\n", 2829 dprintk("Found %s setter: %s\n",
2840 item->name, *item->acpiset); 2830 item->name, *item->acpiset);
2841 item->devattr.attr.mode |= S_IWUSR; 2831 item->devattr.attr.mode |= S_IWUSR;
diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c
index 4ab618c63b45..67897c8740ba 100644
--- a/drivers/platform/x86/topstar-laptop.c
+++ b/drivers/platform/x86/topstar-laptop.c
@@ -80,13 +80,9 @@ static void acpi_topstar_notify(struct acpi_device *device, u32 event)
80static int acpi_topstar_fncx_switch(struct acpi_device *device, bool state) 80static int acpi_topstar_fncx_switch(struct acpi_device *device, bool state)
81{ 81{
82 acpi_status status; 82 acpi_status status;
83 union acpi_object fncx_params[1] = {
84 { .type = ACPI_TYPE_INTEGER }
85 };
86 struct acpi_object_list fncx_arg_list = { 1, &fncx_params[0] };
87 83
88 fncx_params[0].integer.value = state ? 0x86 : 0x87; 84 status = acpi_execute_simple_method(device->handle, "FNCX",
89 status = acpi_evaluate_object(device->handle, "FNCX", &fncx_arg_list, NULL); 85 state ? 0x86 : 0x87);
90 if (ACPI_FAILURE(status)) { 86 if (ACPI_FAILURE(status)) {
91 pr_err("Unable to switch FNCX notifications\n"); 87 pr_err("Unable to switch FNCX notifications\n");
92 return -ENODEV; 88 return -ENODEV;
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index eb3467ea6d86..0cfadb65f7c6 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -191,16 +191,9 @@ static __inline__ void _set_bit(u32 * word, u32 mask, int value)
191 191
192static int write_acpi_int(const char *methodName, int val) 192static int write_acpi_int(const char *methodName, int val)
193{ 193{
194 struct acpi_object_list params;
195 union acpi_object in_objs[1];
196 acpi_status status; 194 acpi_status status;
197 195
198 params.count = ARRAY_SIZE(in_objs); 196 status = acpi_execute_simple_method(NULL, (char *)methodName, val);
199 params.pointer = in_objs;
200 in_objs[0].type = ACPI_TYPE_INTEGER;
201 in_objs[0].integer.value = val;
202
203 status = acpi_evaluate_object(NULL, (char *)methodName, &params, NULL);
204 return (status == AE_OK) ? 0 : -EIO; 197 return (status == AE_OK) ? 0 : -EIO;
205} 198}
206 199
@@ -947,21 +940,17 @@ static void toshiba_acpi_hotkey_work(struct work_struct *work)
947 */ 940 */
948static int toshiba_acpi_query_hotkey(struct toshiba_acpi_dev *dev) 941static int toshiba_acpi_query_hotkey(struct toshiba_acpi_dev *dev)
949{ 942{
950 struct acpi_buffer buf; 943 unsigned long long value;
951 union acpi_object out_obj;
952 acpi_status status; 944 acpi_status status;
953 945
954 buf.pointer = &out_obj; 946 status = acpi_evaluate_integer(dev->acpi_dev->handle, "INFO",
955 buf.length = sizeof(out_obj); 947 NULL, &value);
956 948 if (ACPI_FAILURE(status)) {
957 status = acpi_evaluate_object(dev->acpi_dev->handle, "INFO",
958 NULL, &buf);
959 if (ACPI_FAILURE(status) || out_obj.type != ACPI_TYPE_INTEGER) {
960 pr_err("ACPI INFO method execution failed\n"); 949 pr_err("ACPI INFO method execution failed\n");
961 return -EIO; 950 return -EIO;
962 } 951 }
963 952
964 return out_obj.integer.value; 953 return value;
965} 954}
966 955
967static void toshiba_acpi_report_hotkey(struct toshiba_acpi_dev *dev, 956static void toshiba_acpi_report_hotkey(struct toshiba_acpi_dev *dev,
@@ -981,7 +970,7 @@ static void toshiba_acpi_report_hotkey(struct toshiba_acpi_dev *dev,
981static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev) 970static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
982{ 971{
983 acpi_status status; 972 acpi_status status;
984 acpi_handle ec_handle, handle; 973 acpi_handle ec_handle;
985 int error; 974 int error;
986 u32 hci_result; 975 u32 hci_result;
987 976
@@ -1008,10 +997,7 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
1008 */ 997 */
1009 status = AE_ERROR; 998 status = AE_ERROR;
1010 ec_handle = ec_get_handle(); 999 ec_handle = ec_get_handle();
1011 if (ec_handle) 1000 if (ec_handle && acpi_has_method(ec_handle, "NTFY")) {
1012 status = acpi_get_handle(ec_handle, "NTFY", &handle);
1013
1014 if (ACPI_SUCCESS(status)) {
1015 INIT_WORK(&dev->hotkey_work, toshiba_acpi_hotkey_work); 1001 INIT_WORK(&dev->hotkey_work, toshiba_acpi_hotkey_work);
1016 1002
1017 error = i8042_install_filter(toshiba_acpi_i8042_filter); 1003 error = i8042_install_filter(toshiba_acpi_i8042_filter);
@@ -1027,10 +1013,9 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
1027 * Determine hotkey query interface. Prefer using the INFO 1013 * Determine hotkey query interface. Prefer using the INFO
1028 * method when it is available. 1014 * method when it is available.
1029 */ 1015 */
1030 status = acpi_get_handle(dev->acpi_dev->handle, "INFO", &handle); 1016 if (acpi_has_method(dev->acpi_dev->handle, "INFO"))
1031 if (ACPI_SUCCESS(status)) {
1032 dev->info_supported = 1; 1017 dev->info_supported = 1;
1033 } else { 1018 else {
1034 hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); 1019 hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result);
1035 if (hci_result == HCI_SUCCESS) 1020 if (hci_result == HCI_SUCCESS)
1036 dev->system_event_supported = 1; 1021 dev->system_event_supported = 1;
@@ -1155,15 +1140,10 @@ static int toshiba_acpi_remove(struct acpi_device *acpi_dev)
1155 1140
1156static const char *find_hci_method(acpi_handle handle) 1141static const char *find_hci_method(acpi_handle handle)
1157{ 1142{
1158 acpi_status status; 1143 if (acpi_has_method(handle, "GHCI"))
1159 acpi_handle hci_handle;
1160
1161 status = acpi_get_handle(handle, "GHCI", &hci_handle);
1162 if (ACPI_SUCCESS(status))
1163 return "GHCI"; 1144 return "GHCI";
1164 1145
1165 status = acpi_get_handle(handle, "SPFC", &hci_handle); 1146 if (acpi_has_method(handle, "SPFC"))
1166 if (ACPI_SUCCESS(status))
1167 return "SPFC"; 1147 return "SPFC";
1168 1148
1169 return NULL; 1149 return NULL;
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 601ea9512242..62e8c221d01e 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -252,8 +252,6 @@ static acpi_status wmi_method_enable(struct wmi_block *wblock, int enable)
252{ 252{
253 struct guid_block *block = NULL; 253 struct guid_block *block = NULL;
254 char method[5]; 254 char method[5];
255 struct acpi_object_list input;
256 union acpi_object params[1];
257 acpi_status status; 255 acpi_status status;
258 acpi_handle handle; 256 acpi_handle handle;
259 257
@@ -263,13 +261,9 @@ static acpi_status wmi_method_enable(struct wmi_block *wblock, int enable)
263 if (!block) 261 if (!block)
264 return AE_NOT_EXIST; 262 return AE_NOT_EXIST;
265 263
266 input.count = 1;
267 input.pointer = params;
268 params[0].type = ACPI_TYPE_INTEGER;
269 params[0].integer.value = enable;
270 264
271 snprintf(method, 5, "WE%02X", block->notify_id); 265 snprintf(method, 5, "WE%02X", block->notify_id);
272 status = acpi_evaluate_object(handle, method, &input, NULL); 266 status = acpi_execute_simple_method(handle, method, enable);
273 267
274 if (status != AE_OK && status != AE_NOT_FOUND) 268 if (status != AE_OK && status != AE_NOT_FOUND)
275 return status; 269 return status;
@@ -353,10 +347,10 @@ struct acpi_buffer *out)
353{ 347{
354 struct guid_block *block = NULL; 348 struct guid_block *block = NULL;
355 struct wmi_block *wblock = NULL; 349 struct wmi_block *wblock = NULL;
356 acpi_handle handle, wc_handle; 350 acpi_handle handle;
357 acpi_status status, wc_status = AE_ERROR; 351 acpi_status status, wc_status = AE_ERROR;
358 struct acpi_object_list input, wc_input; 352 struct acpi_object_list input;
359 union acpi_object wc_params[1], wq_params[1]; 353 union acpi_object wq_params[1];
360 char method[5]; 354 char method[5];
361 char wc_method[5] = "WC"; 355 char wc_method[5] = "WC";
362 356
@@ -386,11 +380,6 @@ struct acpi_buffer *out)
386 * enable collection. 380 * enable collection.
387 */ 381 */
388 if (block->flags & ACPI_WMI_EXPENSIVE) { 382 if (block->flags & ACPI_WMI_EXPENSIVE) {
389 wc_input.count = 1;
390 wc_input.pointer = wc_params;
391 wc_params[0].type = ACPI_TYPE_INTEGER;
392 wc_params[0].integer.value = 1;
393
394 strncat(wc_method, block->object_id, 2); 383 strncat(wc_method, block->object_id, 2);
395 384
396 /* 385 /*
@@ -398,10 +387,9 @@ struct acpi_buffer *out)
398 * expensive, but have no corresponding WCxx method. So we 387 * expensive, but have no corresponding WCxx method. So we
399 * should not fail if this happens. 388 * should not fail if this happens.
400 */ 389 */
401 wc_status = acpi_get_handle(handle, wc_method, &wc_handle); 390 if (acpi_has_method(handle, wc_method))
402 if (ACPI_SUCCESS(wc_status)) 391 wc_status = acpi_execute_simple_method(handle,
403 wc_status = acpi_evaluate_object(handle, wc_method, 392 wc_method, 1);
404 &wc_input, NULL);
405 } 393 }
406 394
407 strcpy(method, "WQ"); 395 strcpy(method, "WQ");
@@ -414,9 +402,7 @@ struct acpi_buffer *out)
414 * the WQxx method failed - we should disable collection anyway. 402 * the WQxx method failed - we should disable collection anyway.
415 */ 403 */
416 if ((block->flags & ACPI_WMI_EXPENSIVE) && ACPI_SUCCESS(wc_status)) { 404 if ((block->flags & ACPI_WMI_EXPENSIVE) && ACPI_SUCCESS(wc_status)) {
417 wc_params[0].integer.value = 0; 405 status = acpi_execute_simple_method(handle, wc_method, 0);
418 status = acpi_evaluate_object(handle,
419 wc_method, &wc_input, NULL);
420 } 406 }
421 407
422 return status; 408 return status;
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 34049b0b4c73..747826d99059 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -239,8 +239,6 @@ static char *__init pnpacpi_get_id(struct acpi_device *device)
239 239
240static int __init pnpacpi_add_device(struct acpi_device *device) 240static int __init pnpacpi_add_device(struct acpi_device *device)
241{ 241{
242 acpi_handle temp = NULL;
243 acpi_status status;
244 struct pnp_dev *dev; 242 struct pnp_dev *dev;
245 char *pnpid; 243 char *pnpid;
246 struct acpi_hardware_id *id; 244 struct acpi_hardware_id *id;
@@ -253,8 +251,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
253 * If a PnPacpi device is not present , the device 251 * If a PnPacpi device is not present , the device
254 * driver should not be loaded. 252 * driver should not be loaded.
255 */ 253 */
256 status = acpi_get_handle(device->handle, "_CRS", &temp); 254 if (!acpi_has_method(device->handle, "_CRS"))
257 if (ACPI_FAILURE(status))
258 return 0; 255 return 0;
259 256
260 pnpid = pnpacpi_get_id(device); 257 pnpid = pnpacpi_get_id(device);
@@ -271,16 +268,14 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
271 dev->data = device; 268 dev->data = device;
272 /* .enabled means the device can decode the resources */ 269 /* .enabled means the device can decode the resources */
273 dev->active = device->status.enabled; 270 dev->active = device->status.enabled;
274 status = acpi_get_handle(device->handle, "_SRS", &temp); 271 if (acpi_has_method(device->handle, "_SRS"))
275 if (ACPI_SUCCESS(status))
276 dev->capabilities |= PNP_CONFIGURABLE; 272 dev->capabilities |= PNP_CONFIGURABLE;
277 dev->capabilities |= PNP_READ; 273 dev->capabilities |= PNP_READ;
278 if (device->flags.dynamic_status && (dev->capabilities & PNP_CONFIGURABLE)) 274 if (device->flags.dynamic_status && (dev->capabilities & PNP_CONFIGURABLE))
279 dev->capabilities |= PNP_WRITE; 275 dev->capabilities |= PNP_WRITE;
280 if (device->flags.removable) 276 if (device->flags.removable)
281 dev->capabilities |= PNP_REMOVABLE; 277 dev->capabilities |= PNP_REMOVABLE;
282 status = acpi_get_handle(device->handle, "_DIS", &temp); 278 if (acpi_has_method(device->handle, "_DIS"))
283 if (ACPI_SUCCESS(status))
284 dev->capabilities |= PNP_DISABLE; 279 dev->capabilities |= PNP_DISABLE;
285 280
286 if (strlen(acpi_device_name(device))) 281 if (strlen(acpi_device_name(device)))