* [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support [not found] ` <20170525161333.32639-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> @ 2017-05-25 16:13 ` Tony Lindgren [not found] ` <20170525161333.32639-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Tony Lindgren @ 2017-05-25 16:13 UTC (permalink / raw) To: Alan Stern Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring, Roger Quadros, Sebastian Reichel, Yoshihiro Shimoda This is needed in preparation of adding support for omap3 and later OHCI. The runtime PM will only do something on platforms that implement it. Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> Cc: Sebastian Reichel <sebastian.reichel-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> --- drivers/usb/host/ohci-platform.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -24,6 +24,7 @@ #include <linux/err.h> #include <linux/phy/phy.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include <linux/reset.h> #include <linux/usb/ohci_pdriver.h> #include <linux/usb.h> @@ -242,6 +243,8 @@ static int ohci_platform_probe(struct platform_device *dev) } #endif + pm_runtime_set_active(&dev->dev); + pm_runtime_enable(&dev->dev); if (pdata->power_on) { err = pdata->power_on(dev); if (err < 0) @@ -271,6 +274,7 @@ static int ohci_platform_probe(struct platform_device *dev) if (pdata->power_off) pdata->power_off(dev); err_reset: + pm_runtime_disable(&dev->dev); while (--rst >= 0) reset_control_assert(priv->resets[rst]); err_put_clks: @@ -292,6 +296,7 @@ static int ohci_platform_remove(struct platform_device *dev) struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); int clk, rst; + pm_runtime_get_sync(&dev->dev); usb_remove_hcd(hcd); if (pdata->power_off) @@ -305,6 +310,9 @@ static int ohci_platform_remove(struct platform_device *dev) usb_put_hcd(hcd); + pm_runtime_put_sync(&dev->dev); + pm_runtime_disable(&dev->dev); + if (pdata == &ohci_platform_defaults) dev->dev.platform_data = NULL; -- 2.13.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20170525161333.32639-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support [not found] ` <20170525161333.32639-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> @ 2017-05-25 16:45 ` Alan Stern 2017-05-26 7:28 ` Roger Quadros 1 sibling, 0 replies; 9+ messages in thread From: Alan Stern @ 2017-05-25 16:45 UTC (permalink / raw) To: Tony Lindgren Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring, Roger Quadros, Sebastian Reichel, Yoshihiro Shimoda On Thu, 25 May 2017, Tony Lindgren wrote: > This is needed in preparation of adding support for omap3 and > later OHCI. The runtime PM will only do something on platforms > that implement it. > > Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> > Cc: Sebastian Reichel <sebastian.reichel-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org> > Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> > Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> > --- > drivers/usb/host/ohci-platform.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c > --- a/drivers/usb/host/ohci-platform.c > +++ b/drivers/usb/host/ohci-platform.c > @@ -24,6 +24,7 @@ > #include <linux/err.h> > #include <linux/phy/phy.h> > #include <linux/platform_device.h> > +#include <linux/pm_runtime.h> > #include <linux/reset.h> > #include <linux/usb/ohci_pdriver.h> > #include <linux/usb.h> > @@ -242,6 +243,8 @@ static int ohci_platform_probe(struct platform_device *dev) > } > #endif > > + pm_runtime_set_active(&dev->dev); > + pm_runtime_enable(&dev->dev); > if (pdata->power_on) { > err = pdata->power_on(dev); > if (err < 0) > @@ -271,6 +274,7 @@ static int ohci_platform_probe(struct platform_device *dev) > if (pdata->power_off) > pdata->power_off(dev); > err_reset: > + pm_runtime_disable(&dev->dev); > while (--rst >= 0) > reset_control_assert(priv->resets[rst]); > err_put_clks: > @@ -292,6 +296,7 @@ static int ohci_platform_remove(struct platform_device *dev) > struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); > int clk, rst; > > + pm_runtime_get_sync(&dev->dev); > usb_remove_hcd(hcd); > > if (pdata->power_off) > @@ -305,6 +310,9 @@ static int ohci_platform_remove(struct platform_device *dev) > > usb_put_hcd(hcd); > > + pm_runtime_put_sync(&dev->dev); > + pm_runtime_disable(&dev->dev); > + > if (pdata == &ohci_platform_defaults) > dev->dev.platform_data = NULL; Acked-by: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org> -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support [not found] ` <20170525161333.32639-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 2017-05-25 16:45 ` Alan Stern @ 2017-05-26 7:28 ` Roger Quadros 1 sibling, 0 replies; 9+ messages in thread From: Roger Quadros @ 2017-05-26 7:28 UTC (permalink / raw) To: Tony Lindgren, Alan Stern Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring, Sebastian Reichel, Yoshihiro Shimoda On 25/05/17 19:13, Tony Lindgren wrote: > This is needed in preparation of adding support for omap3 and > later OHCI. The runtime PM will only do something on platforms > that implement it. > > Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> > Cc: Sebastian Reichel <sebastian.reichel-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org> > Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> > Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> Acked-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> > --- > drivers/usb/host/ohci-platform.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c > --- a/drivers/usb/host/ohci-platform.c > +++ b/drivers/usb/host/ohci-platform.c > @@ -24,6 +24,7 @@ > #include <linux/err.h> > #include <linux/phy/phy.h> > #include <linux/platform_device.h> > +#include <linux/pm_runtime.h> > #include <linux/reset.h> > #include <linux/usb/ohci_pdriver.h> > #include <linux/usb.h> > @@ -242,6 +243,8 @@ static int ohci_platform_probe(struct platform_device *dev) > } > #endif > > + pm_runtime_set_active(&dev->dev); > + pm_runtime_enable(&dev->dev); > if (pdata->power_on) { > err = pdata->power_on(dev); > if (err < 0) > @@ -271,6 +274,7 @@ static int ohci_platform_probe(struct platform_device *dev) > if (pdata->power_off) > pdata->power_off(dev); > err_reset: > + pm_runtime_disable(&dev->dev); > while (--rst >= 0) > reset_control_assert(priv->resets[rst]); > err_put_clks: > @@ -292,6 +296,7 @@ static int ohci_platform_remove(struct platform_device *dev) > struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); > int clk, rst; > > + pm_runtime_get_sync(&dev->dev); > usb_remove_hcd(hcd); > > if (pdata->power_off) > @@ -305,6 +310,9 @@ static int ohci_platform_remove(struct platform_device *dev) > > usb_put_hcd(hcd); > > + pm_runtime_put_sync(&dev->dev); > + pm_runtime_disable(&dev->dev); > + > if (pdata == &ohci_platform_defaults) > dev->dev.platform_data = NULL; > > -- cheers, -roger -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20170522160007.9264-1-tony@atomide.com>]
[parent not found: <20170522160007.9264-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>]
* [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support [not found] ` <20170522160007.9264-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> @ 2017-05-22 16:00 ` Tony Lindgren [not found] ` <20170522160007.9264-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Tony Lindgren @ 2017-05-22 16:00 UTC (permalink / raw) To: Alan Stern Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring, Roger Quadros, Sebastian Reichel, Yoshihiro Shimoda This is needed in preparation of adding support for omap3 and later OHCI. The runtime PM will only do something on platforms that implement it. Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> Cc: Sebastian Reichel <sebastian.reichel-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> --- Alan, do you have some better ideas for the ohci_platform_remove() path below? --- drivers/usb/host/ohci-platform.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -24,6 +24,7 @@ #include <linux/err.h> #include <linux/phy/phy.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include <linux/reset.h> #include <linux/usb/ohci_pdriver.h> #include <linux/usb.h> @@ -242,6 +243,8 @@ static int ohci_platform_probe(struct platform_device *dev) } #endif + pm_runtime_set_active(&dev->dev); + pm_runtime_enable(&dev->dev); if (pdata->power_on) { err = pdata->power_on(dev); if (err < 0) @@ -271,6 +274,7 @@ static int ohci_platform_probe(struct platform_device *dev) if (pdata->power_off) pdata->power_off(dev); err_reset: + pm_runtime_disable(&dev->dev); while (--rst >= 0) reset_control_assert(priv->resets[rst]); err_put_clks: @@ -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); + } 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); + if (pdata == &ohci_platform_defaults) dev->dev.platform_data = NULL; -- 2.13.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20170522160007.9264-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support [not found] ` <20170522160007.9264-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> @ 2017-05-23 7:11 ` Roger Quadros [not found] ` <c040a768-dd2e-a85d-fb3f-3088988f61aa-l0cyMroinI0@public.gmane.org> 2017-05-23 16:53 ` Alan Stern 1 sibling, 1 reply; 9+ messages in thread From: Roger Quadros @ 2017-05-23 7:11 UTC (permalink / raw) To: Tony Lindgren, Alan Stern Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring, Sebastian Reichel, Yoshihiro Shimoda Hi, On 22/05/17 19:00, Tony Lindgren wrote: > This is needed in preparation of adding support for omap3 and > later OHCI. The runtime PM will only do something on platforms > that implement it. > > Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> > Cc: Sebastian Reichel <sebastian.reichel-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org> > Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> > Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> > --- > > Alan, do you have some better ideas for the ohci_platform_remove() > path below? > > --- > drivers/usb/host/ohci-platform.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c > --- a/drivers/usb/host/ohci-platform.c > +++ b/drivers/usb/host/ohci-platform.c > @@ -24,6 +24,7 @@ > #include <linux/err.h> > #include <linux/phy/phy.h> > #include <linux/platform_device.h> > +#include <linux/pm_runtime.h> > #include <linux/reset.h> > #include <linux/usb/ohci_pdriver.h> > #include <linux/usb.h> > @@ -242,6 +243,8 @@ static int ohci_platform_probe(struct platform_device *dev) > } > #endif > > + pm_runtime_set_active(&dev->dev); > + pm_runtime_enable(&dev->dev); > if (pdata->power_on) { > err = pdata->power_on(dev); > if (err < 0) > @@ -271,6 +274,7 @@ static int ohci_platform_probe(struct platform_device *dev) > if (pdata->power_off) > pdata->power_off(dev); > err_reset: > + pm_runtime_disable(&dev->dev); > while (--rst >= 0) > reset_control_assert(priv->resets[rst]); > err_put_clks: > @@ -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); Why do we need to pm_runtime_get_sync() here? > + if (enabled < 0) { > + dev_warn(&dev->dev, "pm_runtime_get failed: %i\n", > + enabled); > + pm_runtime_put_noidle(&dev->dev); > + } > > 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); > + > if (pdata == &ohci_platform_defaults) > dev->dev.platform_data = NULL; > > -- cheers, -roger -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <c040a768-dd2e-a85d-fb3f-3088988f61aa-l0cyMroinI0@public.gmane.org>]
* Re: [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support [not found] ` <c040a768-dd2e-a85d-fb3f-3088988f61aa-l0cyMroinI0@public.gmane.org> @ 2017-05-23 14:08 ` Tony Lindgren [not found] ` <20170523140831.GV10472-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Tony Lindgren @ 2017-05-23 14:08 UTC (permalink / raw) To: Roger Quadros Cc: Alan Stern, Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring, Sebastian Reichel, Yoshihiro Shimoda * Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> [170523 00:14]: > On 22/05/17 19:00, Tony Lindgren wrote: > > --- 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); > > Why do we need to pm_runtime_get_sync() here? ohci_platform_remove() usb_remove_hcd() ohci_stop() Will cause "external abort on non-linefetch" otherwise. Regards, Tony -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20170523140831.GV10472-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support [not found] ` <20170523140831.GV10472-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> @ 2017-05-24 7:23 ` Roger Quadros 0 siblings, 0 replies; 9+ messages in thread From: Roger Quadros @ 2017-05-24 7:23 UTC (permalink / raw) To: Tony Lindgren Cc: Alan Stern, Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring, Sebastian Reichel, Yoshihiro Shimoda On 23/05/17 17:08, Tony Lindgren wrote: > * Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> [170523 00:14]: >> On 22/05/17 19:00, Tony Lindgren wrote: >>> --- 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); >> >> Why do we need to pm_runtime_get_sync() here? > > ohci_platform_remove() > usb_remove_hcd() > ohci_stop() > > Will cause "external abort on non-linefetch" otherwise. Got it, thanks. > > Regards, > > Tony > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- cheers, -roger -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support [not found] ` <20170522160007.9264-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 2017-05-23 7:11 ` Roger Quadros @ 2017-05-23 16:53 ` Alan Stern [not found] ` <Pine.LNX.4.44L0.1705231250110.1853-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org> 1 sibling, 1 reply; 9+ messages in thread From: Alan Stern @ 2017-05-23 16:53 UTC (permalink / raw) To: Tony Lindgren Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring, Roger Quadros, Sebastian Reichel, Yoshihiro Shimoda On Mon, 22 May 2017, Tony Lindgren wrote: > This is needed in preparation of adding support for omap3 and > later OHCI. The runtime PM will only do something on platforms > that implement it. > > Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > Cc: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > Cc: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> > Cc: Sebastian Reichel <sebastian.reichel-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org> > Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> > Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> > --- > > Alan, do you have some better ideas for the ohci_platform_remove() > path below? > > --- > drivers/usb/host/ohci-platform.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c > --- a/drivers/usb/host/ohci-platform.c > +++ b/drivers/usb/host/ohci-platform.c > @@ -24,6 +24,7 @@ > #include <linux/err.h> > #include <linux/phy/phy.h> > #include <linux/platform_device.h> > +#include <linux/pm_runtime.h> > #include <linux/reset.h> > #include <linux/usb/ohci_pdriver.h> > #include <linux/usb.h> > @@ -242,6 +243,8 @@ static int ohci_platform_probe(struct platform_device *dev) > } > #endif > > + pm_runtime_set_active(&dev->dev); > + pm_runtime_enable(&dev->dev); > if (pdata->power_on) { > err = pdata->power_on(dev); > if (err < 0) > @@ -271,6 +274,7 @@ static int ohci_platform_probe(struct platform_device *dev) > if (pdata->power_off) > pdata->power_off(dev); > err_reset: > + pm_runtime_disable(&dev->dev); > while (--rst >= 0) > reset_control_assert(priv->resets[rst]); > err_put_clks: > @@ -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? > > 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. Alan Stern > + > if (pdata == &ohci_platform_defaults) > dev->dev.platform_data = NULL; -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <Pine.LNX.4.44L0.1705231250110.1853-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>]
* Re: [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support [not found] ` <Pine.LNX.4.44L0.1705231250110.1853-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org> @ 2017-05-23 17:46 ` Tony Lindgren 0 siblings, 0 replies; 9+ messages in thread From: Tony Lindgren @ 2017-05-23 17:46 UTC (permalink / raw) To: Alan Stern Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, Rob Herring, Roger Quadros, Sebastian Reichel, Yoshihiro Shimoda * Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org> [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 linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-05-26 7:28 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20170525161333.32639-1-tony@atomide.com> [not found] ` <20170525161333.32639-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 2017-05-25 16:13 ` [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support Tony Lindgren [not found] ` <20170525161333.32639-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 2017-05-25 16:45 ` Alan Stern 2017-05-26 7:28 ` Roger Quadros [not found] <20170522160007.9264-1-tony@atomide.com> [not found] ` <20170522160007.9264-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 2017-05-22 16:00 ` Tony Lindgren [not found] ` <20170522160007.9264-2-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 2017-05-23 7:11 ` Roger Quadros [not found] ` <c040a768-dd2e-a85d-fb3f-3088988f61aa-l0cyMroinI0@public.gmane.org> 2017-05-23 14:08 ` Tony Lindgren [not found] ` <20170523140831.GV10472-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 2017-05-24 7:23 ` Roger Quadros 2017-05-23 16:53 ` Alan Stern [not found] ` <Pine.LNX.4.44L0.1705231250110.1853-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org> 2017-05-23 17:46 ` Tony Lindgren
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).