Commit f76b168b authored by Alan Stern's avatar Alan Stern Committed by Rafael J. Wysocki

PM: Rename dev_pm_info.in_suspend to is_prepared

This patch (as1473) renames the "in_suspend" field in struct
dev_pm_info to "is_prepared", in preparation for an upcoming change.
The new name is more descriptive of what the field really means.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Cc: stable@kernel.org
parent 78420884
...@@ -57,7 +57,7 @@ static int async_error; ...@@ -57,7 +57,7 @@ static int async_error;
*/ */
void device_pm_init(struct device *dev) void device_pm_init(struct device *dev)
{ {
dev->power.in_suspend = false; dev->power.is_prepared = false;
init_completion(&dev->power.completion); init_completion(&dev->power.completion);
complete_all(&dev->power.completion); complete_all(&dev->power.completion);
dev->power.wakeup = NULL; dev->power.wakeup = NULL;
...@@ -91,7 +91,7 @@ void device_pm_add(struct device *dev) ...@@ -91,7 +91,7 @@ void device_pm_add(struct device *dev)
pr_debug("PM: Adding info for %s:%s\n", pr_debug("PM: Adding info for %s:%s\n",
dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); dev->bus ? dev->bus->name : "No Bus", dev_name(dev));
mutex_lock(&dpm_list_mtx); mutex_lock(&dpm_list_mtx);
if (dev->parent && dev->parent->power.in_suspend) if (dev->parent && dev->parent->power.is_prepared)
dev_warn(dev, "parent %s should not be sleeping\n", dev_warn(dev, "parent %s should not be sleeping\n",
dev_name(dev->parent)); dev_name(dev->parent));
list_add_tail(&dev->power.entry, &dpm_list); list_add_tail(&dev->power.entry, &dpm_list);
...@@ -511,7 +511,11 @@ static int device_resume(struct device *dev, pm_message_t state, bool async) ...@@ -511,7 +511,11 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
dpm_wait(dev->parent, async); dpm_wait(dev->parent, async);
device_lock(dev); device_lock(dev);
dev->power.in_suspend = false; /*
* This is a fib. But we'll allow new children to be added below
* a resumed device, even if the device hasn't been completed yet.
*/
dev->power.is_prepared = false;
if (dev->pwr_domain) { if (dev->pwr_domain) {
pm_dev_dbg(dev, state, "power domain "); pm_dev_dbg(dev, state, "power domain ");
...@@ -670,7 +674,7 @@ void dpm_complete(pm_message_t state) ...@@ -670,7 +674,7 @@ void dpm_complete(pm_message_t state)
struct device *dev = to_device(dpm_prepared_list.prev); struct device *dev = to_device(dpm_prepared_list.prev);
get_device(dev); get_device(dev);
dev->power.in_suspend = false; dev->power.is_prepared = false;
list_move(&dev->power.entry, &list); list_move(&dev->power.entry, &list);
mutex_unlock(&dpm_list_mtx); mutex_unlock(&dpm_list_mtx);
...@@ -1042,7 +1046,7 @@ int dpm_prepare(pm_message_t state) ...@@ -1042,7 +1046,7 @@ int dpm_prepare(pm_message_t state)
put_device(dev); put_device(dev);
break; break;
} }
dev->power.in_suspend = true; dev->power.is_prepared = true;
if (!list_empty(&dev->power.entry)) if (!list_empty(&dev->power.entry))
list_move_tail(&dev->power.entry, &dpm_prepared_list); list_move_tail(&dev->power.entry, &dpm_prepared_list);
put_device(dev); put_device(dev);
......
...@@ -375,7 +375,7 @@ static int usb_unbind_interface(struct device *dev) ...@@ -375,7 +375,7 @@ static int usb_unbind_interface(struct device *dev)
* Just re-enable it without affecting the endpoint toggles. * Just re-enable it without affecting the endpoint toggles.
*/ */
usb_enable_interface(udev, intf, false); usb_enable_interface(udev, intf, false);
} else if (!error && !intf->dev.power.in_suspend) { } else if (!error && !intf->dev.power.is_prepared) {
r = usb_set_interface(udev, intf->altsetting[0]. r = usb_set_interface(udev, intf->altsetting[0].
desc.bInterfaceNumber, 0); desc.bInterfaceNumber, 0);
if (r < 0) if (r < 0)
...@@ -960,7 +960,7 @@ void usb_rebind_intf(struct usb_interface *intf) ...@@ -960,7 +960,7 @@ void usb_rebind_intf(struct usb_interface *intf)
} }
/* Try to rebind the interface */ /* Try to rebind the interface */
if (!intf->dev.power.in_suspend) { if (!intf->dev.power.is_prepared) {
intf->needs_binding = 0; intf->needs_binding = 0;
rc = device_attach(&intf->dev); rc = device_attach(&intf->dev);
if (rc < 0) if (rc < 0)
...@@ -1107,7 +1107,7 @@ static int usb_resume_interface(struct usb_device *udev, ...@@ -1107,7 +1107,7 @@ static int usb_resume_interface(struct usb_device *udev,
if (intf->condition == USB_INTERFACE_UNBOUND) { if (intf->condition == USB_INTERFACE_UNBOUND) {
/* Carry out a deferred switch to altsetting 0 */ /* Carry out a deferred switch to altsetting 0 */
if (intf->needs_altsetting0 && !intf->dev.power.in_suspend) { if (intf->needs_altsetting0 && !intf->dev.power.is_prepared) {
usb_set_interface(udev, intf->altsetting[0]. usb_set_interface(udev, intf->altsetting[0].
desc.bInterfaceNumber, 0); desc.bInterfaceNumber, 0);
intf->needs_altsetting0 = 0; intf->needs_altsetting0 = 0;
......
...@@ -654,13 +654,13 @@ static inline int device_is_registered(struct device *dev) ...@@ -654,13 +654,13 @@ static inline int device_is_registered(struct device *dev)
static inline void device_enable_async_suspend(struct device *dev) static inline void device_enable_async_suspend(struct device *dev)
{ {
if (!dev->power.in_suspend) if (!dev->power.is_prepared)
dev->power.async_suspend = true; dev->power.async_suspend = true;
} }
static inline void device_disable_async_suspend(struct device *dev) static inline void device_disable_async_suspend(struct device *dev)
{ {
if (!dev->power.in_suspend) if (!dev->power.is_prepared)
dev->power.async_suspend = false; dev->power.async_suspend = false;
} }
......
...@@ -425,7 +425,7 @@ struct dev_pm_info { ...@@ -425,7 +425,7 @@ struct dev_pm_info {
pm_message_t power_state; pm_message_t power_state;
unsigned int can_wakeup:1; unsigned int can_wakeup:1;
unsigned int async_suspend:1; unsigned int async_suspend:1;
unsigned int in_suspend:1; /* Owned by the PM core */ bool is_prepared:1; /* Owned by the PM core */
spinlock_t lock; spinlock_t lock;
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
struct list_head entry; struct list_head entry;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment