public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: chipidea: imx: properly check for usbmisc
@ 2015-08-06 13:09 Tomeu Vizoso
  2015-08-07  2:11 ` Peter Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Tomeu Vizoso @ 2015-08-06 13:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tomeu Vizoso, Peter Chen, Greg Kroah-Hartman, linux-usb

If usbmisc hasn't probed yet, defer the probe.

It's not enough to check if the platform device for the OF node of the
usbmisc has been registered, but it also needs to have been probed
already before we can call imx_usbmisc_init().

This can happen if the order in which devices are probed change due to
async probing or on-demand probing of dependencies.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
 drivers/usb/chipidea/ci_hdrc_imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 504554e41922..e3c61d5e9270 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -104,7 +104,7 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
 	misc_pdev = of_find_device_by_node(args.np);
 	of_node_put(args.np);
 
-	if (!misc_pdev)
+	if (!misc_pdev || !platform_get_drvdata(misc_pdev))
 		return ERR_PTR(-EPROBE_DEFER);
 
 	data->dev = &misc_pdev->dev;
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: chipidea: imx: properly check for usbmisc
  2015-08-06 13:09 [PATCH] usb: chipidea: imx: properly check for usbmisc Tomeu Vizoso
@ 2015-08-07  2:11 ` Peter Chen
  2015-08-07  4:46   ` Peter Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Chen @ 2015-08-07  2:11 UTC (permalink / raw)
  To: Tomeu Vizoso; +Cc: linux-kernel, Greg Kroah-Hartman, linux-usb

On Thu, Aug 06, 2015 at 03:09:54PM +0200, Tomeu Vizoso wrote:
> If usbmisc hasn't probed yet, defer the probe.
> 
> It's not enough to check if the platform device for the OF node of the
> usbmisc has been registered, but it also needs to have been probed
> already before we can call imx_usbmisc_init().
> 
> This can happen if the order in which devices are probed change due to
> async probing or on-demand probing of dependencies.
> 
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> ---
>  drivers/usb/chipidea/ci_hdrc_imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> index 504554e41922..e3c61d5e9270 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> @@ -104,7 +104,7 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
>  	misc_pdev = of_find_device_by_node(args.np);
>  	of_node_put(args.np);
>  
> -	if (!misc_pdev)
> +	if (!misc_pdev || !platform_get_drvdata(misc_pdev))
>  		return ERR_PTR(-EPROBE_DEFER);

"||"? or "&&"? You want usbmisc has already been probed.


>  
>  	data->dev = &misc_pdev->dev;
> -- 
> 2.4.3
> 

-- 

Best Regards,
Peter Chen

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: chipidea: imx: properly check for usbmisc
  2015-08-07  2:11 ` Peter Chen
@ 2015-08-07  4:46   ` Peter Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Chen @ 2015-08-07  4:46 UTC (permalink / raw)
  To: Tomeu Vizoso; +Cc: linux-kernel, Greg Kroah-Hartman, linux-usb

On Fri, Aug 07, 2015 at 10:11:47AM +0800, Peter Chen wrote:
> On Thu, Aug 06, 2015 at 03:09:54PM +0200, Tomeu Vizoso wrote:
> > If usbmisc hasn't probed yet, defer the probe.
> > 
> > It's not enough to check if the platform device for the OF node of the
> > usbmisc has been registered, but it also needs to have been probed
> > already before we can call imx_usbmisc_init().
> > 
> > This can happen if the order in which devices are probed change due to
> > async probing or on-demand probing of dependencies.
> > 
> > Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> > ---
> >  drivers/usb/chipidea/ci_hdrc_imx.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> > index 504554e41922..e3c61d5e9270 100644
> > --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> > +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> > @@ -104,7 +104,7 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
> >  	misc_pdev = of_find_device_by_node(args.np);
> >  	of_node_put(args.np);
> >  
> > -	if (!misc_pdev)
> > +	if (!misc_pdev || !platform_get_drvdata(misc_pdev))
> >  		return ERR_PTR(-EPROBE_DEFER);
> 
> "||"? or "&&"? You want usbmisc has already been probed.

Oh, oops. The patch is right, I will queue it.

-- 

Best Regards,
Peter Chen

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-07  5:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-06 13:09 [PATCH] usb: chipidea: imx: properly check for usbmisc Tomeu Vizoso
2015-08-07  2:11 ` Peter Chen
2015-08-07  4:46   ` Peter Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox