On 10/26/2015 2:29 AM, Alexander Aring wrote: > This patch changes devm_phy_get to devm_phy_optional_get. Which fixes the > error handling when trying to get the phy. Currently on all errors we > try to look for an old style USB PHY. With this patch we try to look for > an old USB PHY when devm_phy_get returns -ENOENT Should be -ENODEV > only. Other values like > -EPROBE_DEFER need to be returned from the probe function, because it > could be that a phy is specified but not probed before. > > Suggested-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> > Cc: John Youn <johnyoun@xxxxxxxxxxxx> > Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> > Cc: Stephen Warren <swarren@xxxxxxxxxxxxx> > Signed-off-by: Alexander Aring <alex.aring@xxxxxxxxx> > --- > changes since v2: > - was in v1 named as "dwc2: wait for usb phy while probing" > - use devm_phy_optional_get which was suggested by Uwe Kleine-König, > we need to handle more than -EPROBE_DEFER here, e.g. -ENOMEM. > devm_phy_optional_get will return NULL, when no "usb2-phy" is specified. > (devm_phy_get returned -ENOENT). > > drivers/usb/dwc2/platform.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c > index 9093530..277fd40 100644 > --- a/drivers/usb/dwc2/platform.c > +++ b/drivers/usb/dwc2/platform.c > @@ -222,12 +222,15 @@ static int dwc2_driver_probe(struct platform_device *dev) > > hsotg->dr_mode = of_usb_get_dr_mode(dev->dev.of_node); > > + phy = devm_phy_optional_get(&dev->dev, "usb2-phy"); > + if (IS_ERR(phy)) > + return PTR_ERR(phy); > + > /* > * Attempt to find a generic PHY, then look for an old style > * USB PHY > */ > - phy = devm_phy_get(&dev->dev, "usb2-phy"); > - if (IS_ERR(phy)) { > + if (!phy) { > hsotg->phy = NULL; > uphy = devm_usb_get_phy(&dev->dev, USB_PHY_TYPE_USB2); > if (IS_ERR(uphy)) > Also could you respin this off of Felipe Balbi's "next" branch. His repo is here: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb Regards, John -- 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