ChangeSet 1.2181.4.41, 2005/03/21 15:04:00-08:00, [EMAIL PROTECTED]

        [PATCH] USBcore updates
        
        This is the fourth of five updates to usbcore:
        
                Add a new usb_hcd_resume_root_hub function for use by HCDs in
                processing resume requests from their root hubs.  No calls to
                this new routine are in the patch but they will be added in
                due course.
        
        Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
        Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>



 hcd.c |   24 ++++++++++++++++++++++++
 hcd.h |    2 ++
 hub.c |   14 ++++++++++++++
 hub.h |    1 +
 usb.h |    1 +
 5 files changed, 42 insertions(+)


diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c    2005-03-30 15:12:50 -08:00
+++ b/drivers/usb/core/hcd.c    2005-03-30 15:12:50 -08:00
@@ -1442,7 +1442,31 @@
        return 0;
 }
 
+/**
+ * usb_hcd_resume_root_hub - called by HCD to resume its root hub 
+ * @hcd: host controller for this root hub
+ *
+ * The USB host controller calls this function when its root hub is
+ * suspended (with the remote wakeup feature enabled) and a remote
+ * wakeup request is received.  It queues a request for khubd to
+ * resume the root hub.
+ */
+void usb_hcd_resume_root_hub (struct usb_hcd *hcd)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave (&hcd_root_hub_lock, flags);
+       if (hcd->rh_registered)
+               usb_resume_root_hub (hcd->self.root_hub);
+       spin_unlock_irqrestore (&hcd_root_hub_lock, flags);
+}
+
+#else
+void usb_hcd_resume_root_hub (struct usb_hcd *hcd)
+{
+}
 #endif
+EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub);
 
 /*-------------------------------------------------------------------------*/
 
diff -Nru a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
--- a/drivers/usb/core/hcd.h    2005-03-30 15:12:50 -08:00
+++ b/drivers/usb/core/hcd.h    2005-03-30 15:12:50 -08:00
@@ -344,6 +344,8 @@
 extern int usb_hcd_register_root_hub (struct usb_device *usb_dev,
                struct usb_hcd *hcd);
 
+extern void usb_hcd_resume_root_hub (struct usb_hcd *hcd);
+
 extern void usb_set_device_state(struct usb_device *udev,
                enum usb_device_state new_state);
 
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c    2005-03-30 15:12:50 -08:00
+++ b/drivers/usb/core/hub.c    2005-03-30 15:12:50 -08:00
@@ -1961,10 +1961,19 @@
        }
        intf->dev.power.power_state = PMSG_ON;
 
+       hub->resume_root_hub = 0;
        hub_activate(hub);
        return 0;
 }
 
+void usb_resume_root_hub(struct usb_device *hdev)
+{
+       struct usb_hub *hub = hdev_to_hub(hdev);
+
+       hub->resume_root_hub = 1;
+       kick_khubd(hub);
+}
+
 #else  /* !CONFIG_USB_SUSPEND */
 
 int usb_suspend_device(struct usb_device *udev, u32 state)
@@ -2621,7 +2630,12 @@
                                (u16) hub->event_bits[0]);
 
                usb_get_intf(intf);
+               i = hub->resume_root_hub;
                spin_unlock_irq(&hub_event_lock);
+
+               /* Is this is a root hub wanting to be resumed? */
+               if (i)
+                       usb_resume_device(hdev);
 
                /* Lock the device, then check to see if we were
                 * disconnected while waiting for the lock to succeed. */
diff -Nru a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
--- a/drivers/usb/core/hub.h    2005-03-30 15:12:50 -08:00
+++ b/drivers/usb/core/hub.h    2005-03-30 15:12:50 -08:00
@@ -217,6 +217,7 @@
 
        unsigned                quiescing:1;
        unsigned                activating:1;
+       unsigned                resume_root_hub:1;
 
        unsigned                has_indicators:1;
        enum hub_led_mode       indicator[USB_MAXCHILDREN];
diff -Nru a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
--- a/drivers/usb/core/usb.h    2005-03-30 15:12:50 -08:00
+++ b/drivers/usb/core/usb.h    2005-03-30 15:12:50 -08:00
@@ -19,6 +19,7 @@
 extern void usb_unlock_all_devices(void);
 
 extern void usb_kick_khubd(struct usb_device *dev);
+extern void usb_resume_root_hub(struct usb_device *dev);
 
 /* for labeling diagnostics */
 extern const char *usbcore_name;
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to