Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f112cee authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

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: default avatarRafael J. Wysocki <rjw@sisk.pl>
Tested-by: default avatarShriram Rajagopalan <rshriram@cs.ubc.ca>
parent b42282e5
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -527,7 +527,7 @@ static int ibmebus_bus_pm_resume_noirq(struct device *dev)

#endif /* !CONFIG_SUSPEND */

#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS

static int ibmebus_bus_pm_freeze(struct device *dev)
{
@@ -665,7 +665,7 @@ static int ibmebus_bus_pm_restore_noirq(struct device *dev)
	return ret;
}

#else /* !CONFIG_HIBERNATION */
#else /* !CONFIG_HIBERNATE_CALLBACKS */

#define ibmebus_bus_pm_freeze		NULL
#define ibmebus_bus_pm_thaw		NULL
@@ -676,7 +676,7 @@ static int ibmebus_bus_pm_restore_noirq(struct device *dev)
#define ibmebus_bus_pm_poweroff_noirq	NULL
#define ibmebus_bus_pm_restore_noirq	NULL

#endif /* !CONFIG_HIBERNATION */
#endif /* !CONFIG_HIBERNATE_CALLBACKS */

static struct dev_pm_ops ibmebus_bus_dev_pm_ops = {
	.prepare = ibmebus_bus_pm_prepare,
+3 −3
Original line number Diff line number Diff line
@@ -214,7 +214,7 @@ static int amba_pm_resume_noirq(struct device *dev)

#endif /* !CONFIG_SUSPEND */

#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS

static int amba_pm_freeze(struct device *dev)
{
@@ -352,7 +352,7 @@ static int amba_pm_restore_noirq(struct device *dev)
	return ret;
}

#else /* !CONFIG_HIBERNATION */
#else /* !CONFIG_HIBERNATE_CALLBACKS */

#define amba_pm_freeze		NULL
#define amba_pm_thaw		NULL
@@ -363,7 +363,7 @@ static int amba_pm_restore_noirq(struct device *dev)
#define amba_pm_poweroff_noirq	NULL
#define amba_pm_restore_noirq	NULL

#endif /* !CONFIG_HIBERNATION */
#endif /* !CONFIG_HIBERNATE_CALLBACKS */

#ifdef CONFIG_PM

+3 −3
Original line number Diff line number Diff line
@@ -771,7 +771,7 @@ int __weak platform_pm_resume_noirq(struct device *dev)

#endif /* !CONFIG_SUSPEND */

#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS

static int platform_pm_freeze(struct device *dev)
{
@@ -909,7 +909,7 @@ static int platform_pm_restore_noirq(struct device *dev)
	return ret;
}

#else /* !CONFIG_HIBERNATION */
#else /* !CONFIG_HIBERNATE_CALLBACKS */

#define platform_pm_freeze		NULL
#define platform_pm_thaw		NULL
@@ -920,7 +920,7 @@ static int platform_pm_restore_noirq(struct device *dev)
#define platform_pm_poweroff_noirq	NULL
#define platform_pm_restore_noirq	NULL

#endif /* !CONFIG_HIBERNATION */
#endif /* !CONFIG_HIBERNATE_CALLBACKS */

#ifdef CONFIG_PM_RUNTIME

+4 −4
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ static int pm_op(struct device *dev,
		}
		break;
#endif /* CONFIG_SUSPEND */
#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS
	case PM_EVENT_FREEZE:
	case PM_EVENT_QUIESCE:
		if (ops->freeze) {
@@ -260,7 +260,7 @@ static int pm_op(struct device *dev,
			suspend_report_result(ops->restore, error);
		}
		break;
#endif /* CONFIG_HIBERNATION */
#endif /* CONFIG_HIBERNATE_CALLBACKS */
	default:
		error = -EINVAL;
	}
@@ -308,7 +308,7 @@ static int pm_noirq_op(struct device *dev,
		}
		break;
#endif /* CONFIG_SUSPEND */
#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS
	case PM_EVENT_FREEZE:
	case PM_EVENT_QUIESCE:
		if (ops->freeze_noirq) {
@@ -335,7 +335,7 @@ static int pm_noirq_op(struct device *dev,
			suspend_report_result(ops->restore_noirq, error);
		}
		break;
#endif /* CONFIG_HIBERNATION */
#endif /* CONFIG_HIBERNATE_CALLBACKS */
	default:
		error = -EINVAL;
	}
+3 −3
Original line number Diff line number Diff line
@@ -781,7 +781,7 @@ static int pci_pm_resume(struct device *dev)

#endif /* !CONFIG_SUSPEND */

#ifdef CONFIG_HIBERNATION
#ifdef CONFIG_HIBERNATE_CALLBACKS

static int pci_pm_freeze(struct device *dev)
{
@@ -970,7 +970,7 @@ static int pci_pm_restore(struct device *dev)
	return error;
}

#else /* !CONFIG_HIBERNATION */
#else /* !CONFIG_HIBERNATE_CALLBACKS */

#define pci_pm_freeze		NULL
#define pci_pm_freeze_noirq	NULL
@@ -981,7 +981,7 @@ static int pci_pm_restore(struct device *dev)
#define pci_pm_restore		NULL
#define pci_pm_restore_noirq	NULL

#endif /* !CONFIG_HIBERNATION */
#endif /* !CONFIG_HIBERNATE_CALLBACKS */

#ifdef CONFIG_PM_RUNTIME

Loading