diff mbox

usb: phy-generic: Don't fail on missing gpio reset

Message ID 1422323129-20969-1-git-send-email-soren.brinkmann@xilinx.com
State New
Headers show

Commit Message

Soren Brinkmann Jan. 27, 2015, 1:45 a.m. UTC
A reset through a GPIO is optional. Don't fail probing when it is
missing.

Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
Hi Andreas,

does this do the trick?

	Thanks,
	Sören

 drivers/usb/phy/phy-generic.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Felipe Balbi Jan. 27, 2015, 3:20 p.m. UTC | #1
On Mon, Jan 26, 2015 at 05:45:29PM -0800, Soren Brinkmann wrote:
> A reset through a GPIO is optional. Don't fail probing when it is
> missing.
> 
> Reported-by: Andreas Färber <afaerber@suse.de>
> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
> ---
> Hi Andreas,
> 
> does this do the trick?
> 
> 	Thanks,
> 	Sören
> 
>  drivers/usb/phy/phy-generic.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
> index dd05254241fb..a73d4c738f0b 100644
> --- a/drivers/usb/phy/phy-generic.c
> +++ b/drivers/usb/phy/phy-generic.c
> @@ -241,10 +241,8 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,
>  
>  	if (err == -EPROBE_DEFER)
>  		return -EPROBE_DEFER;
> -	if (err) {
> -		dev_err(dev, "Error requesting RESET GPIO\n");
> -		return err;
> -	}
> +	if (err)
> +		nop->gpiod_reset = NULL;

there's a better patch to use gpiod_get_optional(), instead.
Arnd Bergmann Jan. 27, 2015, 3:24 p.m. UTC | #2
On Monday 26 January 2015 17:45:29 Soren Brinkmann wrote:
> diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
> index dd05254241fb..a73d4c738f0b 100644
> --- a/drivers/usb/phy/phy-generic.c
> +++ b/drivers/usb/phy/phy-generic.c
> @@ -241,10 +241,8 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,
>  
>         if (err == -EPROBE_DEFER)
>                 return -EPROBE_DEFER;
> -       if (err) {
> -               dev_err(dev, "Error requesting RESET GPIO\n");
> -               return err;
> -       }
> +       if (err)
> +               nop->gpiod_reset = NULL;

You might want to distinguish between a missing property and a
reset gpio that was specified but for some reason cannot be used.

	Arnd
Soren Brinkmann Jan. 27, 2015, 7:13 p.m. UTC | #3
On Tue, 2015-01-27 at 09:20AM -0600, Felipe Balbi wrote:
> On Mon, Jan 26, 2015 at 05:45:29PM -0800, Soren Brinkmann wrote:
> > A reset through a GPIO is optional. Don't fail probing when it is
> > missing.
> > 
> > Reported-by: Andreas Färber <afaerber@suse.de>
> > Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
> > ---
> > Hi Andreas,
> > 
> > does this do the trick?
> > 
> > 	Thanks,
> > 	Sören
> > 
> >  drivers/usb/phy/phy-generic.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
> > index dd05254241fb..a73d4c738f0b 100644
> > --- a/drivers/usb/phy/phy-generic.c
> > +++ b/drivers/usb/phy/phy-generic.c
> > @@ -241,10 +241,8 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,
> >  
> >  	if (err == -EPROBE_DEFER)
> >  		return -EPROBE_DEFER;
> > -	if (err) {
> > -		dev_err(dev, "Error requesting RESET GPIO\n");
> > -		return err;
> > -	}
> > +	if (err)
> > +		nop->gpiod_reset = NULL;
> 
> there's a better patch to use gpiod_get_optional(), instead.

Great, apparently that wasn't in linux-next yesterday. I'll give it a
shot once it arrives there.

	Sören
Felipe Balbi Jan. 27, 2015, 7:14 p.m. UTC | #4
On Tue, Jan 27, 2015 at 11:13:08AM -0800, Sören Brinkmann wrote:
> On Tue, 2015-01-27 at 09:20AM -0600, Felipe Balbi wrote:
> > On Mon, Jan 26, 2015 at 05:45:29PM -0800, Soren Brinkmann wrote:
> > > A reset through a GPIO is optional. Don't fail probing when it is
> > > missing.
> > > 
> > > Reported-by: Andreas Färber <afaerber@suse.de>
> > > Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
> > > ---
> > > Hi Andreas,
> > > 
> > > does this do the trick?
> > > 
> > > 	Thanks,
> > > 	Sören
> > > 
> > >  drivers/usb/phy/phy-generic.c | 6 ++----
> > >  1 file changed, 2 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
> > > index dd05254241fb..a73d4c738f0b 100644
> > > --- a/drivers/usb/phy/phy-generic.c
> > > +++ b/drivers/usb/phy/phy-generic.c
> > > @@ -241,10 +241,8 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,
> > >  
> > >  	if (err == -EPROBE_DEFER)
> > >  		return -EPROBE_DEFER;
> > > -	if (err) {
> > > -		dev_err(dev, "Error requesting RESET GPIO\n");
> > > -		return err;
> > > -	}
> > > +	if (err)
> > > +		nop->gpiod_reset = NULL;
> > 
> > there's a better patch to use gpiod_get_optional(), instead.
> 
> Great, apparently that wasn't in linux-next yesterday. I'll give it a
> shot once it arrives there.

It's still under discussion ;-)
diff mbox

Patch

diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
index dd05254241fb..a73d4c738f0b 100644
--- a/drivers/usb/phy/phy-generic.c
+++ b/drivers/usb/phy/phy-generic.c
@@ -241,10 +241,8 @@  int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,
 
 	if (err == -EPROBE_DEFER)
 		return -EPROBE_DEFER;
-	if (err) {
-		dev_err(dev, "Error requesting RESET GPIO\n");
-		return err;
-	}
+	if (err)
+		nop->gpiod_reset = NULL;
 
 	nop->phy.otg = devm_kzalloc(dev, sizeof(*nop->phy.otg),
 			GFP_KERNEL);