USB: OHCI: Generic changes to make ohci-pci a separate driver
authorManjunath Goudar <manjunath.goudar@linaro.org>
Tue, 28 May 2013 13:04:50 +0000 (18:34 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 May 2013 12:36:03 +0000 (21:36 +0900)
Note that this changes is part of separating the ohci pci host controller
driver from ohci-hcd host code.
This contains :
     -Moved sb800_prefetch() function from ohci-pci.c to pci-quirks.c file
      and EXPORTed, this is part of the effort to move the ohci pci related
      code to generic pci code.
     -Passed "device" argument instead  of "ohci_hcd" in sb800_prefetch()
      function to avoid extra include file in pci-quirks.c.

V2:
     -Passed "device" argment instead of "pci_dev", then we use to_pci_dev()
      to get the "pci_dev" structure.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ohci-hcd.c
drivers/usb/host/ohci-pci.c
drivers/usb/host/ohci-q.c
drivers/usb/host/pci-quirks.c
drivers/usb/host/pci-quirks.h

index 20a632d09f93cd2af4753b1cc1ef4aec9f419cfe..93d2f3edd19d9b45f6ea8cd899136600fde9e9fd 100644 (file)
@@ -80,15 +80,6 @@ static const char    hcd_name [] = "ohci_hcd";
 
 static void ohci_dump (struct ohci_hcd *ohci, int verbose);
 static void ohci_stop (struct usb_hcd *hcd);
-#ifdef CONFIG_PCI
-static void sb800_prefetch(struct ohci_hcd *ohci, int on);
-#else
-static inline void sb800_prefetch(struct ohci_hcd *ohci, int on)
-{
-       return;
-}
-#endif
-
 
 #include "ohci-hub.c"
 #include "ohci-dbg.c"
index 2c27a5fc4bfe764baed298b1a86b43a726c7b785..c3fa93638ea6f908c7890376e2f276c866fdf1c6 100644 (file)
@@ -168,19 +168,6 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd)
        return 0;
 }
 
-static void sb800_prefetch(struct ohci_hcd *ohci, int on)
-{
-       struct pci_dev *pdev;
-       u16 misc;
-
-       pdev = to_pci_dev(ohci_to_hcd(ohci)->self.controller);
-       pci_read_config_word(pdev, 0x50, &misc);
-       if (on == 0)
-               pci_write_config_word(pdev, 0x50, misc & 0xfcff);
-       else
-               pci_write_config_word(pdev, 0x50, misc | 0x0300);
-}
-
 /* List of quirks for OHCI */
 static const struct pci_device_id ohci_pci_quirks[] = {
        {
index 88731b7c5f4290332409e4fca11ded93051c639c..df4a6707322d322dc292e4d11bfdf926e34dd3ce 100644 (file)
@@ -41,6 +41,7 @@ finish_urb(struct ohci_hcd *ohci, struct urb *urb, int status)
 __releases(ohci->lock)
 __acquires(ohci->lock)
 {
+        struct device *dev = ohci_to_hcd(ohci)->self.controller;
        // ASSERT (urb->hcpriv != 0);
 
        urb_free_priv (ohci, urb->hcpriv);
@@ -55,7 +56,7 @@ __acquires(ohci->lock)
                        if (quirk_amdiso(ohci))
                                usb_amd_quirk_pll_enable();
                        if (quirk_amdprefetch(ohci))
-                               sb800_prefetch(ohci, 0);
+                               sb800_prefetch(dev, 0);
                }
                break;
        case PIPE_INTERRUPT:
@@ -580,6 +581,7 @@ static void td_submit_urb (
        struct urb      *urb
 ) {
        struct urb_priv *urb_priv = urb->hcpriv;
+       struct device *dev = ohci_to_hcd(ohci)->self.controller;
        dma_addr_t      data;
        int             data_len = urb->transfer_buffer_length;
        int             cnt = 0;
@@ -689,7 +691,7 @@ static void td_submit_urb (
                        if (quirk_amdiso(ohci))
                                usb_amd_quirk_pll_disable();
                        if (quirk_amdprefetch(ohci))
-                               sb800_prefetch(ohci, 1);
+                               sb800_prefetch(dev, 1);
                }
                periodic = ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs++ == 0
                        && ohci_to_hcd(ohci)->self.bandwidth_int_reqs == 0;
index 4c338ec03a07d1bfa72ceea172f07e19f151f54b..b9848e4d3d44c8788bfbc43ce196c3b48beae7b4 100644 (file)
@@ -91,6 +91,19 @@ static struct amd_chipset_info {
 
 static DEFINE_SPINLOCK(amd_lock);
 
+void sb800_prefetch(struct device *dev, int on)
+{
+       u16 misc;
+       struct pci_dev *pdev = to_pci_dev(dev);
+
+       pci_read_config_word(pdev, 0x50, &misc);
+       if (on == 0)
+               pci_write_config_word(pdev, 0x50, misc & 0xfcff);
+       else
+               pci_write_config_word(pdev, 0x50, misc | 0x0300);
+}
+EXPORT_SYMBOL_GPL(sb800_prefetch);
+
 int usb_amd_find_chipset_info(void)
 {
        u8 rev = 0;
index 7f69a39163ce3b5560f9e0e24a0a9d86e7f77cef..4b8a2092432f8911b5d73053e34b135041fd0e4d 100644 (file)
@@ -11,11 +11,13 @@ void usb_amd_quirk_pll_enable(void);
 bool usb_is_intel_switchable_xhci(struct pci_dev *pdev);
 void usb_enable_xhci_ports(struct pci_dev *xhci_pdev);
 void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
+void sb800_prefetch(struct device *dev, int on);
 #else
 static inline void usb_amd_quirk_pll_disable(void) {}
 static inline void usb_amd_quirk_pll_enable(void) {}
 static inline void usb_amd_dev_put(void) {}
 static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
+static inline void sb800_prefetch(struct device *dev, int on) {}
 #endif  /* CONFIG_PCI */
 
 #endif  /*  __LINUX_USB_PCI_QUIRKS_H  */