Message ID | 20241210-s2r-cdns-v6-3-28a17f9715a2@bootlin.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Fix USB suspend on TI J7200 (cdns3-ti, cdns3, xhci) | expand |
On 24-12-10 18:13:37, Théo Lebrun wrote: > The cdns_role_driver->resume() callback takes a second boolean argument > named `hibernated` in its implementations. This is mistaken; the only > potential caller is: > > int cdns_resume(struct cdns *cdns) > { > /* ... */ > > if (cdns->roles[cdns->role]->resume) > cdns->roles[cdns->role]->resume(cdns, cdns_power_is_lost(cdns)); > > return 0; > } > > The argument can be true in cases outside of return from hibernation. > Reflect the true meaning by renaming both arguments to `lost_power`. > > Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com> Acked-by: Peter Chen <peter.chen@kernel.org> Peter > --- > drivers/usb/cdns3/cdns3-gadget.c | 4 ++-- > drivers/usb/cdns3/cdnsp-gadget.c | 2 +- > drivers/usb/cdns3/core.h | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c > index fd1beb10bba726cef258e7438d642f31d6567dfe..694aa14577390b6e9a98ce8c4685ac8f56e43ad4 100644 > --- a/drivers/usb/cdns3/cdns3-gadget.c > +++ b/drivers/usb/cdns3/cdns3-gadget.c > @@ -3468,7 +3468,7 @@ __must_hold(&cdns->lock) > return 0; > } > > -static int cdns3_gadget_resume(struct cdns *cdns, bool hibernated) > +static int cdns3_gadget_resume(struct cdns *cdns, bool lost_power) > { > struct cdns3_device *priv_dev = cdns->gadget_dev; > > @@ -3476,7 +3476,7 @@ static int cdns3_gadget_resume(struct cdns *cdns, bool hibernated) > return 0; > > cdns3_gadget_config(priv_dev); > - if (hibernated) > + if (lost_power) > writel(USB_CONF_DEVEN, &priv_dev->regs->usb_conf); > > return 0; > diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c > index 4a3f0f95825698f0524cace5c06bfcf27f763149..7d05180442fb94c5d1aab3d8ef766e365685f454 100644 > --- a/drivers/usb/cdns3/cdnsp-gadget.c > +++ b/drivers/usb/cdns3/cdnsp-gadget.c > @@ -1973,7 +1973,7 @@ static int cdnsp_gadget_suspend(struct cdns *cdns, bool do_wakeup) > return 0; > } > > -static int cdnsp_gadget_resume(struct cdns *cdns, bool hibernated) > +static int cdnsp_gadget_resume(struct cdns *cdns, bool lost_power) > { > struct cdnsp_device *pdev = cdns->gadget_dev; > enum usb_device_speed max_speed; > diff --git a/drivers/usb/cdns3/core.h b/drivers/usb/cdns3/core.h > index 57d47348dc193b1060f4543c2ef22905f464293b..921cccf1ca9db27a66b06c7c7873b13537c74b05 100644 > --- a/drivers/usb/cdns3/core.h > +++ b/drivers/usb/cdns3/core.h > @@ -30,7 +30,7 @@ struct cdns_role_driver { > int (*start)(struct cdns *cdns); > void (*stop)(struct cdns *cdns); > int (*suspend)(struct cdns *cdns, bool do_wakeup); > - int (*resume)(struct cdns *cdns, bool hibernated); > + int (*resume)(struct cdns *cdns, bool lost_power); > const char *name; > #define CDNS_ROLE_STATE_INACTIVE 0 > #define CDNS_ROLE_STATE_ACTIVE 1 > > -- > 2.47.1 >
diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c index fd1beb10bba726cef258e7438d642f31d6567dfe..694aa14577390b6e9a98ce8c4685ac8f56e43ad4 100644 --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -3468,7 +3468,7 @@ __must_hold(&cdns->lock) return 0; } -static int cdns3_gadget_resume(struct cdns *cdns, bool hibernated) +static int cdns3_gadget_resume(struct cdns *cdns, bool lost_power) { struct cdns3_device *priv_dev = cdns->gadget_dev; @@ -3476,7 +3476,7 @@ static int cdns3_gadget_resume(struct cdns *cdns, bool hibernated) return 0; cdns3_gadget_config(priv_dev); - if (hibernated) + if (lost_power) writel(USB_CONF_DEVEN, &priv_dev->regs->usb_conf); return 0; diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c index 4a3f0f95825698f0524cace5c06bfcf27f763149..7d05180442fb94c5d1aab3d8ef766e365685f454 100644 --- a/drivers/usb/cdns3/cdnsp-gadget.c +++ b/drivers/usb/cdns3/cdnsp-gadget.c @@ -1973,7 +1973,7 @@ static int cdnsp_gadget_suspend(struct cdns *cdns, bool do_wakeup) return 0; } -static int cdnsp_gadget_resume(struct cdns *cdns, bool hibernated) +static int cdnsp_gadget_resume(struct cdns *cdns, bool lost_power) { struct cdnsp_device *pdev = cdns->gadget_dev; enum usb_device_speed max_speed; diff --git a/drivers/usb/cdns3/core.h b/drivers/usb/cdns3/core.h index 57d47348dc193b1060f4543c2ef22905f464293b..921cccf1ca9db27a66b06c7c7873b13537c74b05 100644 --- a/drivers/usb/cdns3/core.h +++ b/drivers/usb/cdns3/core.h @@ -30,7 +30,7 @@ struct cdns_role_driver { int (*start)(struct cdns *cdns); void (*stop)(struct cdns *cdns); int (*suspend)(struct cdns *cdns, bool do_wakeup); - int (*resume)(struct cdns *cdns, bool hibernated); + int (*resume)(struct cdns *cdns, bool lost_power); const char *name; #define CDNS_ROLE_STATE_INACTIVE 0 #define CDNS_ROLE_STATE_ACTIVE 1
The cdns_role_driver->resume() callback takes a second boolean argument named `hibernated` in its implementations. This is mistaken; the only potential caller is: int cdns_resume(struct cdns *cdns) { /* ... */ if (cdns->roles[cdns->role]->resume) cdns->roles[cdns->role]->resume(cdns, cdns_power_is_lost(cdns)); return 0; } The argument can be true in cases outside of return from hibernation. Reflect the true meaning by renaming both arguments to `lost_power`. Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com> --- drivers/usb/cdns3/cdns3-gadget.c | 4 ++-- drivers/usb/cdns3/cdnsp-gadget.c | 2 +- drivers/usb/cdns3/core.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)