aboutsummaryrefslogtreecommitdiffstats
path: root/usb
diff options
Diffstat (limited to 'usb')
-rw-r--r--usb/pci-change-device-runtime-pm-settings-for-probe-and-remove-do-not-send.patch160
-rw-r--r--usb/usb-add-do_wakeup-parameter-for-pci-hcd-suspend.patch158
-rw-r--r--usb/usb-add-runtime-pm-for-pci-based-host-controllers.patch167
-rw-r--r--usb/usb-controller-resume-should-check-the-root-hub.patch95
-rw-r--r--usb/usb-drivers-usb-makefile-conditionally-descend-to-early.patch29
-rw-r--r--usb/usb-ehci-fix-null-pointer-dererence-in-hcds-that-use-hcd_local_mem.patch56
-rw-r--r--usb/usb-fix-race-between-root-hub-wakeup-controller-suspend.patch98
-rw-r--r--usb/usb-move-pci-hcd-resume-routine.patch120
-rw-r--r--usb/usb-musb-tusb6010-fix-compile-error-with-n8x0_defconfig.patch44
-rw-r--r--usb/usb-refactor-the-powermac-specific-asic-clock-code.patch87
-rw-r--r--usb/usb-uhci-add-support-for-intel-s-wakeup-flags.patch128
-rw-r--r--usb/usb-usblp-fixed-switch-brace-whitespace-and-spacing-coding-style-issues.patch616
-rw-r--r--usb/usb-xhci-trivial-use-array_size.patch39
13 files changed, 1797 insertions, 0 deletions
diff --git a/usb/pci-change-device-runtime-pm-settings-for-probe-and-remove-do-not-send.patch b/usb/pci-change-device-runtime-pm-settings-for-probe-and-remove-do-not-send.patch
new file mode 100644
index 00000000000000..3e61171f4e4b16
--- /dev/null
+++ b/usb/pci-change-device-runtime-pm-settings-for-probe-and-remove-do-not-send.patch
@@ -0,0 +1,160 @@
+From stern@rowland.harvard.edu Wed Jul 7 14:56:24 2010
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 25 Jun 2010 15:18:32 -0400 (EDT)
+Subject: PCI: change device runtime PM settings for probe and remove - DO NOT SEND
+To: Greg KH <greg@kroah.com>
+Message-ID: <Pine.LNX.4.44L0.1006251516110.1322-100000@iolanthe.rowland.org>
+
+DO NOT SEND TO LINUS, is going through the linux-pci tree.
+
+This patch (as1388) changes the way the PCI core handles runtime PM
+settings when probing or unbinding drivers. Now the core will make
+sure the device is enabled for runtime PM, with a usage count >= 1,
+when a driver is probed. It does the same when calling a driver's
+remove method.
+
+If the driver wants to use runtime PM, all it has to do is call
+pm_runtime_pu_noidle() near the end of its probe routine (to cancel
+the core's usage increment) and pm_runtime_get_noresume() near the
+start of its remove routine (to restore the usage count). It does not
+need to mess around with setting the runtime state to enabled,
+disabled, active, or suspended.
+
+The patch updates e1000e and r8169, the only PCI drivers that already
+use the existing runtime PM interface.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
+
+---
+ drivers/net/e1000e/netdev.c | 16 ++++------------
+ drivers/net/r8169.c | 16 ++++------------
+ drivers/pci/pci-driver.c | 30 ++++++++++++++++++++++++++++--
+ 3 files changed, 36 insertions(+), 26 deletions(-)
+
+--- a/drivers/net/e1000e/netdev.c
++++ b/drivers/net/e1000e/netdev.c
+@@ -5721,11 +5721,8 @@ static int __devinit e1000_probe(struct
+
+ e1000_print_device_info(adapter);
+
+- if (pci_dev_run_wake(pdev)) {
+- pm_runtime_set_active(&pdev->dev);
+- pm_runtime_enable(&pdev->dev);
+- }
+- pm_schedule_suspend(&pdev->dev, MSEC_PER_SEC);
++ if (pci_dev_run_wake(pdev))
++ pm_runtime_put_noidle(&pdev->dev);
+
+ return 0;
+
+@@ -5771,8 +5768,6 @@ static void __devexit e1000_remove(struc
+ struct e1000_adapter *adapter = netdev_priv(netdev);
+ bool down = test_bit(__E1000_DOWN, &adapter->state);
+
+- pm_runtime_get_sync(&pdev->dev);
+-
+ /*
+ * flush_scheduled work may reschedule our watchdog task, so
+ * explicitly disable watchdog tasks from being rescheduled
+@@ -5797,11 +5792,8 @@ static void __devexit e1000_remove(struc
+ clear_bit(__E1000_DOWN, &adapter->state);
+ unregister_netdev(netdev);
+
+- if (pci_dev_run_wake(pdev)) {
+- pm_runtime_disable(&pdev->dev);
+- pm_runtime_set_suspended(&pdev->dev);
+- }
+- pm_runtime_put_noidle(&pdev->dev);
++ if (pci_dev_run_wake(pdev))
++ pm_runtime_get_noresume(&pdev->dev);
+
+ /*
+ * Release control of h/w to f/w. If f/w is AMT enabled, this
+--- a/drivers/net/r8169.c
++++ b/drivers/net/r8169.c
+@@ -3219,11 +3219,8 @@ rtl8169_init_one(struct pci_dev *pdev, c
+
+ device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL);
+
+- if (pci_dev_run_wake(pdev)) {
+- pm_runtime_set_active(&pdev->dev);
+- pm_runtime_enable(&pdev->dev);
+- }
+- pm_runtime_idle(&pdev->dev);
++ if (pci_dev_run_wake(pdev))
++ pm_runtime_put_noidle(&pdev->dev);
+
+ out:
+ return rc;
+@@ -3246,17 +3243,12 @@ static void __devexit rtl8169_remove_one
+ struct net_device *dev = pci_get_drvdata(pdev);
+ struct rtl8169_private *tp = netdev_priv(dev);
+
+- pm_runtime_get_sync(&pdev->dev);
+-
+ flush_scheduled_work();
+
+ unregister_netdev(dev);
+
+- if (pci_dev_run_wake(pdev)) {
+- pm_runtime_disable(&pdev->dev);
+- pm_runtime_set_suspended(&pdev->dev);
+- }
+- pm_runtime_put_noidle(&pdev->dev);
++ if (pci_dev_run_wake(pdev))
++ pm_runtime_get_noresume(&pdev->dev);
+
+ /* restore original MAC address */
+ rtl_rar_set(tp, dev->perm_addr);
+--- a/drivers/pci/pci-driver.c
++++ b/drivers/pci/pci-driver.c
+@@ -289,8 +289,26 @@ struct drv_dev_and_id {
+ static long local_pci_probe(void *_ddi)
+ {
+ struct drv_dev_and_id *ddi = _ddi;
++ struct device *dev = &ddi->dev->dev;
++ int rc;
+
+- return ddi->drv->probe(ddi->dev, ddi->id);
++ /* Unbound PCI devices are always set to disabled and suspended.
++ * During probe, the device is set to enabled and active and the
++ * usage count is incremented. If the driver supports runtime PM,
++ * it should call pm_runtime_put_noidle() in its probe routine and
++ * pm_runtime_get_noresume() in its remove routine.
++ */
++ pm_runtime_get_noresume(dev);
++ pm_runtime_set_active(dev);
++ pm_runtime_enable(dev);
++
++ rc = ddi->drv->probe(ddi->dev, ddi->id);
++ if (rc) {
++ pm_runtime_disable(dev);
++ pm_runtime_set_suspended(dev);
++ pm_runtime_put_noidle(dev);
++ }
++ return rc;
+ }
+
+ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
+@@ -369,11 +387,19 @@ static int pci_device_remove(struct devi
+ struct pci_driver * drv = pci_dev->driver;
+
+ if (drv) {
+- if (drv->remove)
++ if (drv->remove) {
++ pm_runtime_get_sync(dev);
+ drv->remove(pci_dev);
++ pm_runtime_put_noidle(dev);
++ }
+ pci_dev->driver = NULL;
+ }
+
++ /* Undo the runtime PM settings in local_pci_probe() */
++ pm_runtime_disable(dev);
++ pm_runtime_set_suspended(dev);
++ pm_runtime_put_noidle(dev);
++
+ /*
+ * If the device is still on, set the power state as "unknown",
+ * since it might change by the next time we load the driver.
diff --git a/usb/usb-add-do_wakeup-parameter-for-pci-hcd-suspend.patch b/usb/usb-add-do_wakeup-parameter-for-pci-hcd-suspend.patch
new file mode 100644
index 00000000000000..ae3cf5cc1440fd
--- /dev/null
+++ b/usb/usb-add-do_wakeup-parameter-for-pci-hcd-suspend.patch
@@ -0,0 +1,158 @@
+From stern@rowland.harvard.edu Wed Jul 7 14:55:22 2010
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 25 Jun 2010 14:02:14 -0400 (EDT)
+Subject: USB: add do_wakeup parameter for PCI HCD suspend
+To: Greg KH <greg@kroah.com>
+Message-ID: <Pine.LNX.4.44L0.1006251241070.1604-100000@iolanthe.rowland.org>
+
+
+This patch (as1385) adds a "do_wakeup" parameter to the pci_suspend
+method used by PCI-based host controller drivers. ehci-hcd in
+particular needs to know whether or not to enable wakeup when
+suspending a controller. Although that information is currently
+available through device_may_wakeup(), when support is added for
+runtime suspend this will no longer be true.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/hcd-pci.c | 4 +++-
+ drivers/usb/host/ehci-au1xxx.c | 2 +-
+ drivers/usb/host/ehci-fsl.c | 3 ++-
+ drivers/usb/host/ehci-hub.c | 5 ++---
+ drivers/usb/host/ehci-pci.c | 4 ++--
+ drivers/usb/host/ehci.h | 8 ++++----
+ drivers/usb/host/ohci-pci.c | 2 +-
+ drivers/usb/host/uhci-hcd.c | 2 +-
+ include/linux/usb/hcd.h | 2 +-
+ 9 files changed, 17 insertions(+), 15 deletions(-)
+
+--- a/drivers/usb/core/hcd-pci.c
++++ b/drivers/usb/core/hcd-pci.c
+@@ -386,7 +386,9 @@ static int hcd_pci_suspend(struct device
+ return retval;
+
+ if (hcd->driver->pci_suspend) {
+- retval = hcd->driver->pci_suspend(hcd);
++ bool do_wakeup = device_may_wakeup(dev);
++
++ retval = hcd->driver->pci_suspend(hcd, do_wakeup);
+ suspend_report_result(hcd->driver->pci_suspend, retval);
+ if (retval)
+ return retval;
+--- a/drivers/usb/host/ehci-au1xxx.c
++++ b/drivers/usb/host/ehci-au1xxx.c
+@@ -228,7 +228,7 @@ static int ehci_hcd_au1xxx_drv_suspend(s
+ * the root hub is either suspended or stopped.
+ */
+ spin_lock_irqsave(&ehci->lock, flags);
+- ehci_prepare_ports_for_controller_suspend(ehci);
++ ehci_prepare_ports_for_controller_suspend(ehci, device_may_wakeup(dev));
+ ehci_writel(ehci, 0, &ehci->regs->intr_enable);
+ (void)ehci_readl(ehci, &ehci->regs->intr_enable);
+
+--- a/drivers/usb/host/ehci-fsl.c
++++ b/drivers/usb/host/ehci-fsl.c
+@@ -313,7 +313,8 @@ static int ehci_fsl_drv_suspend(struct d
+ struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
+ void __iomem *non_ehci = hcd->regs;
+
+- ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd));
++ ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd),
++ device_may_wakeup(dev));
+ if (!fsl_deep_sleep())
+ return 0;
+
+--- a/drivers/usb/host/ehci-hub.c
++++ b/drivers/usb/host/ehci-hub.c
+@@ -107,7 +107,7 @@ static void ehci_handover_companion_port
+ }
+
+ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
+- bool suspending)
++ bool suspending, bool do_wakeup)
+ {
+ int port;
+ u32 temp;
+@@ -117,8 +117,7 @@ static void ehci_adjust_port_wakeup_flag
+ * when the controller is suspended or resumed. In all other
+ * cases they don't need to be changed.
+ */
+- if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup ||
+- device_may_wakeup(ehci_to_hcd(ehci)->self.controller))
++ if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup)
+ return;
+
+ /* clear phy low-power mode before changing wakeup flags */
+--- a/drivers/usb/host/ehci-pci.c
++++ b/drivers/usb/host/ehci-pci.c
+@@ -277,7 +277,7 @@ done:
+ * Also they depend on separate root hub suspend/resume.
+ */
+
+-static int ehci_pci_suspend(struct usb_hcd *hcd)
++static int ehci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
+ {
+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);
+ unsigned long flags;
+@@ -291,7 +291,7 @@ static int ehci_pci_suspend(struct usb_h
+ * the root hub is either suspended or stopped.
+ */
+ spin_lock_irqsave (&ehci->lock, flags);
+- ehci_prepare_ports_for_controller_suspend(ehci);
++ ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup);
+ ehci_writel(ehci, 0, &ehci->regs->intr_enable);
+ (void)ehci_readl(ehci, &ehci->regs->intr_enable);
+
+--- a/drivers/usb/host/ehci.h
++++ b/drivers/usb/host/ehci.h
+@@ -540,11 +540,11 @@ struct ehci_fstn {
+
+ /* Prepare the PORTSC wakeup flags during controller suspend/resume */
+
+-#define ehci_prepare_ports_for_controller_suspend(ehci) \
+- ehci_adjust_port_wakeup_flags(ehci, true);
++#define ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup) \
++ ehci_adjust_port_wakeup_flags(ehci, true, do_wakeup);
+
+-#define ehci_prepare_ports_for_controller_resume(ehci) \
+- ehci_adjust_port_wakeup_flags(ehci, false);
++#define ehci_prepare_ports_for_controller_resume(ehci) \
++ ehci_adjust_port_wakeup_flags(ehci, false, false);
+
+ /*-------------------------------------------------------------------------*/
+
+--- a/drivers/usb/host/ohci-pci.c
++++ b/drivers/usb/host/ohci-pci.c
+@@ -392,7 +392,7 @@ static int __devinit ohci_pci_start (str
+
+ #ifdef CONFIG_PM
+
+-static int ohci_pci_suspend(struct usb_hcd *hcd)
++static int ohci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
+ {
+ struct ohci_hcd *ohci = hcd_to_ohci (hcd);
+ unsigned long flags;
+--- a/drivers/usb/host/uhci-hcd.c
++++ b/drivers/usb/host/uhci-hcd.c
+@@ -788,7 +788,7 @@ static int uhci_rh_resume(struct usb_hcd
+ return rc;
+ }
+
+-static int uhci_pci_suspend(struct usb_hcd *hcd)
++static int uhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
+ {
+ struct uhci_hcd *uhci = hcd_to_uhci(hcd);
+ int rc = 0;
+--- a/include/linux/usb/hcd.h
++++ b/include/linux/usb/hcd.h
+@@ -211,7 +211,7 @@ struct hc_driver {
+ * a whole, not just the root hub; they're for PCI bus glue.
+ */
+ /* called after suspending the hub, before entering D3 etc */
+- int (*pci_suspend)(struct usb_hcd *hcd);
++ int (*pci_suspend)(struct usb_hcd *hcd, bool do_wakeup);
+
+ /* called after entering D0 (etc), before resuming the hub */
+ int (*pci_resume)(struct usb_hcd *hcd, bool hibernated);
diff --git a/usb/usb-add-runtime-pm-for-pci-based-host-controllers.patch b/usb/usb-add-runtime-pm-for-pci-based-host-controllers.patch
new file mode 100644
index 00000000000000..7f104336553808
--- /dev/null
+++ b/usb/usb-add-runtime-pm-for-pci-based-host-controllers.patch
@@ -0,0 +1,167 @@
+From stern@rowland.harvard.edu Wed Jul 7 14:57:08 2010
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 25 Jun 2010 14:02:57 -0400 (EDT)
+Subject: USB: add runtime PM for PCI-based host controllers
+To: Greg KH <greg@kroah.com>
+Message-ID: <Pine.LNX.4.44L0.1006251253080.1604-100000@iolanthe.rowland.org>
+
+
+This patch (as1386) adds runtime-PM support for PCI-based USB host
+controllers. By default autosuspend is disallowed; the user must
+enable it by writing "auto" to the controller's power/control sysfs
+attribute.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/usb/core/hcd-pci.c | 76 ++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 62 insertions(+), 14 deletions(-)
+
+--- a/drivers/usb/core/hcd-pci.c
++++ b/drivers/usb/core/hcd-pci.c
+@@ -250,6 +250,9 @@ int usb_hcd_pci_probe(struct pci_dev *de
+ if (retval != 0)
+ goto err4;
+ set_hs_companion(dev, hcd);
++
++ if (pci_dev_run_wake(dev))
++ pm_runtime_put_noidle(&dev->dev);
+ return retval;
+
+ err4:
+@@ -292,6 +295,9 @@ void usb_hcd_pci_remove(struct pci_dev *
+ if (!hcd)
+ return;
+
++ if (pci_dev_run_wake(dev))
++ pm_runtime_get_noresume(&dev->dev);
++
+ /* Fake an interrupt request in order to give the driver a chance
+ * to test whether the controller hardware has been removed (e.g.,
+ * cardbus physical eject).
+@@ -325,12 +331,13 @@ void usb_hcd_pci_shutdown(struct pci_dev
+ if (!hcd)
+ return;
+
+- if (hcd->driver->shutdown)
++ if (test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) &&
++ hcd->driver->shutdown)
+ hcd->driver->shutdown(hcd);
+ }
+ EXPORT_SYMBOL_GPL(usb_hcd_pci_shutdown);
+
+-#ifdef CONFIG_PM_SLEEP
++#ifdef CONFIG_PM_OPS
+
+ #ifdef CONFIG_PPC_PMAC
+ static void powermac_set_asic(struct pci_dev *pci_dev, int enable)
+@@ -366,7 +373,7 @@ static int check_root_hub_suspended(stru
+ return 0;
+ }
+
+-static int hcd_pci_suspend(struct device *dev)
++static int suspend_common(struct device *dev, bool do_wakeup)
+ {
+ struct pci_dev *pci_dev = to_pci_dev(dev);
+ struct usb_hcd *hcd = pci_get_drvdata(pci_dev);
+@@ -381,13 +388,7 @@ static int hcd_pci_suspend(struct device
+ if (retval)
+ return retval;
+
+- /* We might already be suspended (runtime PM -- not yet written) */
+- if (pci_dev->current_state != PCI_D0)
+- return retval;
+-
+ if (hcd->driver->pci_suspend) {
+- bool do_wakeup = device_may_wakeup(dev);
+-
+ /* Optimization: Don't suspend if a root-hub wakeup is
+ * pending and it would cause the HCD to wake up anyway.
+ */
+@@ -439,10 +440,8 @@ static int resume_common(struct device *
+ clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
+
+ if (hcd->driver->pci_resume) {
+- /* This call should be made only during system resume,
+- * not during runtime resume.
+- */
+- wait_for_companions(pci_dev, hcd);
++ if (event != PM_EVENT_AUTO_RESUME)
++ wait_for_companions(pci_dev, hcd);
+
+ retval = hcd->driver->pci_resume(hcd,
+ event == PM_EVENT_RESTORE);
+@@ -454,6 +453,13 @@ static int resume_common(struct device *
+ return retval;
+ }
+
++#ifdef CONFIG_PM_SLEEP
++
++static int hcd_pci_suspend(struct device *dev)
++{
++ return suspend_common(dev, device_may_wakeup(dev));
++}
++
+ static int hcd_pci_suspend_noirq(struct device *dev)
+ {
+ struct pci_dev *pci_dev = to_pci_dev(dev);
+@@ -513,6 +519,46 @@ static int hcd_pci_restore(struct device
+ return resume_common(dev, PM_EVENT_RESTORE);
+ }
+
++#else
++
++#define hcd_pci_suspend NULL
++#define hcd_pci_suspend_noirq NULL
++#define hcd_pci_resume_noirq NULL
++#define hcd_pci_resume NULL
++#define hcd_pci_restore NULL
++
++#endif /* CONFIG_PM_SLEEP */
++
++#ifdef CONFIG_PM_RUNTIME
++
++static int hcd_pci_runtime_suspend(struct device *dev)
++{
++ int retval;
++
++ retval = suspend_common(dev, true);
++ if (retval == 0)
++ powermac_set_asic(to_pci_dev(dev), 0);
++ dev_dbg(dev, "hcd_pci_runtime_suspend: %d\n", retval);
++ return retval;
++}
++
++static int hcd_pci_runtime_resume(struct device *dev)
++{
++ int retval;
++
++ powermac_set_asic(to_pci_dev(dev), 1);
++ retval = resume_common(dev, PM_EVENT_AUTO_RESUME);
++ dev_dbg(dev, "hcd_pci_runtime_resume: %d\n", retval);
++ return retval;
++}
++
++#else
++
++#define hcd_pci_runtime_suspend NULL
++#define hcd_pci_runtime_resume NULL
++
++#endif /* CONFIG_PM_RUNTIME */
++
+ const struct dev_pm_ops usb_hcd_pci_pm_ops = {
+ .suspend = hcd_pci_suspend,
+ .suspend_noirq = hcd_pci_suspend_noirq,
+@@ -526,7 +572,9 @@ const struct dev_pm_ops usb_hcd_pci_pm_o
+ .poweroff_noirq = hcd_pci_suspend_noirq,
+ .restore_noirq = hcd_pci_resume_noirq,
+ .restore = hcd_pci_restore,
++ .runtime_suspend = hcd_pci_runtime_suspend,
++ .runtime_resume = hcd_pci_runtime_resume,
+ };
+ EXPORT_SYMBOL_GPL(usb_hcd_pci_pm_ops);
+
+-#endif /* CONFIG_PM_SLEEP */
++#endif /* CONFIG_PM_OPS */
diff --git a/usb/usb-controller-resume-should-check-the-root-hub.patch b/usb/usb-controller-resume-should-check-the-root-hub.patch
new file mode 100644
index 00000000000000..c0fc5896cf2aa1
--- /dev/null
+++ b/usb/usb-controller-resume-should-check-the-root-hub.patch
@@ -0,0 +1,95 @@
+From stern@rowland.harvard.edu Wed Jul 7 14:55:34 2010
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 25 Jun 2010 14:02:24 -0400 (EDT)
+Subject: USB: controller resume should check the root hub
+To: Greg KH <greg@kroah.com>
+Message-ID: <Pine.LNX.4.44L0.1006251244030.1604-100000@iolanthe.rowland.org>
+
+
+This patch (as1394) adds code to ehci-hcd, ohci-hcd, and uhci-hcd for
+automatically resuming the root hub when the controller is resumed, if
+the root hub has a wakeup request pending on some port.
+
+During resume from system sleep this doesn't matter, because the root
+hubs will naturally be resumed along with every other device in the
+system. However it _will_ matter for runtime PM: If the controller is
+suspended and a remote wakeup request is received then the controller
+will autoresume, but we need to ensure that the root hub also
+autoresumes. Otherwise the wakeup request would be ignored, the
+controller would go back to sleep, and the cycle would repeat a large
+number of times (I saw this happen before the patch was written).
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/ehci-hub.c | 4 ++++
+ drivers/usb/host/ohci-hub.c | 7 ++++++-
+ drivers/usb/host/uhci-hcd.c | 7 ++++---
+ drivers/usb/host/uhci-hub.c | 2 +-
+ 4 files changed, 15 insertions(+), 5 deletions(-)
+
+--- a/drivers/usb/host/ehci-hub.c
++++ b/drivers/usb/host/ehci-hub.c
+@@ -166,6 +166,10 @@ static void ehci_adjust_port_wakeup_flag
+ ehci_writel(ehci, temp | HOSTPC_PHCD, hostpc_reg);
+ }
+ }
++
++ /* Does the root hub have a port wakeup pending? */
++ if (!suspending && (ehci_readl(ehci, &ehci->regs->status) & STS_PCD))
++ usb_hcd_resume_root_hub(ehci_to_hcd(ehci));
+ }
+
+ static int ehci_bus_suspend (struct usb_hcd *hcd)
+--- a/drivers/usb/host/ohci-hub.c
++++ b/drivers/usb/host/ohci-hub.c
+@@ -355,6 +355,11 @@ static void ohci_finish_controller_resum
+ ohci_readl(ohci, &ohci->regs->intrenable);
+ msleep(20);
+ }
++
++ /* Does the root hub have a port wakeup pending? */
++ if (ohci_readl(ohci, &ohci->regs->intrstatus) &
++ (OHCI_INTR_RD | OHCI_INTR_RHSC))
++ usb_hcd_resume_root_hub(hcd);
+ }
+
+ /* Carry out polling-, autostop-, and autoresume-related state changes */
+@@ -364,7 +369,7 @@ static int ohci_root_hub_state_changes(s
+ int poll_rh = 1;
+ int rhsc_enable;
+
+- /* Some broken controllers never turn off RHCS in the interrupt
++ /* Some broken controllers never turn off RHSC in the interrupt
+ * status register. For their sake we won't re-enable RHSC
+ * interrupts if the interrupt bit is already active.
+ */
+--- a/drivers/usb/host/uhci-hcd.c
++++ b/drivers/usb/host/uhci-hcd.c
+@@ -862,10 +862,11 @@ static int uhci_pci_resume(struct usb_hc
+ /* If interrupts don't work and remote wakeup is enabled then
+ * the suspended root hub needs to be polled.
+ */
+- if (!uhci->RD_enable && hcd->self.root_hub->do_remote_wakeup) {
++ if (!uhci->RD_enable && hcd->self.root_hub->do_remote_wakeup)
+ set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
+- usb_hcd_poll_rh_status(hcd);
+- }
++
++ /* Does the root hub have a port wakeup pending? */
++ usb_hcd_poll_rh_status(hcd);
+ return 0;
+ }
+ #endif
+--- a/drivers/usb/host/uhci-hub.c
++++ b/drivers/usb/host/uhci-hub.c
+@@ -200,7 +200,7 @@ static int uhci_hub_status_data(struct u
+ case UHCI_RH_SUSPENDING:
+ case UHCI_RH_SUSPENDED:
+ /* if port change, ask to be resumed */
+- if (status)
++ if (status || uhci->resuming_ports)
+ usb_hcd_resume_root_hub(hcd);
+ break;
+
diff --git a/usb/usb-drivers-usb-makefile-conditionally-descend-to-early.patch b/usb/usb-drivers-usb-makefile-conditionally-descend-to-early.patch
new file mode 100644
index 00000000000000..e8e4dbce09c34f
--- /dev/null
+++ b/usb/usb-drivers-usb-makefile-conditionally-descend-to-early.patch
@@ -0,0 +1,29 @@
+From nikai@nikai.net Wed Jul 7 14:58:58 2010
+From: Nicolas Kaiser <nikai@nikai.net>
+Date: Sun, 27 Jun 2010 17:27:51 +0200
+Subject: USB: drivers/usb/Makefile: conditionally descend to 'early'
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Message-ID: <20100627172751.32deb6aa@absol.kitzblitz>
+
+
+Don't descend to the EARLY_PRINTK_DBGP directory
+unless it is actually used.
+
+Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/Makefile
++++ b/drivers/usb/Makefile
+@@ -41,7 +41,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/
+ obj-$(CONFIG_USB_SERIAL) += serial/
+
+ obj-$(CONFIG_USB) += misc/
+-obj-y += early/
++obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/
+
+ obj-$(CONFIG_USB_ATM) += atm/
+ obj-$(CONFIG_USB_SPEEDTOUCH) += atm/
diff --git a/usb/usb-ehci-fix-null-pointer-dererence-in-hcds-that-use-hcd_local_mem.patch b/usb/usb-ehci-fix-null-pointer-dererence-in-hcds-that-use-hcd_local_mem.patch
new file mode 100644
index 00000000000000..6687380a6429f9
--- /dev/null
+++ b/usb/usb-ehci-fix-null-pointer-dererence-in-hcds-that-use-hcd_local_mem.patch
@@ -0,0 +1,56 @@
+From arighi@develer.com Wed Jul 7 15:00:21 2010
+From: Andrea Righi <arighi@develer.com>
+Date: Mon, 28 Jun 2010 16:56:45 +0200
+Subject: USB: EHCI: fix NULL pointer dererence in HCDs that use HCD_LOCAL_MEM
+To: Greg KH <greg@kroah.com>
+Cc: Alan Stern <stern@rowland.harvard.edu>, Chris Wright <chrisw@sous-sol.org>
+Message-ID: <20100628145636.GA6915@linux.develer.com>
+
+
+If we use the HCD_LOCAL_MEM flag and dma_declare_coherent_memory() to
+enforce the host controller's local memory utilization we also need to
+disable native scatter-gather support, otherwise hcd_alloc_coherent() in
+map_urb_for_dma() is called with urb->transfer_buffer == NULL, that
+triggers a NULL pointer dereference.
+
+We can also consider to add a WARN_ON() and return an error code to
+better catch this problem in the future.
+
+At the moment no driver seems to hit this bug, so I should
+consider this a low-priority fix.
+
+Signed-off-by: Andrea Righi <arighi@develer.com>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/hcd.c | 5 +++++
+ drivers/usb/host/ehci-hcd.c | 3 ++-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/core/hcd.c
++++ b/drivers/usb/core/hcd.c
+@@ -1218,6 +1218,11 @@ static int hcd_alloc_coherent(struct usb
+ {
+ unsigned char *vaddr;
+
++ if (*vaddr_handle == NULL) {
++ WARN_ON_ONCE(1);
++ return -EFAULT;
++ }
++
+ vaddr = hcd_buffer_alloc(bus, size + sizeof(vaddr),
+ mem_flags, dma_handle);
+ if (!vaddr)
+--- a/drivers/usb/host/ehci-hcd.c
++++ b/drivers/usb/host/ehci-hcd.c
+@@ -629,7 +629,8 @@ static int ehci_init(struct usb_hcd *hcd
+ ehci->command = temp;
+
+ /* Accept arbitrarily long scatter-gather lists */
+- hcd->self.sg_tablesize = ~0;
++ if (!(hcd->driver->flags & HCD_LOCAL_MEM))
++ hcd->self.sg_tablesize = ~0;
+ return 0;
+ }
+
diff --git a/usb/usb-fix-race-between-root-hub-wakeup-controller-suspend.patch b/usb/usb-fix-race-between-root-hub-wakeup-controller-suspend.patch
new file mode 100644
index 00000000000000..b51d05c1839473
--- /dev/null
+++ b/usb/usb-fix-race-between-root-hub-wakeup-controller-suspend.patch
@@ -0,0 +1,98 @@
+From stern@rowland.harvard.edu Wed Jul 7 14:55:46 2010
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 25 Jun 2010 14:02:35 -0400 (EDT)
+Subject: USB: fix race between root-hub wakeup & controller suspend
+To: Greg KH <greg@kroah.com>
+Message-ID: <Pine.LNX.4.44L0.1006251248220.1604-100000@iolanthe.rowland.org>
+
+
+This patch (as1395) adds code to hcd_pci_suspend() for handling wakeup
+races. This is another general race pattern, similar to the "open
+vs. unregister" race we're all familiar with. Here, the race is
+between suspending a device and receiving a wakeup request from one of
+the device's suspended children.
+
+In particular, if a root-hub wakeup is requested at about the same
+time as the corresponding USB controller is suspended, and if the
+controller is enabled for wakeup, then the controller should either
+fail to suspend or else wake right back up again.
+
+During system sleep this won't happen very much, especially since host
+controllers generally aren't enabled for wakeup during sleep. However
+it is definitely an issue for runtime PM. Something like this will be
+needed to prevent the controller from autosuspending while waiting for
+a root-hub resume to take place. (That is, in fact, the common case,
+for which there is an extra test.)
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/hcd-pci.c | 12 ++++++++++++
+ drivers/usb/core/hcd.c | 5 ++++-
+ include/linux/usb/hcd.h | 2 ++
+ 3 files changed, 18 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/core/hcd-pci.c
++++ b/drivers/usb/core/hcd-pci.c
+@@ -388,8 +388,20 @@ static int hcd_pci_suspend(struct device
+ if (hcd->driver->pci_suspend) {
+ bool do_wakeup = device_may_wakeup(dev);
+
++ /* Optimization: Don't suspend if a root-hub wakeup is
++ * pending and it would cause the HCD to wake up anyway.
++ */
++ if (do_wakeup && HCD_WAKEUP_PENDING(hcd))
++ return -EBUSY;
+ retval = hcd->driver->pci_suspend(hcd, do_wakeup);
+ suspend_report_result(hcd->driver->pci_suspend, retval);
++
++ /* Check again in case wakeup raced with pci_suspend */
++ if (retval == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
++ if (hcd->driver->pci_resume)
++ hcd->driver->pci_resume(hcd, false);
++ retval = -EBUSY;
++ }
+ if (retval)
+ return retval;
+ }
+--- a/drivers/usb/core/hcd.c
++++ b/drivers/usb/core/hcd.c
+@@ -1940,6 +1940,7 @@ int hcd_bus_resume(struct usb_device *rh
+
+ dev_dbg(&rhdev->dev, "usb %s%s\n",
+ (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume");
++ clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags);
+ if (!hcd->driver->bus_resume)
+ return -ENOENT;
+ if (hcd->state == HC_STATE_RUNNING)
+@@ -1993,8 +1994,10 @@ void usb_hcd_resume_root_hub (struct usb
+ unsigned long flags;
+
+ spin_lock_irqsave (&hcd_root_hub_lock, flags);
+- if (hcd->rh_registered)
++ if (hcd->rh_registered) {
++ set_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags);
+ queue_work(pm_wq, &hcd->wakeup_work);
++ }
+ spin_unlock_irqrestore (&hcd_root_hub_lock, flags);
+ }
+ EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub);
+--- a/include/linux/usb/hcd.h
++++ b/include/linux/usb/hcd.h
+@@ -98,6 +98,7 @@ struct usb_hcd {
+ #define HCD_FLAG_SAW_IRQ 1
+ #define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
+ #define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
++#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
+
+ /* The flags can be tested using these macros; they are likely to
+ * be slightly faster than test_bit().
+@@ -106,6 +107,7 @@ struct usb_hcd {
+ #define HCD_SAW_IRQ(hcd) ((hcd)->flags & (1U << HCD_FLAG_SAW_IRQ))
+ #define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
+ #define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
++#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
+
+ /* Flags that get set only during HCD registration or removal. */
+ unsigned rh_registered:1;/* is root hub registered? */
diff --git a/usb/usb-move-pci-hcd-resume-routine.patch b/usb/usb-move-pci-hcd-resume-routine.patch
new file mode 100644
index 00000000000000..144b105d219642
--- /dev/null
+++ b/usb/usb-move-pci-hcd-resume-routine.patch
@@ -0,0 +1,120 @@
+From stern@rowland.harvard.edu Wed Jul 7 14:55:11 2010
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 25 Jun 2010 14:02:03 -0400 (EDT)
+Subject: USB: move PCI HCD resume routine
+To: Greg KH <greg@kroah.com>
+Message-ID: <Pine.LNX.4.44L0.1006251239250.1604-100000@iolanthe.rowland.org>
+
+
+This patch (as1384) moves the resume_common() routine in hcd-pci.c a
+little higher in the source file to avoid forward references in an
+upcoming patch. It also replaces the "hibernated" argument with a
+more general "event" argument, which will be useful when the routine
+is called during a runtime resume.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/hcd-pci.c | 77 ++++++++++++++++++++++-----------------------
+ 1 file changed, 39 insertions(+), 38 deletions(-)
+
+--- a/drivers/usb/core/hcd-pci.c
++++ b/drivers/usb/core/hcd-pci.c
+@@ -403,6 +403,43 @@ static int hcd_pci_suspend(struct device
+ return retval;
+ }
+
++static int resume_common(struct device *dev, int event)
++{
++ struct pci_dev *pci_dev = to_pci_dev(dev);
++ struct usb_hcd *hcd = pci_get_drvdata(pci_dev);
++ int retval;
++
++ if (hcd->state != HC_STATE_SUSPENDED) {
++ dev_dbg(dev, "can't resume, not suspended!\n");
++ return 0;
++ }
++
++ retval = pci_enable_device(pci_dev);
++ if (retval < 0) {
++ dev_err(dev, "can't re-enable after resume, %d!\n", retval);
++ return retval;
++ }
++
++ pci_set_master(pci_dev);
++
++ clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
++
++ if (hcd->driver->pci_resume) {
++ /* This call should be made only during system resume,
++ * not during runtime resume.
++ */
++ wait_for_companions(pci_dev, hcd);
++
++ retval = hcd->driver->pci_resume(hcd,
++ event == PM_EVENT_RESTORE);
++ if (retval) {
++ dev_err(dev, "PCI post-resume error %d!\n", retval);
++ usb_hc_died(hcd);
++ }
++ }
++ return retval;
++}
++
+ static int hcd_pci_suspend_noirq(struct device *dev)
+ {
+ struct pci_dev *pci_dev = to_pci_dev(dev);
+@@ -452,50 +489,14 @@ static int hcd_pci_resume_noirq(struct d
+ return 0;
+ }
+
+-static int resume_common(struct device *dev, bool hibernated)
+-{
+- struct pci_dev *pci_dev = to_pci_dev(dev);
+- struct usb_hcd *hcd = pci_get_drvdata(pci_dev);
+- int retval;
+-
+- if (hcd->state != HC_STATE_SUSPENDED) {
+- dev_dbg(dev, "can't resume, not suspended!\n");
+- return 0;
+- }
+-
+- retval = pci_enable_device(pci_dev);
+- if (retval < 0) {
+- dev_err(dev, "can't re-enable after resume, %d!\n", retval);
+- return retval;
+- }
+-
+- pci_set_master(pci_dev);
+-
+- clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
+-
+- if (hcd->driver->pci_resume) {
+- /* This call should be made only during system resume,
+- * not during runtime resume.
+- */
+- wait_for_companions(pci_dev, hcd);
+-
+- retval = hcd->driver->pci_resume(hcd, hibernated);
+- if (retval) {
+- dev_err(dev, "PCI post-resume error %d!\n", retval);
+- usb_hc_died(hcd);
+- }
+- }
+- return retval;
+-}
+-
+ static int hcd_pci_resume(struct device *dev)
+ {
+- return resume_common(dev, false);
++ return resume_common(dev, PM_EVENT_RESUME);
+ }
+
+ static int hcd_pci_restore(struct device *dev)
+ {
+- return resume_common(dev, true);
++ return resume_common(dev, PM_EVENT_RESTORE);
+ }
+
+ const struct dev_pm_ops usb_hcd_pci_pm_ops = {
diff --git a/usb/usb-musb-tusb6010-fix-compile-error-with-n8x0_defconfig.patch b/usb/usb-musb-tusb6010-fix-compile-error-with-n8x0_defconfig.patch
new file mode 100644
index 00000000000000..3e790aaa22c323
--- /dev/null
+++ b/usb/usb-musb-tusb6010-fix-compile-error-with-n8x0_defconfig.patch
@@ -0,0 +1,44 @@
+From felipe.balbi@nokia.com Wed Jul 7 15:01:53 2010
+From: felipe.balbi@nokia.com
+Date: Mon, 5 Jul 2010 12:12:01 +0300
+Subject: USB: musb: tusb6010: fix compile error with n8x0_defconfig
+To: Greg KH <greg@kroah.com>
+Cc: Tony Lindgren <tony@atomide.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1278321121-13474-1-git-send-email-felipe.balbi@nokia.com>
+
+
+From: Felipe Balbi <felipe.balbi@nokia.com>
+
+Drop the unnecessary empty stubs in tusb6010.c and avoid
+a compile error when building kernel for n8x0.
+
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Cc: stable <stable@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/musb/tusb6010.c | 13 -------------
+ 1 file changed, 13 deletions(-)
+
+--- a/drivers/usb/musb/tusb6010.c
++++ b/drivers/usb/musb/tusb6010.c
+@@ -29,19 +29,6 @@ static void tusb_source_power(struct mus
+ #define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf)
+ #define TUSB_REV_MINOR(reg_val) (reg_val & 0xf)
+
+-#ifdef CONFIG_PM
+-/* REVISIT: These should be only needed if somebody implements off idle */
+-void musb_platform_save_context(struct musb *musb,
+- struct musb_context_registers *musb_context)
+-{
+-}
+-
+-void musb_platform_restore_context(struct musb *musb,
+- struct musb_context_registers *musb_context)
+-{
+-}
+-#endif
+-
+ /*
+ * Checks the revision. We need to use the DMA register as 3.0 does not
+ * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV.
diff --git a/usb/usb-refactor-the-powermac-specific-asic-clock-code.patch b/usb/usb-refactor-the-powermac-specific-asic-clock-code.patch
new file mode 100644
index 00000000000000..baaffc61d1b1d6
--- /dev/null
+++ b/usb/usb-refactor-the-powermac-specific-asic-clock-code.patch
@@ -0,0 +1,87 @@
+From stern@rowland.harvard.edu Wed Jul 7 14:54:53 2010
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 25 Jun 2010 14:01:49 -0400 (EDT)
+Subject: USB: refactor the powermac-specific ASIC clock code
+To: Greg KH <greg@kroah.com>
+Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Message-ID: <Pine.LNX.4.44L0.1006251235540.1604-100000@iolanthe.rowland.org>
+
+
+This patch (as1383) takes the powermac-specific code from the PCI HCD
+glue layer and encapsulates it in its own subroutine.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/hcd-pci.c | 44 +++++++++++++++++++++++---------------------
+ 1 file changed, 23 insertions(+), 21 deletions(-)
+
+--- a/drivers/usb/core/hcd-pci.c
++++ b/drivers/usb/core/hcd-pci.c
+@@ -332,6 +332,27 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_shutdown);
+
+ #ifdef CONFIG_PM_SLEEP
+
++#ifdef CONFIG_PPC_PMAC
++static void powermac_set_asic(struct pci_dev *pci_dev, int enable)
++{
++ /* Enanble or disable ASIC clocks for USB */
++ if (machine_is(powermac)) {
++ struct device_node *of_node;
++
++ of_node = pci_device_to_OF_node(pci_dev);
++ if (of_node)
++ pmac_call_feature(PMAC_FTR_USB_ENABLE,
++ of_node, 0, enable);
++ }
++}
++
++#else
++
++static inline void powermac_set_asic(struct pci_dev *pci_dev, int enable)
++{}
++
++#endif /* CONFIG_PPC_PMAC */
++
+ static int check_root_hub_suspended(struct device *dev)
+ {
+ struct pci_dev *pci_dev = to_pci_dev(dev);
+@@ -416,16 +437,7 @@ static int hcd_pci_suspend_noirq(struct
+ return retval;
+ }
+
+-#ifdef CONFIG_PPC_PMAC
+- /* Disable ASIC clocks for USB */
+- if (machine_is(powermac)) {
+- struct device_node *of_node;
+-
+- of_node = pci_device_to_OF_node(pci_dev);
+- if (of_node)
+- pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
+- }
+-#endif
++ powermac_set_asic(pci_dev, 0);
+ return retval;
+ }
+
+@@ -433,17 +445,7 @@ static int hcd_pci_resume_noirq(struct d
+ {
+ struct pci_dev *pci_dev = to_pci_dev(dev);
+
+-#ifdef CONFIG_PPC_PMAC
+- /* Reenable ASIC clocks for USB */
+- if (machine_is(powermac)) {
+- struct device_node *of_node;
+-
+- of_node = pci_device_to_OF_node(pci_dev);
+- if (of_node)
+- pmac_call_feature(PMAC_FTR_USB_ENABLE,
+- of_node, 0, 1);
+- }
+-#endif
++ powermac_set_asic(pci_dev, 1);
+
+ /* Go back to D0 and disable remote wakeup */
+ pci_back_from_sleep(pci_dev);
diff --git a/usb/usb-uhci-add-support-for-intel-s-wakeup-flags.patch b/usb/usb-uhci-add-support-for-intel-s-wakeup-flags.patch
new file mode 100644
index 00000000000000..0b00af20eb99ac
--- /dev/null
+++ b/usb/usb-uhci-add-support-for-intel-s-wakeup-flags.patch
@@ -0,0 +1,128 @@
+From stern@rowland.harvard.edu Wed Jul 7 14:55:57 2010
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 25 Jun 2010 14:02:49 -0400 (EDT)
+Subject: USB: UHCI: add support for Intel's wakeup flags
+To: Greg KH <greg@kroah.com>
+Message-ID: <Pine.LNX.4.44L0.1006251251090.1604-100000@iolanthe.rowland.org>
+
+
+This patch (as1396) adds code to uhci-hcd to support the
+vendor-specific wakeup settings found in Intel's ICHx hardware. A
+couple of unnecessary memory barriers are removed. And the root hub
+isn't put back into the "suspended" state if power was lost during a
+system sleep -- there's not much point in doing so because the root hub
+will be resumed shortly.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/uhci-hcd.c | 30 +++++++++++++++++-------------
+ drivers/usb/host/uhci-hcd.h | 7 ++++++-
+ 2 files changed, 23 insertions(+), 14 deletions(-)
+
+--- a/drivers/usb/host/uhci-hcd.c
++++ b/drivers/usb/host/uhci-hcd.c
+@@ -176,6 +176,8 @@ static void check_and_reset_hc(struct uh
+ */
+ static void configure_hc(struct uhci_hcd *uhci)
+ {
++ struct pci_dev *pdev = to_pci_dev(uhci_dev(uhci));
++
+ /* Set the frame length to the default: 1 ms exactly */
+ outb(USBSOF_DEFAULT, uhci->io_addr + USBSOF);
+
+@@ -191,8 +193,11 @@ static void configure_hc(struct uhci_hcd
+ mb();
+
+ /* Enable PIRQ */
+- pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP,
+- USBLEGSUP_DEFAULT);
++ pci_write_config_word(pdev, USBLEGSUP, USBLEGSUP_DEFAULT);
++
++ /* Disable platform-specific non-PME# wakeup */
++ if (pdev->vendor == PCI_VENDOR_ID_INTEL)
++ pci_write_config_byte(pdev, USBRES_INTEL, 0);
+ }
+
+
+@@ -791,6 +796,7 @@ static int uhci_rh_resume(struct usb_hcd
+ static int uhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
+ {
+ struct uhci_hcd *uhci = hcd_to_uhci(hcd);
++ struct pci_dev *pdev = to_pci_dev(uhci_dev(uhci));
+ int rc = 0;
+
+ dev_dbg(uhci_dev(uhci), "%s\n", __func__);
+@@ -808,11 +814,15 @@ static int uhci_pci_suspend(struct usb_h
+ /* All PCI host controllers are required to disable IRQ generation
+ * at the source, so we must turn off PIRQ.
+ */
+- pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0);
+- mb();
++ pci_write_config_word(pdev, USBLEGSUP, 0);
+ clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
+
+- /* FIXME: Enable non-PME# remote wakeup? */
++ /* Enable platform-specific non-PME# wakeup */
++ if (do_wakeup) {
++ if (pdev->vendor == PCI_VENDOR_ID_INTEL)
++ pci_write_config_byte(pdev, USBRES_INTEL,
++ USBPORT1EN | USBPORT2EN);
++ }
+
+ done_okay:
+ clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+@@ -831,7 +841,6 @@ static int uhci_pci_resume(struct usb_hc
+ * even if the controller was dead.
+ */
+ set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+- mb();
+
+ spin_lock_irq(&uhci->lock);
+
+@@ -839,8 +848,6 @@ static int uhci_pci_resume(struct usb_hc
+ if (hibernated)
+ uhci_hc_died(uhci);
+
+- /* FIXME: Disable non-PME# remote wakeup? */
+-
+ /* The firmware or a boot kernel may have changed the controller
+ * settings during a system wakeup. Check it and reconfigure
+ * to avoid problems.
+@@ -850,12 +857,9 @@ static int uhci_pci_resume(struct usb_hc
+ /* If the controller was dead before, it's back alive now */
+ configure_hc(uhci);
+
+- if (uhci->rh_state == UHCI_RH_RESET) {
+-
+- /* The controller had to be reset */
++ /* Tell the core if the controller had to be reset */
++ if (uhci->rh_state == UHCI_RH_RESET)
+ usb_root_hub_lost_power(hcd->self.root_hub);
+- suspend_rh(uhci, UHCI_RH_SUSPENDED);
+- }
+
+ spin_unlock_irq(&uhci->lock);
+
+--- a/drivers/usb/host/uhci-hcd.h
++++ b/drivers/usb/host/uhci-hcd.h
+@@ -67,12 +67,17 @@
+ #define USBPORTSC_RES3 0x4000 /* reserved, write zeroes */
+ #define USBPORTSC_RES4 0x8000 /* reserved, write zeroes */
+
+-/* Legacy support register */
++/* PCI legacy support register */
+ #define USBLEGSUP 0xc0
+ #define USBLEGSUP_DEFAULT 0x2000 /* only PIRQ enable set */
+ #define USBLEGSUP_RWC 0x8f00 /* the R/WC bits */
+ #define USBLEGSUP_RO 0x5040 /* R/O and reserved bits */
+
++/* PCI Intel-specific resume-enable register */
++#define USBRES_INTEL 0xc4
++#define USBPORT1EN 0x01
++#define USBPORT2EN 0x02
++
+ #define UHCI_PTR_BITS cpu_to_le32(0x000F)
+ #define UHCI_PTR_TERM cpu_to_le32(0x0001)
+ #define UHCI_PTR_QH cpu_to_le32(0x0002)
diff --git a/usb/usb-usblp-fixed-switch-brace-whitespace-and-spacing-coding-style-issues.patch b/usb/usb-usblp-fixed-switch-brace-whitespace-and-spacing-coding-style-issues.patch
new file mode 100644
index 00000000000000..8e37c147a39a01
--- /dev/null
+++ b/usb/usb-usblp-fixed-switch-brace-whitespace-and-spacing-coding-style-issues.patch
@@ -0,0 +1,616 @@
+From nikai@nikai.net Wed Jul 7 14:57:26 2010
+From: Nicolas Kaiser <nikai@nikai.net>
+Date: Fri, 25 Jun 2010 20:25:37 +0200
+Subject: USB: usblp: fixed switch, brace, whitespace and spacing coding style issues
+To: Pete Zaitcev <zaitcev@redhat.com>
+Cc: Greg Kroah-Hartman <gregkh@suse.de>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
+Message-ID: <20100625202537.1cd4526c@absol.kitzblitz>
+
+
+Fixed switch, brace, whitespace and spacing coding style issues.
+
+Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
+Cc: Pete Zaitcev <zaitcev@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/class/usblp.c | 369 ++++++++++++++++++++++------------------------
+ 1 file changed, 184 insertions(+), 185 deletions(-)
+
+--- a/drivers/usb/class/usblp.c
++++ b/drivers/usb/class/usblp.c
+@@ -135,7 +135,7 @@ MFG:HEWLETT-PACKARD;MDL:DESKJET 970C;CMD
+ * ->lock locks what interrupt accesses.
+ */
+ struct usblp {
+- struct usb_device *dev; /* USB device */
++ struct usb_device *dev; /* USB device */
+ struct mutex wmut;
+ struct mutex mut;
+ spinlock_t lock; /* locks rcomplete, wcomplete */
+@@ -169,7 +169,8 @@ struct usblp {
+ };
+
+ #ifdef DEBUG
+-static void usblp_dump(struct usblp *usblp) {
++static void usblp_dump(struct usblp *usblp)
++{
+ int p;
+
+ dbg("usblp=0x%p", usblp);
+@@ -216,8 +217,8 @@ static const struct quirk_printer_struct
+ { 0x03f0, 0x0304, USBLP_QUIRK_BIDIR }, /* HP DeskJet 810C/812C */
+ { 0x03f0, 0x0404, USBLP_QUIRK_BIDIR }, /* HP DeskJet 830C */
+ { 0x03f0, 0x0504, USBLP_QUIRK_BIDIR }, /* HP DeskJet 885C */
+- { 0x03f0, 0x0604, USBLP_QUIRK_BIDIR }, /* HP DeskJet 840C */
+- { 0x03f0, 0x0804, USBLP_QUIRK_BIDIR }, /* HP DeskJet 816C */
++ { 0x03f0, 0x0604, USBLP_QUIRK_BIDIR }, /* HP DeskJet 840C */
++ { 0x03f0, 0x0804, USBLP_QUIRK_BIDIR }, /* HP DeskJet 816C */
+ { 0x03f0, 0x1104, USBLP_QUIRK_BIDIR }, /* HP Deskjet 959C */
+ { 0x0409, 0xefbe, USBLP_QUIRK_BIDIR }, /* NEC Picty900 (HP OEM) */
+ { 0x0409, 0xbef4, USBLP_QUIRK_BIDIR }, /* NEC Picty760 (HP OEM) */
+@@ -254,9 +255,8 @@ static int usblp_ctrl_msg(struct usblp *
+ /* High byte has the interface index.
+ Low byte has the alternate setting.
+ */
+- if ((request == USBLP_REQ_GET_ID) && (type == USB_TYPE_CLASS)) {
+- index = (usblp->ifnum<<8)|usblp->protocol[usblp->current_protocol].alt_setting;
+- }
++ if ((request == USBLP_REQ_GET_ID) && (type == USB_TYPE_CLASS))
++ index = (usblp->ifnum<<8)|usblp->protocol[usblp->current_protocol].alt_setting;
+
+ retval = usb_control_msg(usblp->dev,
+ dir ? usb_rcvctrlpipe(usblp->dev, 0) : usb_sndctrlpipe(usblp->dev, 0),
+@@ -372,7 +372,7 @@ static int usblp_check_status(struct usb
+ return newerr;
+ }
+
+-static int handle_bidir (struct usblp *usblp)
++static int handle_bidir(struct usblp *usblp)
+ {
+ if (usblp->bidir && usblp->used) {
+ if (usblp_submit_read(usblp) < 0)
+@@ -395,14 +395,13 @@ static int usblp_open(struct inode *inod
+ if (minor < 0)
+ return -ENODEV;
+
+- mutex_lock (&usblp_mutex);
++ mutex_lock(&usblp_mutex);
+
+ retval = -ENODEV;
+ intf = usb_find_interface(&usblp_driver, minor);
+- if (!intf) {
++ if (!intf)
+ goto out;
+- }
+- usblp = usb_get_intfdata (intf);
++ usblp = usb_get_intfdata(intf);
+ if (!usblp || !usblp->dev || !usblp->present)
+ goto out;
+
+@@ -433,18 +432,18 @@ static int usblp_open(struct inode *inod
+ retval = -EIO;
+ }
+ out:
+- mutex_unlock (&usblp_mutex);
++ mutex_unlock(&usblp_mutex);
+ return retval;
+ }
+
+-static void usblp_cleanup (struct usblp *usblp)
++static void usblp_cleanup(struct usblp *usblp)
+ {
+ printk(KERN_INFO "usblp%d: removed\n", usblp->minor);
+
+ kfree(usblp->readbuf);
+- kfree (usblp->device_id_string);
+- kfree (usblp->statusbuf);
+- kfree (usblp);
++ kfree(usblp->device_id_string);
++ kfree(usblp->statusbuf);
++ kfree(usblp);
+ }
+
+ static void usblp_unlink_urbs(struct usblp *usblp)
+@@ -458,14 +457,14 @@ static int usblp_release(struct inode *i
+
+ usblp->flags &= ~LP_ABORT;
+
+- mutex_lock (&usblp_mutex);
++ mutex_lock(&usblp_mutex);
+ usblp->used = 0;
+ if (usblp->present) {
+ usblp_unlink_urbs(usblp);
+ usb_autopm_put_interface(usblp->intf);
+- } else /* finish cleanup from disconnect */
+- usblp_cleanup (usblp);
+- mutex_unlock (&usblp_mutex);
++ } else /* finish cleanup from disconnect */
++ usblp_cleanup(usblp);
++ mutex_unlock(&usblp_mutex);
+ return 0;
+ }
+
+@@ -495,190 +494,190 @@ static long usblp_ioctl(struct file *fil
+ int twoints[2];
+ int retval = 0;
+
+- mutex_lock (&usblp->mut);
++ mutex_lock(&usblp->mut);
+ if (!usblp->present) {
+ retval = -ENODEV;
+ goto done;
+ }
+
+ dbg("usblp_ioctl: cmd=0x%x (%c nr=%d len=%d dir=%d)", cmd, _IOC_TYPE(cmd),
+- _IOC_NR(cmd), _IOC_SIZE(cmd), _IOC_DIR(cmd) );
++ _IOC_NR(cmd), _IOC_SIZE(cmd), _IOC_DIR(cmd));
+
+ if (_IOC_TYPE(cmd) == 'P') /* new-style ioctl number */
+
+ switch (_IOC_NR(cmd)) {
+
+- case IOCNR_GET_DEVICE_ID: /* get the DEVICE_ID string */
+- if (_IOC_DIR(cmd) != _IOC_READ) {
+- retval = -EINVAL;
+- goto done;
+- }
++ case IOCNR_GET_DEVICE_ID: /* get the DEVICE_ID string */
++ if (_IOC_DIR(cmd) != _IOC_READ) {
++ retval = -EINVAL;
++ goto done;
++ }
+
+- length = usblp_cache_device_id_string(usblp);
+- if (length < 0) {
+- retval = length;
+- goto done;
+- }
+- if (length > _IOC_SIZE(cmd))
+- length = _IOC_SIZE(cmd); /* truncate */
++ length = usblp_cache_device_id_string(usblp);
++ if (length < 0) {
++ retval = length;
++ goto done;
++ }
++ if (length > _IOC_SIZE(cmd))
++ length = _IOC_SIZE(cmd); /* truncate */
+
+- if (copy_to_user((void __user *) arg,
+- usblp->device_id_string,
+- (unsigned long) length)) {
+- retval = -EFAULT;
+- goto done;
+- }
++ if (copy_to_user((void __user *) arg,
++ usblp->device_id_string,
++ (unsigned long) length)) {
++ retval = -EFAULT;
++ goto done;
++ }
+
+- break;
++ break;
+
+- case IOCNR_GET_PROTOCOLS:
+- if (_IOC_DIR(cmd) != _IOC_READ ||
+- _IOC_SIZE(cmd) < sizeof(twoints)) {
+- retval = -EINVAL;
+- goto done;
+- }
++ case IOCNR_GET_PROTOCOLS:
++ if (_IOC_DIR(cmd) != _IOC_READ ||
++ _IOC_SIZE(cmd) < sizeof(twoints)) {
++ retval = -EINVAL;
++ goto done;
++ }
+
+- twoints[0] = usblp->current_protocol;
+- twoints[1] = 0;
+- for (i = USBLP_FIRST_PROTOCOL;
+- i <= USBLP_LAST_PROTOCOL; i++) {
+- if (usblp->protocol[i].alt_setting >= 0)
+- twoints[1] |= (1<<i);
+- }
++ twoints[0] = usblp->current_protocol;
++ twoints[1] = 0;
++ for (i = USBLP_FIRST_PROTOCOL;
++ i <= USBLP_LAST_PROTOCOL; i++) {
++ if (usblp->protocol[i].alt_setting >= 0)
++ twoints[1] |= (1<<i);
++ }
+
+- if (copy_to_user((void __user *)arg,
+- (unsigned char *)twoints,
+- sizeof(twoints))) {
+- retval = -EFAULT;
+- goto done;
+- }
++ if (copy_to_user((void __user *)arg,
++ (unsigned char *)twoints,
++ sizeof(twoints))) {
++ retval = -EFAULT;
++ goto done;
++ }
+
+- break;
++ break;
+
+- case IOCNR_SET_PROTOCOL:
+- if (_IOC_DIR(cmd) != _IOC_WRITE) {
+- retval = -EINVAL;
+- goto done;
+- }
++ case IOCNR_SET_PROTOCOL:
++ if (_IOC_DIR(cmd) != _IOC_WRITE) {
++ retval = -EINVAL;
++ goto done;
++ }
+
+ #ifdef DEBUG
+- if (arg == -10) {
+- usblp_dump(usblp);
+- break;
+- }
++ if (arg == -10) {
++ usblp_dump(usblp);
++ break;
++ }
+ #endif
+
+- usblp_unlink_urbs(usblp);
+- retval = usblp_set_protocol(usblp, arg);
+- if (retval < 0) {
+- usblp_set_protocol(usblp,
+- usblp->current_protocol);
+- }
+- break;
++ usblp_unlink_urbs(usblp);
++ retval = usblp_set_protocol(usblp, arg);
++ if (retval < 0) {
++ usblp_set_protocol(usblp,
++ usblp->current_protocol);
++ }
++ break;
+
+- case IOCNR_HP_SET_CHANNEL:
+- if (_IOC_DIR(cmd) != _IOC_WRITE ||
+- le16_to_cpu(usblp->dev->descriptor.idVendor) != 0x03F0 ||
+- usblp->quirks & USBLP_QUIRK_BIDIR) {
+- retval = -EINVAL;
+- goto done;
+- }
++ case IOCNR_HP_SET_CHANNEL:
++ if (_IOC_DIR(cmd) != _IOC_WRITE ||
++ le16_to_cpu(usblp->dev->descriptor.idVendor) != 0x03F0 ||
++ usblp->quirks & USBLP_QUIRK_BIDIR) {
++ retval = -EINVAL;
++ goto done;
++ }
+
+- err = usblp_hp_channel_change_request(usblp,
+- arg, &newChannel);
+- if (err < 0) {
+- dev_err(&usblp->dev->dev,
+- "usblp%d: error = %d setting "
+- "HP channel\n",
+- usblp->minor, err);
+- retval = -EIO;
+- goto done;
+- }
++ err = usblp_hp_channel_change_request(usblp,
++ arg, &newChannel);
++ if (err < 0) {
++ dev_err(&usblp->dev->dev,
++ "usblp%d: error = %d setting "
++ "HP channel\n",
++ usblp->minor, err);
++ retval = -EIO;
++ goto done;
++ }
+
+- dbg("usblp%d requested/got HP channel %ld/%d",
+- usblp->minor, arg, newChannel);
+- break;
++ dbg("usblp%d requested/got HP channel %ld/%d",
++ usblp->minor, arg, newChannel);
++ break;
+
+- case IOCNR_GET_BUS_ADDRESS:
+- if (_IOC_DIR(cmd) != _IOC_READ ||
+- _IOC_SIZE(cmd) < sizeof(twoints)) {
+- retval = -EINVAL;
+- goto done;
+- }
++ case IOCNR_GET_BUS_ADDRESS:
++ if (_IOC_DIR(cmd) != _IOC_READ ||
++ _IOC_SIZE(cmd) < sizeof(twoints)) {
++ retval = -EINVAL;
++ goto done;
++ }
+
+- twoints[0] = usblp->dev->bus->busnum;
+- twoints[1] = usblp->dev->devnum;
+- if (copy_to_user((void __user *)arg,
+- (unsigned char *)twoints,
+- sizeof(twoints))) {
+- retval = -EFAULT;
+- goto done;
+- }
++ twoints[0] = usblp->dev->bus->busnum;
++ twoints[1] = usblp->dev->devnum;
++ if (copy_to_user((void __user *)arg,
++ (unsigned char *)twoints,
++ sizeof(twoints))) {
++ retval = -EFAULT;
++ goto done;
++ }
+
+- dbg("usblp%d is bus=%d, device=%d",
+- usblp->minor, twoints[0], twoints[1]);
+- break;
++ dbg("usblp%d is bus=%d, device=%d",
++ usblp->minor, twoints[0], twoints[1]);
++ break;
+
+- case IOCNR_GET_VID_PID:
+- if (_IOC_DIR(cmd) != _IOC_READ ||
+- _IOC_SIZE(cmd) < sizeof(twoints)) {
+- retval = -EINVAL;
+- goto done;
+- }
++ case IOCNR_GET_VID_PID:
++ if (_IOC_DIR(cmd) != _IOC_READ ||
++ _IOC_SIZE(cmd) < sizeof(twoints)) {
++ retval = -EINVAL;
++ goto done;
++ }
+
+- twoints[0] = le16_to_cpu(usblp->dev->descriptor.idVendor);
+- twoints[1] = le16_to_cpu(usblp->dev->descriptor.idProduct);
+- if (copy_to_user((void __user *)arg,
+- (unsigned char *)twoints,
+- sizeof(twoints))) {
+- retval = -EFAULT;
+- goto done;
+- }
++ twoints[0] = le16_to_cpu(usblp->dev->descriptor.idVendor);
++ twoints[1] = le16_to_cpu(usblp->dev->descriptor.idProduct);
++ if (copy_to_user((void __user *)arg,
++ (unsigned char *)twoints,
++ sizeof(twoints))) {
++ retval = -EFAULT;
++ goto done;
++ }
+
+- dbg("usblp%d is VID=0x%4.4X, PID=0x%4.4X",
+- usblp->minor, twoints[0], twoints[1]);
+- break;
++ dbg("usblp%d is VID=0x%4.4X, PID=0x%4.4X",
++ usblp->minor, twoints[0], twoints[1]);
++ break;
+
+- case IOCNR_SOFT_RESET:
+- if (_IOC_DIR(cmd) != _IOC_NONE) {
+- retval = -EINVAL;
+- goto done;
+- }
+- retval = usblp_reset(usblp);
+- break;
+- default:
+- retval = -ENOTTY;
++ case IOCNR_SOFT_RESET:
++ if (_IOC_DIR(cmd) != _IOC_NONE) {
++ retval = -EINVAL;
++ goto done;
++ }
++ retval = usblp_reset(usblp);
++ break;
++ default:
++ retval = -ENOTTY;
+ }
+ else /* old-style ioctl value */
+ switch (cmd) {
+
+- case LPGETSTATUS:
+- if ((retval = usblp_read_status(usblp, usblp->statusbuf))) {
+- if (printk_ratelimit())
+- printk(KERN_ERR "usblp%d:"
+- "failed reading printer status (%d)\n",
+- usblp->minor, retval);
+- retval = -EIO;
+- goto done;
+- }
+- status = *usblp->statusbuf;
+- if (copy_to_user ((void __user *)arg, &status, sizeof(int)))
+- retval = -EFAULT;
+- break;
++ case LPGETSTATUS:
++ if ((retval = usblp_read_status(usblp, usblp->statusbuf))) {
++ if (printk_ratelimit())
++ printk(KERN_ERR "usblp%d:"
++ "failed reading printer status (%d)\n",
++ usblp->minor, retval);
++ retval = -EIO;
++ goto done;
++ }
++ status = *usblp->statusbuf;
++ if (copy_to_user((void __user *)arg, &status, sizeof(int)))
++ retval = -EFAULT;
++ break;
+
+- case LPABORT:
+- if (arg)
+- usblp->flags |= LP_ABORT;
+- else
+- usblp->flags &= ~LP_ABORT;
+- break;
++ case LPABORT:
++ if (arg)
++ usblp->flags |= LP_ABORT;
++ else
++ usblp->flags &= ~LP_ABORT;
++ break;
+
+- default:
+- retval = -ENOTTY;
++ default:
++ retval = -ENOTTY;
+ }
+
+ done:
+- mutex_unlock (&usblp->mut);
++ mutex_unlock(&usblp->mut);
+ return retval;
+ }
+
+@@ -840,7 +839,7 @@ static ssize_t usblp_read(struct file *f
+ }
+
+ done:
+- mutex_unlock (&usblp->mut);
++ mutex_unlock(&usblp->mut);
+ return count;
+ }
+
+@@ -1023,7 +1022,7 @@ raise_urb:
+ * while you are sending print data, and you don't try to query the
+ * printer status every couple of milliseconds, you will probably be OK.
+ */
+-static unsigned int usblp_quirks (__u16 vendor, __u16 product)
++static unsigned int usblp_quirks(__u16 vendor, __u16 product)
+ {
+ int i;
+
+@@ -1031,7 +1030,7 @@ static unsigned int usblp_quirks (__u16
+ if (vendor == quirk_printers[i].vendorId &&
+ product == quirk_printers[i].productId)
+ return quirk_printers[i].quirks;
+- }
++ }
+ return 0;
+ }
+
+@@ -1061,7 +1060,7 @@ static struct usb_class_driver usblp_cla
+ static ssize_t usblp_show_ieee1284_id(struct device *dev, struct device_attribute *attr, char *buf)
+ {
+ struct usb_interface *intf = to_usb_interface(dev);
+- struct usblp *usblp = usb_get_intfdata (intf);
++ struct usblp *usblp = usb_get_intfdata(intf);
+
+ if (usblp->device_id_string[0] == 0 &&
+ usblp->device_id_string[1] == 0)
+@@ -1075,7 +1074,7 @@ static DEVICE_ATTR(ieee1284_id, S_IRUGO,
+ static int usblp_probe(struct usb_interface *intf,
+ const struct usb_device_id *id)
+ {
+- struct usb_device *dev = interface_to_usbdev (intf);
++ struct usb_device *dev = interface_to_usbdev(intf);
+ struct usblp *usblp;
+ int protocol;
+ int retval;
+@@ -1089,7 +1088,7 @@ static int usblp_probe(struct usb_interf
+ }
+ usblp->dev = dev;
+ mutex_init(&usblp->wmut);
+- mutex_init (&usblp->mut);
++ mutex_init(&usblp->mut);
+ spin_lock_init(&usblp->lock);
+ init_waitqueue_head(&usblp->rwait);
+ init_waitqueue_head(&usblp->wwait);
+@@ -1153,7 +1152,7 @@ static int usblp_probe(struct usb_interf
+ usblp_check_status(usblp, 0);
+ #endif
+
+- usb_set_intfdata (intf, usblp);
++ usb_set_intfdata(intf, usblp);
+
+ usblp->present = 1;
+
+@@ -1177,7 +1176,7 @@ static int usblp_probe(struct usb_interf
+ return 0;
+
+ abort_intfdata:
+- usb_set_intfdata (intf, NULL);
++ usb_set_intfdata(intf, NULL);
+ device_remove_file(&intf->dev, &dev_attr_ieee1284_id);
+ abort:
+ kfree(usblp->readbuf);
+@@ -1340,35 +1339,35 @@ static int usblp_cache_device_id_string(
+
+ static void usblp_disconnect(struct usb_interface *intf)
+ {
+- struct usblp *usblp = usb_get_intfdata (intf);
++ struct usblp *usblp = usb_get_intfdata(intf);
+
+ usb_deregister_dev(intf, &usblp_class);
+
+ if (!usblp || !usblp->dev) {
+ dev_err(&intf->dev, "bogus disconnect\n");
+- BUG ();
++ BUG();
+ }
+
+ device_remove_file(&intf->dev, &dev_attr_ieee1284_id);
+
+- mutex_lock (&usblp_mutex);
+- mutex_lock (&usblp->mut);
++ mutex_lock(&usblp_mutex);
++ mutex_lock(&usblp->mut);
+ usblp->present = 0;
+ wake_up(&usblp->wwait);
+ wake_up(&usblp->rwait);
+- usb_set_intfdata (intf, NULL);
++ usb_set_intfdata(intf, NULL);
+
+ usblp_unlink_urbs(usblp);
+- mutex_unlock (&usblp->mut);
++ mutex_unlock(&usblp->mut);
+
+ if (!usblp->used)
+- usblp_cleanup (usblp);
+- mutex_unlock (&usblp_mutex);
++ usblp_cleanup(usblp);
++ mutex_unlock(&usblp_mutex);
+ }
+
+ static int usblp_suspend(struct usb_interface *intf, pm_message_t message)
+ {
+- struct usblp *usblp = usb_get_intfdata (intf);
++ struct usblp *usblp = usb_get_intfdata(intf);
+
+ usblp_unlink_urbs(usblp);
+ #if 0 /* XXX Do we want this? What if someone is reading, should we fail? */
+@@ -1382,10 +1381,10 @@ static int usblp_suspend(struct usb_inte
+
+ static int usblp_resume(struct usb_interface *intf)
+ {
+- struct usblp *usblp = usb_get_intfdata (intf);
++ struct usblp *usblp = usb_get_intfdata(intf);
+ int r;
+
+- r = handle_bidir (usblp);
++ r = handle_bidir(usblp);
+
+ return r;
+ }
+@@ -1401,7 +1400,7 @@ static const struct usb_device_id usblp_
+ { } /* Terminating entry */
+ };
+
+-MODULE_DEVICE_TABLE (usb, usblp_ids);
++MODULE_DEVICE_TABLE(usb, usblp_ids);
+
+ static struct usb_driver usblp_driver = {
+ .name = "usblp",
+@@ -1426,8 +1425,8 @@ static void __exit usblp_exit(void)
+ module_init(usblp_init);
+ module_exit(usblp_exit);
+
+-MODULE_AUTHOR( DRIVER_AUTHOR );
+-MODULE_DESCRIPTION( DRIVER_DESC );
++MODULE_AUTHOR(DRIVER_AUTHOR);
++MODULE_DESCRIPTION(DRIVER_DESC);
+ module_param(proto_bias, int, S_IRUGO | S_IWUSR);
+ MODULE_PARM_DESC(proto_bias, "Favourite protocol number");
+ MODULE_LICENSE("GPL");
diff --git a/usb/usb-xhci-trivial-use-array_size.patch b/usb/usb-xhci-trivial-use-array_size.patch
new file mode 100644
index 00000000000000..87df12dd957d90
--- /dev/null
+++ b/usb/usb-xhci-trivial-use-array_size.patch
@@ -0,0 +1,39 @@
+From segooon@gmail.com Wed Jul 7 14:59:17 2010
+From: Kulikov Vasiliy <segooon@gmail.com>
+Date: Mon, 28 Jun 2010 15:55:46 +0400
+Subject: USB: xhci: trivial: use ARRAY_SIZE
+To: trivial@kernel.org
+Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>, Greg Kroah-Hartman <gregkh@suse.de>, John Youn <John.Youn@synopsys.com>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
+Message-ID: <1277726147-24933-1-git-send-email-segooon@gmail.com>
+
+
+Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).
+
+Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
+Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/xhci-mem.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -1566,7 +1566,7 @@ static int xhci_check_trb_in_td_math(str
+ unsigned int num_tests;
+ int i, ret;
+
+- num_tests = sizeof(simple_test_vector) / sizeof(simple_test_vector[0]);
++ num_tests = ARRAY_SIZE(simple_test_vector);
+ for (i = 0; i < num_tests; i++) {
+ ret = xhci_test_trb_in_td(xhci,
+ xhci->event_ring->first_seg,
+@@ -1579,7 +1579,7 @@ static int xhci_check_trb_in_td_math(str
+ return ret;
+ }
+
+- num_tests = sizeof(complex_test_vector) / sizeof(complex_test_vector[0]);
++ num_tests = ARRAY_SIZE(complex_test_vector);
+ for (i = 0; i < num_tests; i++) {
+ ret = xhci_test_trb_in_td(xhci,
+ complex_test_vector[i].input_seg,