diff mbox series

[1/3] mfd: omap-usb-host: Use regular platform device probe mechanism

Message ID 20180911150610.27510-2-laurent.pinchart@ideasonboard.com
State New, archived
Headers show
Series Fix OMAP EHCI probe & assorted cleanups | expand

Commit Message

Laurent Pinchart Sept. 11, 2018, 3:06 p.m. UTC
The omap-usb-host driver uses platform_driver_probe() in the fs initcall
level to ensure that the devices get probed before the EHCI and OHCI
drivers arer probed.

The EHCI and OHCI devices are created and registered by the omap-usb-host
driver, and if no driver is present yet to handle them they will
patiently wait for they turn without any adverse effect. This mechanism
is thus not needed, remove it.

This fixes a bug that prevents EHCI and OHCI devices from being probed
on the Pandaboard since commit 84badc5ec5fc ("ARM: dts: omap4: Move l4
child devices to probe them with ti-sysc"), as then omap-usb-host
devices are now registered after the omap-usb-host driver initializes,
and thus fail to probe due to platform_driver_probe() not finding any
device.

Fixes: 84badc5ec5fc ("ARM: dts: omap4: Move l4 child devices to probe them with ti-sysc")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/mfd/omap-usb-host.c | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

Comments

Tony Lindgren Sept. 11, 2018, 3:48 p.m. UTC | #1
* Laurent Pinchart <laurent.pinchart@ideasonboard.com> [180911 15:10]:
> --- a/drivers/mfd/omap-usb-host.c
> +++ b/drivers/mfd/omap-usb-host.c
> @@ -855,31 +856,14 @@ static struct platform_driver usbhs_omap_driver = {
>  		.pm		= &usbhsomap_dev_pm_ops,
>  		.of_match_table = usbhs_omap_dt_ids,
>  	},
> +	.probe		= usbhs_omap_probe,
>  	.remove		= usbhs_omap_remove,
>  };

So I have this already along few other fixes in patch
"[PATCH] mfd: omap-usb-host: Fix dts probe of children".

> +module_platform_driver(usbhs_omap_driver);
> +
>  MODULE_AUTHOR("Keshava Munegowda <keshava_mgowda@ti.com>");
>  MODULE_AUTHOR("Roger Quadros <rogerq@ti.com>");
>  MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
>  MODULE_LICENSE("GPL v2");
>  MODULE_DESCRIPTION("usb host common core driver for omap EHCI and OHCI");
> -
> -static int __init omap_usbhs_drvinit(void)
> -{
> -	return platform_driver_probe(&usbhs_omap_driver, usbhs_omap_probe);
> -}
> -
> -/*
> - * init before ehci and ohci drivers;
> - * The usbhs core driver should be initialized much before
> - * the omap ehci and ohci probe functions are called.
> - * This usbhs core driver should be initialized after
> - * usb tll driver
> - */
> -fs_initcall_sync(omap_usbhs_drvinit);
> -
> -static void __exit omap_usbhs_drvexit(void)
> -{
> -	platform_driver_unregister(&usbhs_omap_driver);
> -}
> -module_exit(omap_usbhs_drvexit);

Seems like part can then become part of your clean-up
for v4.20 then?

Regards,

Tony
Ladislav Michl Sept. 11, 2018, 3:53 p.m. UTC | #2
On Tue, Sep 11, 2018 at 06:06:08PM +0300, Laurent Pinchart wrote:
> The omap-usb-host driver uses platform_driver_probe() in the fs initcall
> level to ensure that the devices get probed before the EHCI and OHCI
> drivers arer probed.
> 
> The EHCI and OHCI devices are created and registered by the omap-usb-host
> driver, and if no driver is present yet to handle them they will
> patiently wait for they turn without any adverse effect. This mechanism
> is thus not needed, remove it.
> 
> This fixes a bug that prevents EHCI and OHCI devices from being probed
> on the Pandaboard since commit 84badc5ec5fc ("ARM: dts: omap4: Move l4
> child devices to probe them with ti-sysc"), as then omap-usb-host
> devices are now registered after the omap-usb-host driver initializes,
> and thus fail to probe due to platform_driver_probe() not finding any
> device.
> 
> Fixes: 84badc5ec5fc ("ARM: dts: omap4: Move l4 child devices to probe them with ti-sysc")
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/mfd/omap-usb-host.c | 24 ++++--------------------
>  1 file changed, 4 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
> index e11ab12fbdf2..b731026541f5 100644
> --- a/drivers/mfd/omap-usb-host.c
> +++ b/drivers/mfd/omap-usb-host.c
> @@ -548,6 +548,7 @@ static int usbhs_omap_probe(struct platform_device *pdev)
>  	int				i;
>  	bool				need_logic_fck;
>  
> +	dev_info(&pdev->dev, "%s\n", __func__);

Is it indentional? Seems like debug leftover.

>  	if (dev->of_node) {
>  		/* For DT boot we populate platform data from OF node */
>  		pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> @@ -855,31 +856,14 @@ static struct platform_driver usbhs_omap_driver = {
>  		.pm		= &usbhsomap_dev_pm_ops,
>  		.of_match_table = usbhs_omap_dt_ids,
>  	},
> +	.probe		= usbhs_omap_probe,
>  	.remove		= usbhs_omap_remove,
>  };
>  
> +module_platform_driver(usbhs_omap_driver);
> +
>  MODULE_AUTHOR("Keshava Munegowda <keshava_mgowda@ti.com>");
>  MODULE_AUTHOR("Roger Quadros <rogerq@ti.com>");
>  MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
>  MODULE_LICENSE("GPL v2");
>  MODULE_DESCRIPTION("usb host common core driver for omap EHCI and OHCI");
> -
> -static int __init omap_usbhs_drvinit(void)
> -{
> -	return platform_driver_probe(&usbhs_omap_driver, usbhs_omap_probe);
> -}
> -
> -/*
> - * init before ehci and ohci drivers;
> - * The usbhs core driver should be initialized much before
> - * the omap ehci and ohci probe functions are called.
> - * This usbhs core driver should be initialized after
> - * usb tll driver
> - */
> -fs_initcall_sync(omap_usbhs_drvinit);
> -
> -static void __exit omap_usbhs_drvexit(void)
> -{
> -	platform_driver_unregister(&usbhs_omap_driver);
> -}
> -module_exit(omap_usbhs_drvexit);
> -- 
> Regards,
> 
> Laurent Pinchart
Laurent Pinchart Sept. 11, 2018, 4:12 p.m. UTC | #3
On Tuesday, 11 September 2018 18:53:19 EEST Ladislav Michl wrote:
> On Tue, Sep 11, 2018 at 06:06:08PM +0300, Laurent Pinchart wrote:
> > The omap-usb-host driver uses platform_driver_probe() in the fs initcall
> > level to ensure that the devices get probed before the EHCI and OHCI
> > drivers arer probed.
> > 
> > The EHCI and OHCI devices are created and registered by the omap-usb-host
> > driver, and if no driver is present yet to handle them they will
> > patiently wait for they turn without any adverse effect. This mechanism
> > is thus not needed, remove it.
> > 
> > This fixes a bug that prevents EHCI and OHCI devices from being probed
> > on the Pandaboard since commit 84badc5ec5fc ("ARM: dts: omap4: Move l4
> > child devices to probe them with ti-sysc"), as then omap-usb-host
> > devices are now registered after the omap-usb-host driver initializes,
> > and thus fail to probe due to platform_driver_probe() not finding any
> > device.
> > 
> > Fixes: 84badc5ec5fc ("ARM: dts: omap4: Move l4 child devices to probe them
> > with ti-sysc") Signed-off-by: Laurent Pinchart
> > <laurent.pinchart@ideasonboard.com> ---
> > 
> >  drivers/mfd/omap-usb-host.c | 24 ++++--------------------
> >  1 file changed, 4 insertions(+), 20 deletions(-)
> > 
> > diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
> > index e11ab12fbdf2..b731026541f5 100644
> > --- a/drivers/mfd/omap-usb-host.c
> > +++ b/drivers/mfd/omap-usb-host.c
> > @@ -548,6 +548,7 @@ static int usbhs_omap_probe(struct platform_device
> > *pdev)> 
> >  	int				i;
> >  	bool				need_logic_fck;
> > 
> > +	dev_info(&pdev->dev, "%s\n", __func__);
> 
> Is it indentional? Seems like debug leftover.

Clearly a debug leftover, sorry about that.

> >  	if (dev->of_node) {
> >  	
> >  		/* For DT boot we populate platform data from OF node */
> >  		pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> > 
> > @@ -855,31 +856,14 @@ static struct platform_driver usbhs_omap_driver = {
> > 
> >  		.pm		= &usbhsomap_dev_pm_ops,
> >  		.of_match_table = usbhs_omap_dt_ids,
> >  	
> >  	},
> > 
> > +	.probe		= usbhs_omap_probe,
> > 
> >  	.remove		= usbhs_omap_remove,
> >  
> >  };
> > 
> > +module_platform_driver(usbhs_omap_driver);
> > +
> > 
> >  MODULE_AUTHOR("Keshava Munegowda <keshava_mgowda@ti.com>");
> >  MODULE_AUTHOR("Roger Quadros <rogerq@ti.com>");
> >  MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
> >  MODULE_LICENSE("GPL v2");
> >  MODULE_DESCRIPTION("usb host common core driver for omap EHCI and OHCI");
> > 
> > -
> > -static int __init omap_usbhs_drvinit(void)
> > -{
> > -	return platform_driver_probe(&usbhs_omap_driver, usbhs_omap_probe);
> > -}
> > -
> > -/*
> > - * init before ehci and ohci drivers;
> > - * The usbhs core driver should be initialized much before
> > - * the omap ehci and ohci probe functions are called.
> > - * This usbhs core driver should be initialized after
> > - * usb tll driver
> > - */
> > -fs_initcall_sync(omap_usbhs_drvinit);
> > -
> > -static void __exit omap_usbhs_drvexit(void)
> > -{
> > -	platform_driver_unregister(&usbhs_omap_driver);
> > -}
> > -module_exit(omap_usbhs_drvexit);
diff mbox series

Patch

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index e11ab12fbdf2..b731026541f5 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -548,6 +548,7 @@  static int usbhs_omap_probe(struct platform_device *pdev)
 	int				i;
 	bool				need_logic_fck;
 
+	dev_info(&pdev->dev, "%s\n", __func__);
 	if (dev->of_node) {
 		/* For DT boot we populate platform data from OF node */
 		pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
@@ -855,31 +856,14 @@  static struct platform_driver usbhs_omap_driver = {
 		.pm		= &usbhsomap_dev_pm_ops,
 		.of_match_table = usbhs_omap_dt_ids,
 	},
+	.probe		= usbhs_omap_probe,
 	.remove		= usbhs_omap_remove,
 };
 
+module_platform_driver(usbhs_omap_driver);
+
 MODULE_AUTHOR("Keshava Munegowda <keshava_mgowda@ti.com>");
 MODULE_AUTHOR("Roger Quadros <rogerq@ti.com>");
 MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("usb host common core driver for omap EHCI and OHCI");
-
-static int __init omap_usbhs_drvinit(void)
-{
-	return platform_driver_probe(&usbhs_omap_driver, usbhs_omap_probe);
-}
-
-/*
- * init before ehci and ohci drivers;
- * The usbhs core driver should be initialized much before
- * the omap ehci and ohci probe functions are called.
- * This usbhs core driver should be initialized after
- * usb tll driver
- */
-fs_initcall_sync(omap_usbhs_drvinit);
-
-static void __exit omap_usbhs_drvexit(void)
-{
-	platform_driver_unregister(&usbhs_omap_driver);
-}
-module_exit(omap_usbhs_drvexit);