This is a note to let you know that I've just added the patch titled

     Subject: [PATCH 1/6] OHCI: make autostop conditional on CONFIG_PM

to my gregkh-2.6 tree.  Its filename is

     ohci-make-autostop-conditional-on-config_pm.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


>From [EMAIL PROTECTED] Mon Nov 20 08:07:11 2006
Date: Mon, 20 Nov 2006 11:06:59 -0500 (EST)
From: Alan Stern <[EMAIL PROTECTED]>
To: Greg KH <[EMAIL PROTECTED]>
cc: USB development list <linux-usb-devel@lists.sourceforge.net>
Subject: [PATCH 1/6] OHCI: make autostop conditional on CONFIG_PM
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

Unlike UHCI, OHCI does not exert any DMA load on the system when no
devices are connected.  Consequently there is no advantage to doing
an autostop other than the power savings, so we shouldn't compile the
necessary code unless CONFIG_PM is enabled.

This patch (as820) makes the root-hub suspend and resume routines
conditional on CONFIG_PM.  It also prevents autostop from activating
if the device_may_wakeup flag isn't set; some people use this flag to
alert the driver about Resume-Detect bugs in the hardware.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/usb/host/ohci-hub.c |  133 ++++++++++++++++++++++++++------------------
 1 file changed, 79 insertions(+), 54 deletions(-)

--- gregkh-2.6.orig/drivers/usb/host/ohci-hub.c
+++ gregkh-2.6/drivers/usb/host/ohci-hub.c
@@ -56,7 +56,6 @@ static void finish_unlinks (struct ohci_
 
 #ifdef CONFIG_PM
 static int ohci_restart(struct ohci_hcd *ohci);
-#endif
 
 static int ohci_rh_suspend (struct ohci_hcd *ohci, int autostop)
 __releases(ohci->lock)
@@ -187,7 +186,6 @@ __acquires(ohci->lock)
                ohci_dbg (ohci, "lost power\n");
                status = -EBUSY;
        }
-#ifdef CONFIG_PM
        if (status == -EBUSY) {
                if (!autostopped) {
                        spin_unlock_irq (&ohci->lock);
@@ -197,7 +195,6 @@ __acquires(ohci->lock)
                }
                return status;
        }
-#endif
        if (status != -EINPROGRESS)
                return status;
        if (autostopped)
@@ -291,8 +288,6 @@ skip_resume:
        return 0;
 }
 
-#ifdef CONFIG_PM
-
 static int ohci_bus_suspend (struct usb_hcd *hcd)
 {
        struct ohci_hcd         *ohci = hcd_to_ohci (hcd);
@@ -330,6 +325,83 @@ static int ohci_bus_resume (struct usb_h
        return rc;
 }
 
+/* Carry out polling-, autostop-, and autoresume-related state changes */
+static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
+               int any_connected)
+{
+       int     poll_rh = 1;
+
+       switch (ohci->hc_control & OHCI_CTRL_HCFS) {
+
+       case OHCI_USB_OPER:
+               /* keep on polling until we know a device is connected
+                * and RHSC is enabled */
+               if (!ohci->autostop) {
+                       if (any_connected ||
+                                       !device_may_wakeup(&ohci_to_hcd(ohci)
+                                               ->self.root_hub->dev)) {
+                               if (ohci_readl(ohci, &ohci->regs->intrenable) &
+                                               OHCI_INTR_RHSC)
+                                       poll_rh = 0;
+                       } else {
+                               ohci->autostop = 1;
+                               ohci->next_statechange = jiffies + HZ;
+                       }
+
+               /* if no devices have been attached for one second, autostop */
+               } else {
+                       if (changed || any_connected) {
+                               ohci->autostop = 0;
+                               ohci->next_statechange = jiffies +
+                                               STATECHANGE_DELAY;
+                       } else if (time_after_eq(jiffies,
+                                               ohci->next_statechange)
+                                       && !ohci->ed_rm_list
+                                       && !(ohci->hc_control &
+                                               OHCI_SCHED_ENABLES)) {
+                               ohci_rh_suspend(ohci, 1);
+                       }
+               }
+               break;
+
+       /* if there is a port change, autostart or ask to be resumed */
+       case OHCI_USB_SUSPEND:
+       case OHCI_USB_RESUME:
+               if (changed) {
+                       if (ohci->autostop)
+                               ohci_rh_resume(ohci);
+                       else
+                               usb_hcd_resume_root_hub(ohci_to_hcd(ohci));
+               } else {
+                       /* everything is idle, no need for polling */
+                       poll_rh = 0;
+               }
+               break;
+       }
+       return poll_rh;
+}
+
+#else  /* CONFIG_PM */
+
+static inline int ohci_rh_resume(struct ohci_hcd *ohci)
+{
+       return 0;
+}
+
+/* Carry out polling-related state changes.
+ * autostop isn't used when CONFIG_PM is turned off.
+ */
+static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
+               int any_connected)
+{
+       int     poll_rh = 1;
+
+       /* keep on polling until RHSC is enabled */
+       if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC)
+               poll_rh = 0;
+       return poll_rh;
+}
+
 #endif /* CONFIG_PM */
 
 /*-------------------------------------------------------------------------*/
@@ -382,55 +454,8 @@ ohci_hub_status_data (struct usb_hcd *hc
                }
        }
 
-       hcd->poll_rh = 1;
-
-       /* carry out appropriate state changes */
-       switch (ohci->hc_control & OHCI_CTRL_HCFS) {
-
-       case OHCI_USB_OPER:
-               /* keep on polling until we know a device is connected
-                * and RHSC is enabled */
-               if (!ohci->autostop) {
-                       if (any_connected) {
-                               if (ohci_readl(ohci, &ohci->regs->intrenable) &
-                                               OHCI_INTR_RHSC)
-                                       hcd->poll_rh = 0;
-                       } else {
-                               ohci->autostop = 1;
-                               ohci->next_statechange = jiffies + HZ;
-                       }
-
-               /* if no devices have been attached for one second, autostop */
-               } else {
-                       if (changed || any_connected) {
-                               ohci->autostop = 0;
-                               ohci->next_statechange = jiffies +
-                                               STATECHANGE_DELAY;
-                       } else if (device_may_wakeup(&hcd->self.root_hub->dev)
-                                       && time_after_eq(jiffies,
-                                               ohci->next_statechange)
-                                       && !ohci->ed_rm_list
-                                       && !(ohci->hc_control &
-                                               OHCI_SCHED_ENABLES)) {
-                               ohci_rh_suspend (ohci, 1);
-                       }
-               }
-               break;
-
-       /* if there is a port change, autostart or ask to be resumed */
-       case OHCI_USB_SUSPEND:
-       case OHCI_USB_RESUME:
-               if (changed) {
-                       if (ohci->autostop)
-                               ohci_rh_resume (ohci);
-                       else
-                               usb_hcd_resume_root_hub (hcd);
-               } else {
-                       /* everything is idle, no need for polling */
-                       hcd->poll_rh = 0;
-               }
-               break;
-       }
+       hcd->poll_rh = ohci_root_hub_state_changes(ohci, changed,
+                       any_connected);
 
 done:
        spin_unlock_irqrestore (&ohci->lock, flags);


Patches currently in gregkh-2.6 which might be from [EMAIL PROTECTED] are

usb/usb-hid-handle-stall-on-interrupt-endpoint.patch
usb/usb-resume_device-symbol-conflict.patch
usb/usb-expand-autosuspend-autoresume-api.patch
usb/usb-add-autosuspend-support-to-the-hub-driver.patch
usb/ehci-hcd-fix-budget_pool-allocation-for-machines-with-multiple-ehci-controllers.patch
usb/usb-core-don-t-match-interface-descriptors-for-vendor-specific-devices.patch
usb/usb-takes-31-devices-per-hub.patch
usb/usb-hub-root-hub-code-takes-more-than-15-devices.patch
usb/usb-ohci-disable-rhsc-inside-interrupt-handler.patch
usb/usb-ohci-hcd-fix-compiler-warning.patch
usb/usb-ohci-remove-stale-testing-code-from-root-hub-resume.patch
usb/usb-autosuspend-code-consolidation.patch
usb/usb-move-private-hub-declarations-out-of-public-header-file.patch
usb/ehci-fix-memory-pool-name-allocation.patch
usb/ehci-fix-root-hub-and-port-suspend-resume-problems.patch
usb/usb-core-fix-compiler-warning-about-usb_autosuspend_work.patch
usb/usb-net2280-don-t-send-unwanted-zero-length-packets.patch
usb/ohci-change-priority-level-of-resume-log-message.patch
usb/usb-hub-simplify-remote-wakeup-handling.patch
usb/usb-keep-count-of-unsuspended-children.patch
usb/usb-struct-usb_device-change-flag-to-bitflag.patch
usb/usbcore-remove-unused-argument-in-autosuspend.patch
usb/ohci-make-autostop-conditional-on-config_pm.patch

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to