Re: [PATCH v1] USB: musb: defer probe if transceiver is not ready

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 21, 2012 at 10:36:37PM +0800, Ming Lei wrote:
> On Wed, Nov 21, 2012 at 10:09 PM, Felipe Balbi <balbi@xxxxxx> wrote:
> >>       status = musb_platform_init(musb);
> >> -     if (status < 0)
> >> +     if (status < 0) {
> >> +             /* try to defer probe if trasceiver is not ready */
> >> +             status = (status == -ENODEV ? -EPROBE_DEFER : status);
> >
> > still wrong, what you should do is that when you can't get the phy, you
> > set status to -EPROBE_DEFER, instead of -ENODEV.
> 
> The above code does set status to to -EPROBE_DEFER when phy can't
> be got, doesn't it?

What he meant was probably something like:

@@ -1059,25 +1059,25 @@ static int tusb_musb_start(struct musb *musb)
 }
 
 static int tusb_musb_init(struct musb *musb)
 {
 	struct platform_device  *pdev;
 	struct resource         *mem;
 	void __iomem            *sync = NULL;
 	int                     ret;
 
 	usb_nop_xceiv_register();
 	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 	if (IS_ERR_OR_NULL(musb->xceiv))
 		return -ENODEV;
+		return -EPROBE_DEFER;
 
 	pdev = to_platform_device(musb->controller);
 
 	/* dma address for async dma */
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	musb->async = mem->start;
 
 	/* dma address for sync dma */
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 	if (!mem) {
 		pr_debug("no sync dma resource?\n");
 		ret = -ENODEV;

As you see there is a second ENODEV error code which has nothing to do with the
missing PHY. That is what I meant by a larger patch.

Sebastian
--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux