aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTyrel Datwyler <tyreld@linux.vnet.ibm.com>2014-02-19 15:56:54 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-03-06 23:54:50 -0500
commit9da3489210fe1870491b0cc49c0304994baa7e96 (patch)
treeee2ae2d35f9ddc92ae3a025637827b4ac242f7d9
parent6b36ba8492abd1c819e949e085cc547b062d8593 (diff)
powerpc/pseries: Expose in kernel device tree update to drmgr
Traditionally it has been drmgr's responsibilty to update the device tree through the /proc/ppc64/ofdt interface after a suspend/resume operation. This patchset however has modified suspend/resume ops to preform an update entirely in the kernel during the resume. Therefore, a mechanism is required to expose that information to drmgr. This patch adds a show function to the "hibernate" attribute that returns 1 if the kernel performs a device tree update after the resume and 0 otherwise. This allows newer versions of drmgr to avoid doing a second unnecessary device tree update. Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/platforms/pseries/suspend.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index 1d9c580ab772..b87b97849d4c 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -192,7 +192,30 @@ out:
192 return rc; 192 return rc;
193} 193}
194 194
195static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate); 195#define USER_DT_UPDATE 0
196#define KERN_DT_UPDATE 1
197
198/**
199 * show_hibernate - Report device tree update responsibilty
200 * @dev: subsys root device
201 * @attr: device attribute struct
202 * @buf: buffer
203 *
204 * Report whether a device tree update is performed by the kernel after a
205 * resume, or if drmgr must coordinate the update from user space.
206 *
207 * Return value:
208 * 0 if drmgr is to initiate update, and 1 otherwise
209 **/
210static ssize_t show_hibernate(struct device *dev,
211 struct device_attribute *attr,
212 char *buf)
213{
214 return sprintf(buf, "%d\n", KERN_DT_UPDATE);
215}
216
217static DEVICE_ATTR(hibernate, S_IWUSR | S_IRUGO,
218 show_hibernate, store_hibernate);
196 219
197static struct bus_type suspend_subsys = { 220static struct bus_type suspend_subsys = {
198 .name = "power", 221 .name = "power",