Re: [BK PATCH] USB update for 2.6.3

From: Linus Torvalds
Date: Fri Feb 20 2004 - 01:44:04 EST




On Fri, 20 Feb 2004, Benjamin Herrenschmidt wrote:
>
> Yes, but we don't have a hook for actually filling this pointer, do we ?

Well, we do. The pcibios_xxx routines get called for all PCI devices
during discovery, and that's when you'd fill them in.

Anyway, I found the bug - the "asm-generic/dma-mapping.h" compatibility
macros _do_ work, but the EHCI controller driver doesn't actually include
that header file. Oops.

> We should have a way, when creating a device, to fill it properly, like
>
> platform_device_setup(struct device *new_dev, struct device *parent)

No no. That wouldn't work AT ALL, since the whole point is that you need
to know what the device is - ie you need to fill in the information when
you get the "struct pci_dev *" (because different buses would most likely
have different behaviour, and could have different requirements for DMA
mapping etc).

So the platform code that actually knows what the device is (pcibios_xxx
for PCI devices) would fill in the platform pointer.

Anyway, I got it all working with the trivial patch..

===== drivers/usb/host/ehci-hcd.c 1.67 vs edited =====
--- 1.67/drivers/usb/host/ehci-hcd.c Wed Feb 11 03:42:39 2004
+++ edited/drivers/usb/host/ehci-hcd.c Thu Feb 19 22:42:53 2004
@@ -41,6 +41,7 @@
#include <linux/reboot.h>
#include <linux/usb.h>
#include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>

#include "../core/hcd.h"


so this works for now, even though it's really really ugly (and it _will_
BUG() out if anybody ever passes a non-PCI-related "struct device" to the
thing).

Let's see if it boots too. So far it's only compiled successfully ;)

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/