/** * store_hibernate - Initiate partition hibernation * @dev: subsys root device * @attr: device attribute struct * @buf: buffer * @count: buffer size * * Write the stream ID received from the HMC to this file * to trigger hibernating the partition * * Return value: * number of bytes printed to buffer / other on failure **/ static ssize_t store_hibernate(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int rc; if (!capable(CAP_SYS_ADMIN)) return -EPERM; stream_id = simple_strtoul(buf, NULL, 16); do { rc = pseries_suspend_begin(PM_SUSPEND_MEM); if (rc == -EAGAIN) ssleep(1); } while (rc == -EAGAIN); if (!rc) rc = pm_suspend(PM_SUSPEND_MEM); stream_id = 0; if (!rc) rc = count; return rc; }
/** * store_hibernate - Initiate partition hibernation * @classdev: sysdev class struct * @attr: class device attribute struct * @buf: buffer * @count: buffer size * * Write the stream ID received from the HMC to this file * to trigger hibernating the partition * * Return value: * number of bytes printed to buffer / other on failure **/ static ssize_t store_hibernate(struct sysdev_class *classdev, const char *buf, size_t count) { int rc; if (!capable(CAP_SYS_ADMIN)) return -EPERM; stream_id = simple_strtoul(buf, NULL, 16); do { rc = pseries_suspend_begin(PM_SUSPEND_MEM); if (rc == -EAGAIN) ssleep(1); } while (rc == -EAGAIN); if (!rc) { stop_topology_update(); rc = pm_suspend(PM_SUSPEND_MEM); start_topology_update(); } stream_id = 0; if (!rc) rc = count; return rc; }