Sorry, I'd accidentally munged the previous patch in a stupid way.  The one 
attached to this mail should work properly.

Apologies for cluttering up your mailboxes.

Cheers,
Mark

On Tuesday 04 January 2005 17:49, Mark Williamson wrote:
> Hello all,
>
> I just tried to build a USB-enabled 2.4.28 without PCI support and it barfs
> with the following error:
>
> hcd.c: In function `hcd_submit_urb':
> hcd.c:1211: error: structure has no member named `pdev'
> hcd.c:1217: error: structure has no member named `pdev'
> hcd.c: In function `usb_hcd_giveback_urb':
> hcd.c:1493: error: structure has no member named `pdev'
> hcd.c:1498: error: structure has no member named `pdev'
> hcd.c: At top level:
> hcd.c:1427: warning: `hcd_operations' defined but not used
> hcd.c:1438: warning: `hcd_irq' defined but not used
> make[3]: *** [hcd.o] Error 1
>
> Further exploration reveals that hcd.h has the declaration of the pdev in
> struct usb_hcd wrapped in an #ifdef CONFIG_PCI, with a comment that a few
> non PCI controllers do in fact exist.
>
> The current hcd.c, however, references the pdev field in a couple of
> places, regardless of whether CONFIG_PCI is defined.  The patch below adds
> in a couple of #ifdefs to rectify this situation.
>
> The patch is useful to me personally because I've written a virtual host
> controller driver for Xen (http://xen.sf.net).  I realise this is an odd
> configuration but it's only a small change to make the code in hcd.h and
> hcd.c consistent.
>
> I have yet to see if this is an issue in 2.6.
>
> Comments?
>
> Cheers,
> Mark
>
> === patch follows ===
>
> --- linux-2.4.28/drivers/usb/hcd.c      2004-04-14 13:05:32.000000000 +0000
> +++ linux-2.4.28-xenU/drivers/usb/hcd.c 2005-01-04 17:29:47.052646720 +0000
> @@ -1206,6 +1206,7 @@
>         if (urb->dev == hcd->bus->root_hub) {
>                 status = rh_urb_enqueue (hcd, urb);
>         } else {
> +#ifdef CONFIG_PCI
>                 if (usb_pipecontrol (urb->pipe))
>                         urb->setup_dma = pci_map_single (
>                                         hcd->pdev,
> @@ -1220,6 +1221,7 @@
>                                         usb_pipein (urb->pipe)
>                                             ? PCI_DMA_FROMDEVICE
>
>                                             : PCI_DMA_TODEVICE);
>
> +#endif /* CONFIG_PCI */
>                 status = hcd->driver->urb_enqueue (hcd, urb, mem_flags);
>         }
>         return status;
> @@ -1487,7 +1489,8 @@
>         // hcd_monitor_hook(MONITOR_URB_UPDATE, urb, dev)
>
>         // NOTE:  2.5 does this if !URB_NO_DMA_MAP transfer flag
> -
> +
> +#ifdef CONFIG_PCI
>         /* For 2.4, don't unmap bounce buffer if it's a root hub operation.
> */ if (usb_pipecontrol (urb->pipe) && !is_root_hub_operation)
> pci_unmap_single (hcd->pdev, urb->setup_dma,
> @@ -1500,6 +1503,7 @@
>                                 usb_pipein (urb->pipe)
>                                     ? PCI_DMA_FROMDEVICE
>
>                                     : PCI_DMA_TODEVICE);
>
> +#endif /* CONFIG_PCI */
>
>         /* pass ownership to the completion handler */
>         urb->complete (urb);
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> linux-usb-devel@lists.sourceforge.net
> To unsubscribe, use the last form field at:
> https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
--- linux-2.4.28/drivers/usb/hcd.c	2005-01-04 17:59:36.751571128 +0000
+++ linux-2.4.28-xenU/drivers/usb/hcd.c	2005-01-04 17:29:47.052646720 +0000
@@ -1206,6 +1206,7 @@
 	if (urb->dev == hcd->bus->root_hub) {
 		status = rh_urb_enqueue (hcd, urb);
 	} else {
+#ifdef CONFIG_PCI
 		if (usb_pipecontrol (urb->pipe))
 			urb->setup_dma = pci_map_single (
 					hcd->pdev,
@@ -1220,6 +1221,7 @@
 					usb_pipein (urb->pipe)
 					    ? PCI_DMA_FROMDEVICE
 					    : PCI_DMA_TODEVICE);
+#endif /* CONFIG_PCI */
 		status = hcd->driver->urb_enqueue (hcd, urb, mem_flags);
 	}
 	return status;
@@ -1487,7 +1489,8 @@
 	// hcd_monitor_hook(MONITOR_URB_UPDATE, urb, dev)
 
 	// NOTE:  2.5 does this if !URB_NO_DMA_MAP transfer flag
-	
+
+#ifdef CONFIG_PCI	
 	/* For 2.4, don't unmap bounce buffer if it's a root hub operation. */
 	if (usb_pipecontrol (urb->pipe) && !is_root_hub_operation)
 		pci_unmap_single (hcd->pdev, urb->setup_dma,
@@ -1500,6 +1503,7 @@
 				usb_pipein (urb->pipe)
 				    ? PCI_DMA_FROMDEVICE
 				    : PCI_DMA_TODEVICE);
+#endif /* CONFIG_PCI */
 
 	/* pass ownership to the completion handler */
 	urb->complete (urb);

Reply via email to