===== drivers/usb/host/ohci-q.c 1.45 vs edited =====
--- 2.6.2-mm1/drivers/usb/host/ohci-pci.c       Mon Oct 13 06:24:06 2003
+++ edited/drivers/usb/host/ohci-pci.c  Wed Feb  4 10:40:43 2004
@@ -45,17 +45,19 @@
        struct ohci_hcd *ohci = hcd_to_ohci (hcd);
        int             ret;
 
-       if (hcd->pdev) {
-               ohci->hcca = pci_alloc_consistent (hcd->pdev,
-                               sizeof *ohci->hcca, &ohci->hcca_dma);
-               if (!ohci->hcca)
-                       return -ENOMEM;
+       ohci->hcca = dma_alloc_coherent (hcd->dev,
+                       sizeof *ohci->hcca, &ohci->hcca_dma, 0);
+       if (!ohci->hcca)
+               return -ENOMEM;
+
+       if (hcd->dev && hcd->dev->bus == &pci_bus_type) {
+               struct pci_dev *pdev = to_pci_dev(hcd->dev);
 
                /* AMD 756, for most chips (early revs), corrupts register
                 * values on read ... so enable the vendor workaround.
                 */
-               if (hcd->pdev->vendor == PCI_VENDOR_ID_AMD
-                               && hcd->pdev->device == 0x740c) {
+               if (pdev->vendor == PCI_VENDOR_ID_AMD
+                               && pdev->device == 0x740c) {
                        ohci->flags = OHCI_QUIRK_AMD756;
                        ohci_info (ohci, "AMD756 erratum 4 workaround\n");
                }
@@ -68,8 +70,8 @@
                 * for this chip.  Evidently control and bulk lists
                 * can get confused.  (B&W G3 models, and ...)
                 */
-               else if (hcd->pdev->vendor == PCI_VENDOR_ID_OPTI
-                               && hcd->pdev->device == 0xc861) {
+               else if (pdev->vendor == PCI_VENDOR_ID_OPTI
+                               && pdev->device == 0xc861) {
                        ohci_info (ohci,
                                "WARNING: OPTi workarounds unavailable\n");
                }
@@ -78,12 +80,11 @@
                 * identify the USB (fn2). This quirk might apply to more or
                 * even all NSC stuff.
                 */
-               else if (hcd->pdev->vendor == PCI_VENDOR_ID_NS) {
-                       struct pci_dev  *b, *hc;
+               else if (pdev->vendor == PCI_VENDOR_ID_NS) {
+                       struct pci_dev  *b;
 
-                       hc = hcd->pdev;
-                       b  = pci_find_slot (hc->bus->number,
-                                       PCI_DEVFN (PCI_SLOT (hc->devfn), 1));
+                       b  = pci_find_slot (pdev->bus->number,
+                                       PCI_DEVFN (PCI_SLOT (pdev->devfn), 1));
                        if (b && b->device == PCI_DEVICE_ID_NS_87560_LIO
                                        && b->vendor == PCI_VENDOR_ID_NS) {
                                ohci->flags |= OHCI_QUIRK_SUPERIO;
@@ -145,7 +146,7 @@
                
 #ifdef CONFIG_PMAC_PBOOK
        if (_machine == _MACH_Pmac)
-               disable_irq (hcd->pdev->irq);
+               disable_irq ((to_pci_dev(hcd->dev))->irq);
        /* else, 2.4 assumes shared irqs -- don't disable */
 #endif
 
@@ -179,15 +180,15 @@
         * memory during sleep. We disable its bus master bit during
         * suspend
         */
-       pci_read_config_word (hcd->pdev, PCI_COMMAND, &cmd);
+       pci_read_config_word (to_pci_dev(hcd->dev), PCI_COMMAND, &cmd);
        cmd &= ~PCI_COMMAND_MASTER;
-       pci_write_config_word (hcd->pdev, PCI_COMMAND, cmd);
+       pci_write_config_word (to_pci_dev(hcd->dev), PCI_COMMAND, cmd);
 #ifdef CONFIG_PMAC_PBOOK
        {
                struct device_node      *of_node;
  
                /* Disable USB PAD & cell clock */
-               of_node = pci_device_to_OF_node (hcd->pdev);
+               of_node = pci_device_to_OF_node (to_pci_dev(hcd->dev));
                if (of_node)
                        pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
        }
@@ -207,7 +208,7 @@
                struct device_node *of_node;
 
                /* Re-enable USB PAD & cell clock */
-               of_node = pci_device_to_OF_node (hcd->pdev);
+               of_node = pci_device_to_OF_node (to_pci_dev(hcd->dev));
                if (of_node)
                        pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1);
        }
@@ -222,7 +223,7 @@
 #endif
 
        /* Re-enable bus mastering */
-       pci_set_master (ohci->hcd.pdev);
+       pci_set_master (to_pci_dev(ohci->hcd.dev));
        
        switch (temp) {
 
@@ -279,7 +280,7 @@
 
 #ifdef CONFIG_PMAC_PBOOK
                if (_machine == _MACH_Pmac)
-                       enable_irq (hcd->pdev->irq);
+                       enable_irq (to_pci_dev(hcd->dev)->irq);
 #endif
 
                /* Check for a pending done list */
-- 
Deepak Saxena - dsaxena at plexity dot net - http://www.plexity.net/


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to