On Wed, May 17, 2017 at 04:53:07AM +0000, Yoshihiro Shimoda wrote:
> Hi Johan,
>
> > From: Johan Hovold
> > Sent: Tuesday, May 16, 2017 11:26 PM
> >
> > Make sure do drop the reference taken to the companion device during
> > resume.
> >
> > Fixes: d4d75128b8fd ("usb: host: ehci-platform: fix usb 1.1 device is not
> > connected in system resume")
> > Cc: stable <[email protected]> # 4.11
> > Cc: Yoshihiro Shimoda <[email protected]>
> > Signed-off-by: Johan Hovold <[email protected]>
> > ---
> > drivers/usb/host/ehci-platform.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/host/ehci-platform.c
> > b/drivers/usb/host/ehci-platform.c
> > index bc7b9be12f54..f1908ea9fbd8 100644
> > --- a/drivers/usb/host/ehci-platform.c
> > +++ b/drivers/usb/host/ehci-platform.c
> > @@ -384,8 +384,10 @@ static int ehci_platform_resume(struct device *dev)
> > }
> >
> > companion_dev = usb_of_get_companion_dev(hcd->self.controller);
> > - if (companion_dev)
> > + if (companion_dev) {
> > device_pm_wait_for_dev(hcd->self.controller, companion_dev);
> > + put_device(companion_dev);
>
> Thank you for the patch!
>
> I should have added an API like "usb_of_put_companion_dev(dev)"
> and it calls "of_dev_put(to_platform_device(dev))". And then,
> ehci_platform_resume() can call the API instead of put_device().
> But, adding new API is not good for stable.
I don't think that's needed or desirable. The helper returns a pointer
to a struct device with an incremented refcount, so just using
put_device() when done is the right thing to do.
Note that I added a comment about the refcount to the helper in patch
2/2 as a reminder for any future users.
> So,
>
> Acked-by: Yoshihiro Shimoda <[email protected]>
Thanks,
Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html