[PATCH v2 3/4] usb: introduce usb_set_reset_resume

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

 



In preparation for moving hub power management logic to its own file and
removing instances of #ifdef CONFIG_PM in hub.c, introduce a
usb_set_reset_resume() helper.

Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
---
 drivers/usb/core/hub.c |    5 ++---
 include/linux/usb.h    |   11 +++++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index c8916969d76c..63b1963620a3 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1172,9 +1172,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
 				set_bit(port1, hub->change_bits);
 
 		} else if (udev->persist_enabled) {
-#ifdef CONFIG_PM
-			udev->reset_resume = 1;
-#endif
+			usb_set_reset_resume(udev);
+
 			/* Don't set the change_bits when the device
 			 * was powered off.
 			 */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d2465bc0e73c..909b56380c2f 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -592,6 +592,17 @@ struct usb_device {
 };
 #define	to_usb_device(d) container_of(d, struct usb_device, dev)
 
+#ifdef CONFIG_PM
+static inline void usb_set_reset_resume(struct usb_device *udev)
+{
+	udev->reset_resume = 1;
+}
+#else
+static inline void usb_set_reset_resume(struct usb_device *udev)
+{
+}
+#endif
+
 static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf)
 {
 	return to_usb_device(intf->dev.parent);

--
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