[PATCH v2 10/14] USB: notify pm_runtime on change to ->persist_enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When this setting is changed it may require the parent port to keep
power on, or allow it to turn power off.  In any event we want
pm_runtime to re-evaluate.

Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
---
 drivers/usb/core/sysfs.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 52a97adf02a0..743248da1ec3 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -303,9 +303,12 @@ static ssize_t persist_store(struct device *dev, struct device_attribute *attr,
 	if (sscanf(buf, "%d", &value) != 1)
 		return -EINVAL;
 
+	pm_runtime_get_sync(dev);
 	usb_lock_device(udev);
 	udev->persist_enabled = !!value;
 	usb_unlock_device(udev);
+	pm_runtime_put_sync(dev);
+
 	return count;
 }
 static DEVICE_ATTR_RW(persist);

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux