Re: [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support

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

 




* Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> [170523 09:57]:
> On Mon, 22 May 2017, Tony Lindgren wrote:
> > Alan, do you have some better ideas for the ohci_platform_remove()
> > path below?
...
> > --- a/drivers/usb/host/ohci-platform.c
> > +++ b/drivers/usb/host/ohci-platform.c
> > @@ -290,7 +294,14 @@ static int ohci_platform_remove(struct platform_device *dev)
> >  	struct usb_hcd *hcd = platform_get_drvdata(dev);
> >  	struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev);
> >  	struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
> > -	int clk, rst;
> > +	int clk, rst, enabled;
> > +
> > +	enabled = pm_runtime_get_sync(&dev->dev);
> > +	if (enabled < 0) {
> > +		dev_warn(&dev->dev, "pm_runtime_get failed: %i\n",
> > +			 enabled);
> > +		pm_runtime_put_noidle(&dev->dev);
> > +	}
> 
> I wouldn't worry about checking the return value.  There's no 
> particular reason for this call to fail, is there?

OK yeah if it was to fail it would already fail on probe
already :)

> >  	usb_remove_hcd(hcd);
> >  
> > @@ -305,6 +316,10 @@ static int ohci_platform_remove(struct platform_device *dev)
> >  
> >  	usb_put_hcd(hcd);
> >  
> > +	if (enabled >= 0)
> > +		pm_runtime_put_sync(&dev->dev);
> > +	pm_runtime_disable(&dev->dev);
> 
> And here you could just do the put_sync, with no test.  If the get_sync
> failed then this will probably fail too, but you won't be any worse off
> for the attempt.

OK fine with me.

Thanks,

Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux