OK, here you go, with another build fix for good measure:

   - in <linux/pm.h>, adds device_pm_is_lowpower()

   - uses it to resolve OHCI/EHCI compile problem #ifdefflessly
     (when !CONFIG_PM && CONFIG_USB_DEBUG)

   - removes new i386 build warnings for MSEC_TO_JIFFIES

   - hub driver won't resubmit when it's suspended
     (and re-deletes broken comment)

That last one isn't actually a build fix

- Dave


--- 1.13/include/linux/pm.h     Thu Aug 21 11:47:27 2003
+++ edited/include/linux/pm.h   Fri May 14 15:05:32 2004
@@ -238,6 +238,16 @@
 #endif
 };
 
+static inline int
+device_pm_is_lowpower(struct dev_pm_info *info)
+{
+#ifdef CONFIG_PM
+       return info->power_state != 0;
+#else
+       return 0;
+#endif
+}
+
 extern void device_pm_set_parent(struct device * dev, struct device * parent);
 
 extern int device_suspend(u32 state);
--- 1.97/drivers/usb/core/hub.c Sun May  9 10:26:14 2004
+++ edited/drivers/usb/core/hub.c       Fri May 14 15:16:23 2004
@@ -266,6 +266,10 @@
        }
 
 resubmit:
+       if (device_pm_is_lowpower (&hub->intf->dev.power)) {
+               urb->status = -EHOSTUNREACH;
+               goto done;
+       }
        if ((status = usb_submit_urb (hub->urb, GFP_ATOMIC)) != 0
                        /* ENODEV means we raced disconnect() */
                        && status != -ENODEV)
@@ -1567,9 +1571,6 @@
        .id_table =     hub_id_table,
 };
 
-/*
- * This should be a separate module.
- */
 int usb_hub_init(void)
 {
        pid_t pid;
--- 1.33/drivers/usb/host/ehci-dbg.c    Fri May  7 12:48:33 2004
+++ edited/drivers/usb/host/ehci-dbg.c  Fri May 14 15:17:24 2004
@@ -639,7 +639,7 @@
 
        spin_lock_irqsave (&ehci->lock, flags);
 
-       if (bus->controller->power.power_state) {
+       if (device_pm_is_lowpower (&bus->controller->power)) {
                size = scnprintf (next, size,
                        "bus %s, device %s (driver " DRIVER_VERSION ")\n"
                        "SUSPENDED (no register access)\n",
--- 1.34/drivers/usb/host/ehci.h        Fri May  7 12:49:08 2004
+++ edited/drivers/usb/host/ehci.h      Fri May 14 15:59:07 2004
@@ -596,9 +596,12 @@
 
 /*-------------------------------------------------------------------------*/
 
+// FIXME temporary, while we phase in msec_to_jiffies
+#ifndef MSEC_TO_JIFFIES
 #define        MSEC_TO_JIFFIES(msec) ((HZ * (msec) + 999) / 1000)
+#endif
 
-static inline void msec_delay(int msec)
+static inline void msec_delay(unsigned msec)
 {
        set_current_state(TASK_UNINTERRUPTIBLE);
        schedule_timeout(MSEC_TO_JIFFIES(msec));
--- 1.26/drivers/usb/host/ohci-dbg.c    Tue May 11 13:17:33 2004
+++ edited/drivers/usb/host/ohci-dbg.c  Fri May 14 15:17:28 2004
@@ -623,7 +623,7 @@
                hcd->self.controller->bus_id,
                hcd_name);
 
-       if (bus->controller->power.power_state) {
+       if (device_pm_is_lowpower (&bus->controller->power)) {
                size -= scnprintf (next, size,
                        "SUSPENDED (no register access)\n");
                goto done;
--- 1.21/drivers/usb/host/ohci.h        Sun May  9 10:29:43 2004
+++ edited/drivers/usb/host/ohci.h      Fri May 14 15:59:17 2004
@@ -397,9 +397,12 @@
        ohci->hcd.state = USB_STATE_HALT;
 }
 
+// FIXME temporary, while we phase in msec_to_jiffies
+#ifndef MSEC_TO_JIFFIES
 #define        MSEC_TO_JIFFIES(msec) ((HZ * (msec) + 999) / 1000)
+#endif
 
-static inline void msec_delay(int msec)
+static inline void msec_delay(unsigned msec)
 {
        set_current_state(TASK_UNINTERRUPTIBLE);
        schedule_timeout(MSEC_TO_JIFFIES(msec));

Reply via email to