aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/power/main.c14
-rw-r--r--drivers/usb/core/driver.c6
-rw-r--r--include/linux/device.h4
-rw-r--r--include/linux/pm.h2
4 files changed, 15 insertions, 11 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index aa6320207745..bf5a59ac1957 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -57,7 +57,7 @@ static int async_error;
57 */ 57 */
58void device_pm_init(struct device *dev) 58void device_pm_init(struct device *dev)
59{ 59{
60 dev->power.in_suspend = false; 60 dev->power.is_prepared = false;
61 init_completion(&dev->power.completion); 61 init_completion(&dev->power.completion);
62 complete_all(&dev->power.completion); 62 complete_all(&dev->power.completion);
63 dev->power.wakeup = NULL; 63 dev->power.wakeup = NULL;
@@ -91,7 +91,7 @@ void device_pm_add(struct device *dev)
91 pr_debug("PM: Adding info for %s:%s\n", 91 pr_debug("PM: Adding info for %s:%s\n",
92 dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); 92 dev->bus ? dev->bus->name : "No Bus", dev_name(dev));
93 mutex_lock(&dpm_list_mtx); 93 mutex_lock(&dpm_list_mtx);
94 if (dev->parent && dev->parent->power.in_suspend) 94 if (dev->parent && dev->parent->power.is_prepared)
95 dev_warn(dev, "parent %s should not be sleeping\n", 95 dev_warn(dev, "parent %s should not be sleeping\n",
96 dev_name(dev->parent)); 96 dev_name(dev->parent));
97 list_add_tail(&dev->power.entry, &dpm_list); 97 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 dpm_wait(dev->parent, async); 511 dpm_wait(dev->parent, async);
512 device_lock(dev); 512 device_lock(dev);
513 513
514 dev->power.in_suspend = false; 514 /*
515 * This is a fib. But we'll allow new children to be added below
516 * a resumed device, even if the device hasn't been completed yet.
517 */
518 dev->power.is_prepared = false;
515 519
516 if (dev->pwr_domain) { 520 if (dev->pwr_domain) {
517 pm_dev_dbg(dev, state, "power domain "); 521 pm_dev_dbg(dev, state, "power domain ");
@@ -670,7 +674,7 @@ void dpm_complete(pm_message_t state)
670 struct device *dev = to_device(dpm_prepared_list.prev); 674 struct device *dev = to_device(dpm_prepared_list.prev);
671 675
672 get_device(dev); 676 get_device(dev);
673 dev->power.in_suspend = false; 677 dev->power.is_prepared = false;
674 list_move(&dev->power.entry, &list); 678 list_move(&dev->power.entry, &list);
675 mutex_unlock(&dpm_list_mtx); 679 mutex_unlock(&dpm_list_mtx);
676 680
@@ -1042,7 +1046,7 @@ int dpm_prepare(pm_message_t state)
1042 put_device(dev); 1046 put_device(dev);
1043 break; 1047 break;
1044 } 1048 }
1045 dev->power.in_suspend = true; 1049 dev->power.is_prepared = true;
1046 if (!list_empty(&dev->power.entry)) 1050 if (!list_empty(&dev->power.entry))
1047 list_move_tail(&dev->power.entry, &dpm_prepared_list); 1051 list_move_tail(&dev->power.entry, &dpm_prepared_list);
1048 put_device(dev); 1052 put_device(dev);
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index e35a17687c05..aa3cc465a601 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -375,7 +375,7 @@ static int usb_unbind_interface(struct device *dev)
375 * Just re-enable it without affecting the endpoint toggles. 375 * Just re-enable it without affecting the endpoint toggles.
376 */ 376 */
377 usb_enable_interface(udev, intf, false); 377 usb_enable_interface(udev, intf, false);
378 } else if (!error && !intf->dev.power.in_suspend) { 378 } else if (!error && !intf->dev.power.is_prepared) {
379 r = usb_set_interface(udev, intf->altsetting[0]. 379 r = usb_set_interface(udev, intf->altsetting[0].
380 desc.bInterfaceNumber, 0); 380 desc.bInterfaceNumber, 0);
381 if (r < 0) 381 if (r < 0)
@@ -960,7 +960,7 @@ void usb_rebind_intf(struct usb_interface *intf)
960 } 960 }
961 961
962 /* Try to rebind the interface */ 962 /* Try to rebind the interface */
963 if (!intf->dev.power.in_suspend) { 963 if (!intf->dev.power.is_prepared) {
964 intf->needs_binding = 0; 964 intf->needs_binding = 0;
965 rc = device_attach(&intf->dev); 965 rc = device_attach(&intf->dev);
966 if (rc < 0) 966 if (rc < 0)
@@ -1107,7 +1107,7 @@ static int usb_resume_interface(struct usb_device *udev,
1107 if (intf->condition == USB_INTERFACE_UNBOUND) { 1107 if (intf->condition == USB_INTERFACE_UNBOUND) {
1108 1108
1109 /* Carry out a deferred switch to altsetting 0 */ 1109 /* Carry out a deferred switch to altsetting 0 */
1110 if (intf->needs_altsetting0 && !intf->dev.power.in_suspend) { 1110 if (intf->needs_altsetting0 && !intf->dev.power.is_prepared) {
1111 usb_set_interface(udev, intf->altsetting[0]. 1111 usb_set_interface(udev, intf->altsetting[0].
1112 desc.bInterfaceNumber, 0); 1112 desc.bInterfaceNumber, 0);
1113 intf->needs_altsetting0 = 0; 1113 intf->needs_altsetting0 = 0;
diff --git a/include/linux/device.h b/include/linux/device.h
index c66111affca9..553fd37b173b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -654,13 +654,13 @@ static inline int device_is_registered(struct device *dev)
654 654
655static inline void device_enable_async_suspend(struct device *dev) 655static inline void device_enable_async_suspend(struct device *dev)
656{ 656{
657 if (!dev->power.in_suspend) 657 if (!dev->power.is_prepared)
658 dev->power.async_suspend = true; 658 dev->power.async_suspend = true;
659} 659}
660 660
661static inline void device_disable_async_suspend(struct device *dev) 661static inline void device_disable_async_suspend(struct device *dev)
662{ 662{
663 if (!dev->power.in_suspend) 663 if (!dev->power.is_prepared)
664 dev->power.async_suspend = false; 664 dev->power.async_suspend = false;
665} 665}
666 666
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 3160648ccdda..cc536bd80984 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -425,7 +425,7 @@ struct dev_pm_info {
425 pm_message_t power_state; 425 pm_message_t power_state;
426 unsigned int can_wakeup:1; 426 unsigned int can_wakeup:1;
427 unsigned int async_suspend:1; 427 unsigned int async_suspend:1;
428 unsigned int in_suspend:1; /* Owned by the PM core */ 428 bool is_prepared:1; /* Owned by the PM core */
429 spinlock_t lock; 429 spinlock_t lock;
430#ifdef CONFIG_PM_SLEEP 430#ifdef CONFIG_PM_SLEEP
431 struct list_head entry; 431 struct list_head entry;