On Thu, 25 Aug 2011, Felipe Balbi wrote: > > With your plan, I don't see how you can hope to make a single driver > > source work for all the different IP blocks. Passing the resources via > > devicetree will help, but the different hardware implementations will > > still require vendor-specific code to run at various times, right? > > Otherwise all the ehci-*.c files would resemble each other more > > closely. > > Don't you think they are ? Other than the very intial HW configuration > all they do is provide struct hc_driver with the exact same fields. > Maybe a few differences here an there, but most of them, just reuse the > functions exported by ehci-hcd. Then why not start making modifications to ehci-hcd by uniting all those different platform drivers into a single source file? You'd have to do that anyway; might as well begin now since it's non-controversial. If that can be made to work well, it will be a very strong argument for making PCI use a platform device too. > > If your main concern is getting rid of the #ifdefs in ehci-hcd.c (and > > preventing the equivalent from being added to xhci.c), there's a > > simpler way to accomplish it: Use conditional linking rather than > > conditional compilation. All that complexity would be moved out of the > > C source files and into the Makefile instead. That is, instead of > > > > obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o > > > > which is what we currently have, we could have > > > > obj-$(CONFIG_PCI) += ehci-pci.o ehci-hcd.o > > obj-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o ehci-hcd.o > > obj-$(CONFIG_USB_EHCI_HCD_OMAP) += ehci-omap.o ehci-hcd.o > > etc. > > I remember proposing that long ago and Dave was against it because it > would make "copies" of the entire ehci stack right ? So if we had an > OMAP board with a PCIe controller, we would have two big ehci drivers. > My proposal was to reuse ehci-hcd.ko without having to link it to every > single ehci-<arch>.o It wouldn't have to be linked to every ehci-<arch>.o; only the one that the kernel is configured for. Right now you can't build more than one of them, right? Otherwise there would be multiple definitions for the PLATFORM_DRIVER symbol. For that matter, why does ehci-hcd.c have separate code for registering OF_PLATFORM_DRIVER and XILINX_OF_PLATFORM_DRIVER? Why don't they use the same old PLATFORM_DRIVER symbol as everything else? > > The one disadvantage would be that you couldn't have a single driver > > module to handle both PCI and a platform device; they would have to be > > separate drivers. > > true. There's also the PS3 system bus thingy -- yet another bus. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html