aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-04-11 16:54:42 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-04-11 16:54:42 -0400
commit1f112cee07b314e244ee9e71d9c1e6950dc13327 (patch)
treee089e646c78701e37b4ebe00db36082e47cab2d5 /drivers/base
parentb42282e5a05018ecdc0d63a4ad530b0999785912 (diff)
PM / Hibernate: Introduce CONFIG_HIBERNATE_CALLBACKS
Xen save/restore is going to use hibernate device callbacks for quiescing devices and putting them back to normal operations and it would need to select CONFIG_HIBERNATION for this purpose. However, that also would cause the hibernate interfaces for user space to be enabled, which might confuse user space, because the Xen kernels don't support hibernation. Moreover, it would be wasteful, as it would make the Xen kernels include a substantial amount of code that they would never use. To address this issue introduce new power management Kconfig option CONFIG_HIBERNATE_CALLBACKS, such that it will only select the code that is necessary for the hibernate device callbacks to work and make CONFIG_HIBERNATION select it. Then, Xen save/restore will be able to select CONFIG_HIBERNATE_CALLBACKS without dragging the entire hibernate code along with it. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Tested-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/platform.c6
-rw-r--r--drivers/base/power/main.c8
2 files changed, 7 insertions, 7 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index f051cfff18a..92792313d24 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -771,7 +771,7 @@ int __weak platform_pm_resume_noirq(struct device *dev)
771 771
772#endif /* !CONFIG_SUSPEND */ 772#endif /* !CONFIG_SUSPEND */
773 773
774#ifdef CONFIG_HIBERNATION 774#ifdef CONFIG_HIBERNATE_CALLBACKS
775 775
776static int platform_pm_freeze(struct device *dev) 776static int platform_pm_freeze(struct device *dev)
777{ 777{
@@ -909,7 +909,7 @@ static int platform_pm_restore_noirq(struct device *dev)
909 return ret; 909 return ret;
910} 910}
911 911
912#else /* !CONFIG_HIBERNATION */ 912#else /* !CONFIG_HIBERNATE_CALLBACKS */
913 913
914#define platform_pm_freeze NULL 914#define platform_pm_freeze NULL
915#define platform_pm_thaw NULL 915#define platform_pm_thaw NULL
@@ -920,7 +920,7 @@ static int platform_pm_restore_noirq(struct device *dev)
920#define platform_pm_poweroff_noirq NULL 920#define platform_pm_poweroff_noirq NULL
921#define platform_pm_restore_noirq NULL 921#define platform_pm_restore_noirq NULL
922 922
923#endif /* !CONFIG_HIBERNATION */ 923#endif /* !CONFIG_HIBERNATE_CALLBACKS */
924 924
925#ifdef CONFIG_PM_RUNTIME 925#ifdef CONFIG_PM_RUNTIME
926 926
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 052dc53eef3..fbc5b6e7c59 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -233,7 +233,7 @@ static int pm_op(struct device *dev,
233 } 233 }
234 break; 234 break;
235#endif /* CONFIG_SUSPEND */ 235#endif /* CONFIG_SUSPEND */
236#ifdef CONFIG_HIBERNATION 236#ifdef CONFIG_HIBERNATE_CALLBACKS
237 case PM_EVENT_FREEZE: 237 case PM_EVENT_FREEZE:
238 case PM_EVENT_QUIESCE: 238 case PM_EVENT_QUIESCE:
239 if (ops->freeze) { 239 if (ops->freeze) {
@@ -260,7 +260,7 @@ static int pm_op(struct device *dev,
260 suspend_report_result(ops->restore, error); 260 suspend_report_result(ops->restore, error);
261 } 261 }
262 break; 262 break;
263#endif /* CONFIG_HIBERNATION */ 263#endif /* CONFIG_HIBERNATE_CALLBACKS */
264 default: 264 default:
265 error = -EINVAL; 265 error = -EINVAL;
266 } 266 }
@@ -308,7 +308,7 @@ static int pm_noirq_op(struct device *dev,
308 } 308 }
309 break; 309 break;
310#endif /* CONFIG_SUSPEND */ 310#endif /* CONFIG_SUSPEND */
311#ifdef CONFIG_HIBERNATION 311#ifdef CONFIG_HIBERNATE_CALLBACKS
312 case PM_EVENT_FREEZE: 312 case PM_EVENT_FREEZE:
313 case PM_EVENT_QUIESCE: 313 case PM_EVENT_QUIESCE:
314 if (ops->freeze_noirq) { 314 if (ops->freeze_noirq) {
@@ -335,7 +335,7 @@ static int pm_noirq_op(struct device *dev,
335 suspend_report_result(ops->restore_noirq, error); 335 suspend_report_result(ops->restore_noirq, error);
336 } 336 }
337 break; 337 break;
338#endif /* CONFIG_HIBERNATION */ 338#endif /* CONFIG_HIBERNATE_CALLBACKS */
339 default: 339 default:
340 error = -EINVAL; 340 error = -EINVAL;
341 } 341 }