aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/battery.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-22 16:36:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-22 16:36:52 -0400
commit7100e505b76b4e2efd88b2459d1a932214e29f8a (patch)
treea8eae8687dc1511c89463b1eb93c8349a7471ab3 /drivers/acpi/battery.c
parentcb47c1831fa406c964468b259f2082c16cc3f757 (diff)
parent75a4161a58dd157a2bd2dc8e9986e45b62ac46cf (diff)
Merge tag 'pm-for-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management updates from Rafael Wysocki: - ACPI conversion to PM handling based on struct dev_pm_ops. - Conversion of a number of platform drivers to PM handling based on struct dev_pm_ops and removal of empty legacy PM callbacks from a couple of PCI drivers. - Suspend-to-both for in-kernel hibernation from Bojan Smojver. - cpuidle fixes and cleanups from ShuoX Liu, Daniel Lezcano and Preeti Murthy. - cpufreq bug fixes from Jonghwa Lee and Stephen Boyd. - Suspend and hibernate fixes from Srivatsa Bhat and Colin Cross. - Generic PM domains framework updates. - RTC CMOS wakeup signaling update from Paul Fox. - sparse warnings fixes from Sachin Kamat. - Build warnings fixes for the generic PM domains framework and PM sysfs code. - sysfs switch for printing device suspend times from Sameer Nanda. - Documentation fix from Oskar Schirmer. * tag 'pm-for-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (70 commits) cpufreq: Fix sysfs deadlock with concurrent hotplug/frequency switch EXYNOS: bugfix on retrieving old_index from freqs.old PM / Sleep: call early resume handlers when suspend_noirq fails PM / QoS: Use NULL pointer instead of plain integer in qos.c PM / QoS: Use NULL pointer instead of plain integer in pm_qos.h PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock PM / Sleep: Add missing static storage class specifiers in main.c cpuilde / ACPI: remove time from acpi_processor_cx structure cpuidle / ACPI: remove usage from acpi_processor_cx structure cpuidle / ACPI : remove latency_ticks from acpi_processor_cx structure rtc-cmos: report wakeups from interrupt handler PM / Sleep: Fix build warning in sysfs.c for CONFIG_PM_SLEEP unset PM / Domains: Fix build warning for CONFIG_PM_RUNTIME unset olpc-xo15-sci: Use struct dev_pm_ops for power management PM / Domains: Replace plain integer with NULL pointer in domain.c file PM / Domains: Add missing static storage class specifier in domain.c file PM / crypto / ux500: Use struct dev_pm_ops for power management PM / IPMI: Remove empty legacy PCI PM callbacks tpm_nsc: Use struct dev_pm_ops for power management tpm_tis: Use struct dev_pm_ops for power management ...
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r--drivers/acpi/battery.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 7dd3f9fb9f3f..023f9c8534d0 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -1044,17 +1044,24 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
1044} 1044}
1045 1045
1046/* this is needed to learn about changes made in suspended state */ 1046/* this is needed to learn about changes made in suspended state */
1047static int acpi_battery_resume(struct acpi_device *device) 1047static int acpi_battery_resume(struct device *dev)
1048{ 1048{
1049 struct acpi_battery *battery; 1049 struct acpi_battery *battery;
1050 if (!device) 1050
1051 if (!dev)
1051 return -EINVAL; 1052 return -EINVAL;
1052 battery = acpi_driver_data(device); 1053
1054 battery = acpi_driver_data(to_acpi_device(dev));
1055 if (!battery)
1056 return -EINVAL;
1057
1053 battery->update_time = 0; 1058 battery->update_time = 0;
1054 acpi_battery_update(battery); 1059 acpi_battery_update(battery);
1055 return 0; 1060 return 0;
1056} 1061}
1057 1062
1063static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
1064
1058static struct acpi_driver acpi_battery_driver = { 1065static struct acpi_driver acpi_battery_driver = {
1059 .name = "battery", 1066 .name = "battery",
1060 .class = ACPI_BATTERY_CLASS, 1067 .class = ACPI_BATTERY_CLASS,
@@ -1062,10 +1069,10 @@ static struct acpi_driver acpi_battery_driver = {
1062 .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, 1069 .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
1063 .ops = { 1070 .ops = {
1064 .add = acpi_battery_add, 1071 .add = acpi_battery_add,
1065 .resume = acpi_battery_resume,
1066 .remove = acpi_battery_remove, 1072 .remove = acpi_battery_remove,
1067 .notify = acpi_battery_notify, 1073 .notify = acpi_battery_notify,
1068 }, 1074 },
1075 .drv.pm = &acpi_battery_pm,
1069}; 1076};
1070 1077
1071static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) 1078static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)