Re: [PATCH v3 7/7] USB: OHCI: avoid conflicting platform drivers

2013-04-01 Thread Alan Stern
On Sat, 30 Mar 2013, Arnd Bergmann wrote:

> > I guess this means the onus is now on me to split up ohci-hcd into a 
> > central library and separate bus drivers, like ehci-hcd...
> 
> The original plan in my teams was that Manjunath would do that after
> he was done with the simple conversion of the EHCI drivers. I think we
> can all agree now that it's better if you at least the groundwork instead.

Yes, it would be better for me to prepare for the general split-up.

> Please let us know if you would like Manjunath to continue with splitting
> out the OHCI back-ends into separate drivers, or if you think that there
> is no point given the quality of the earlier patches.

This is how people learn.  After I have taken care of the initial steps 
and converted a couple of the drivers, Manjunath can work on the rest.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 7/7] USB: OHCI: avoid conflicting platform drivers

2013-03-30 Thread Arnd Bergmann
On Friday 29 March 2013, Alan Stern wrote:
> I have not checked the details of all the changes; however, the basic
> idea is okay as a stop-gap measure.

Ok, thanks. 

> I guess this means the onus is now on me to split up ohci-hcd into a 
> central library and separate bus drivers, like ehci-hcd...

The original plan in my teams was that Manjunath would do that after
he was done with the simple conversion of the EHCI drivers. I think we
can all agree now that it's better if you at least the groundwork instead.

Please let us know if you would like Manjunath to continue with splitting
out the OHCI back-ends into separate drivers, or if you think that there
is no point given the quality of the earlier patches.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 7/7] USB: OHCI: avoid conflicting platform drivers

2013-03-29 Thread Alan Stern
On Thu, 28 Mar 2013, Arnd Bergmann wrote:

> Like the EHCI driver, OHCI supports a large number of different platform
> glue drivers by directly including them, which causes problems with
> conflicting macro definitions in some cases. As more ARM architecture
> specific back-ends are required to coexist in a single build, we should
> split those out into separate drivers. Unfortunately, the infrastructure
> for that is still under development, so to give us more time, this uses
> a separate *_PLATFORM_DRIVER macro for each ARM specific OHCI backend,
> just like we already do on PowerPC and some of the other ARM platforms.
> 
> In linux-3.10, only the SPEAr and CNS3xxx back-ends would actually conflict
> without this patch, but over time we would get more of them, so this
> is a way to avoid having to patch the driver every time it breaks. We
> should still split out all back-ends into separate loadable modules,
> but that work is only needed to improve code size and cleanliness after
> this patch, not for correctness.
> 
> While we're here, this fixes the incorrectly sorted error path
> for the OMAP1 and OMAP3 backends to ensure we always unregister
> the exact set of drivers that were registered before erroring out.

I have not checked the details of all the changes; however, the basic
idea is okay as a stop-gap measure.

I guess this means the onus is now on me to split up ohci-hcd into a 
central library and separate bus drivers, like ehci-hcd...

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 7/7] USB: OHCI: avoid conflicting platform drivers

2013-03-28 Thread Arnd Bergmann
Like the EHCI driver, OHCI supports a large number of different platform
glue drivers by directly including them, which causes problems with
conflicting macro definitions in some cases. As more ARM architecture
specific back-ends are required to coexist in a single build, we should
split those out into separate drivers. Unfortunately, the infrastructure
for that is still under development, so to give us more time, this uses
a separate *_PLATFORM_DRIVER macro for each ARM specific OHCI backend,
just like we already do on PowerPC and some of the other ARM platforms.

In linux-3.10, only the SPEAr and CNS3xxx back-ends would actually conflict
without this patch, but over time we would get more of them, so this
is a way to avoid having to patch the driver every time it breaks. We
should still split out all back-ends into separate loadable modules,
but that work is only needed to improve code size and cleanliness after
this patch, not for correctness.

While we're here, this fixes the incorrectly sorted error path
for the OMAP1 and OMAP3 backends to ensure we always unregister
the exact set of drivers that were registered before erroring out.

Signed-off-by: Arnd Bergmann 
Cc: Manjunath Goudar 
Cc: Greg KH 
Cc: Alan Stern 
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/host/ohci-hcd.c | 136 ++--
 1 file changed, 118 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 180a2b0..9e6de95 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1102,12 +1102,12 @@ MODULE_LICENSE ("GPL");
 
 #if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S3C64XX)
 #include "ohci-s3c2410.c"
-#define PLATFORM_DRIVERohci_hcd_s3c2410_driver
+#define S3C2410_PLATFORM_DRIVERohci_hcd_s3c2410_driver
 #endif
 
 #ifdef CONFIG_USB_OHCI_EXYNOS
 #include "ohci-exynos.c"
-#define PLATFORM_DRIVERexynos_ohci_driver
+#define EXYNOS_PLATFORM_DRIVER exynos_ohci_driver
 #endif
 
 #ifdef CONFIG_USB_OHCI_HCD_OMAP1
@@ -1127,25 +1127,24 @@ MODULE_LICENSE ("GPL");
 
 #ifdef CONFIG_ARCH_EP93XX
 #include "ohci-ep93xx.c"
-#define PLATFORM_DRIVERohci_hcd_ep93xx_driver
+#define EP93XX_PLATFORM_DRIVER ohci_hcd_ep93xx_driver
 #endif
 
 #ifdef CONFIG_ARCH_AT91
 #include "ohci-at91.c"
-#define PLATFORM_DRIVERohci_hcd_at91_driver
+#define AT91_PLATFORM_DRIVER   ohci_hcd_at91_driver
 #endif
 
 #ifdef CONFIG_ARCH_LPC32XX
 #include "ohci-nxp.c"
-#define PLATFORM_DRIVERusb_hcd_nxp_driver
+#define NXP_PLATFORM_DRIVERusb_hcd_nxp_driver
 #endif
 
 #ifdef CONFIG_ARCH_DAVINCI_DA8XX
 #include "ohci-da8xx.c"
-#define PLATFORM_DRIVERohci_hcd_da8xx_driver
+#define DAVINCI_PLATFORM_DRIVERohci_hcd_da8xx_driver
 #endif
 
-
 #ifdef CONFIG_USB_OHCI_HCD_PPC_OF
 #include "ohci-ppc-of.c"
 #define OF_PLATFORM_DRIVER ohci_hcd_ppc_of_driver
@@ -1153,7 +1152,7 @@ MODULE_LICENSE ("GPL");
 
 #ifdef CONFIG_PLAT_SPEAR
 #include "ohci-spear.c"
-#define PLATFORM_DRIVERspear_ohci_hcd_driver
+#define SPEAR_PLATFORM_DRIVER  spear_ohci_hcd_driver
 #endif
 
 #ifdef CONFIG_PPC_PS3
@@ -1199,7 +1198,14 @@ MODULE_LICENSE ("GPL");
!defined(SA_DRIVER) &&  \
!defined(PS3_SYSTEM_BUS_DRIVER) && \
!defined(SM501_OHCI_DRIVER) && \
-   !defined(TMIO_OHCI_DRIVER)
+   !defined(TMIO_OHCI_DRIVER) && \
+   !defined(S3C2410_PLATFORM_DRIVER) && \
+   !defined(EXYNOS_PLATFORM_DRIVER) && \
+   !defined(EP93XX_PLATFORM_DRIVER) && \
+   !defined(AT91_PLATFORM_DRIVER) && \
+   !defined(NXP_PLATFORM_DRIVER) && \
+   !defined(DAVINCI_PLATFORM_DRIVER) && \
+   !defined(SPEAR_PLATFORM_DRIVER)
 #error "missing bus glue for ohci-hcd"
 #endif
 
@@ -1277,9 +1283,79 @@ static int __init ohci_hcd_mod_init(void)
goto error_tmio;
 #endif
 
+#ifdef S3C2410_PLATFORM_DRIVER
+   retval = platform_driver_register(&S3C2410_PLATFORM_DRIVER);
+   if (retval < 0)
+   goto error_s3c2410;
+#endif
+
+#ifdef EXYNOS_PLATFORM_DRIVER
+   retval = platform_driver_register(&EXYNOS_PLATFORM_DRIVER);
+   if (retval < 0)
+   goto error_exynos;
+#endif
+
+#ifdef EP93XX_PLATFORM_DRIVER
+   retval = platform_driver_register(&EP93XX_PLATFORM_DRIVER);
+   if (retval < 0)
+   goto error_ep93xx;
+#endif
+
+#ifdef AT91_PLATFORM_DRIVER
+   retval = platform_driver_register(&AT91_PLATFORM_DRIVER);
+   if (retval < 0)
+   goto error_at91;
+#endif
+
+#ifdef NXP_PLATFORM_DRIVER
+   retval = platform_driver_register(&NXP_PLATFORM_DRIVER);
+   if (retval < 0)
+   goto error_nxp;
+#endif
+
+#ifdef DAVINCI_PLATFORM_DRIVER
+   retval = platform_driver_register(&DAVINCI_PLATFORM_DRIVER);
+   if (retval < 0)
+   goto error_davinci;
+#endif
+
+#ifdef SPEAR_PLATFORM_DRIVER
+   retval = platform_driver_register(&SPEAR_