linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [1/2] phy: core: Add phy_pm_runtime_enabled
@ 2018-11-17 13:37 ` Tony Lindgren
  2018-11-17 15:38   ` Johan Hovold
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2018-11-17 13:37 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: linux-kernel, linux-usb, linux-omap, Pavel Machek,
	Sebastian Reichel

The phy driver may need to check phy_pm_runtime_enabled() in suspend as
PM runtime for phy may be already disabled when phy power_off() is called.

Cc: Pavel Machek <pavel@ucw.cz>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/phy/phy-core.c  | 9 +++++++++
 include/linux/phy/phy.h | 6 ++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -209,6 +209,15 @@ int phy_pm_runtime_put_sync(struct phy *phy)
 }
 EXPORT_SYMBOL_GPL(phy_pm_runtime_put_sync);
 
+bool phy_pm_runtime_enabled(struct phy *phy)
+{
+	if (!phy)
+		return false;
+
+	return pm_runtime_enabled(&phy->dev);
+}
+EXPORT_SYMBOL_GPL(phy_pm_runtime_enabled);
+
 void phy_pm_runtime_allow(struct phy *phy)
 {
 	if (!phy)
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -158,6 +158,7 @@ int phy_pm_runtime_get(struct phy *phy);
 int phy_pm_runtime_get_sync(struct phy *phy);
 int phy_pm_runtime_put(struct phy *phy);
 int phy_pm_runtime_put_sync(struct phy *phy);
+bool phy_pm_runtime_enabled(struct phy *phy);
 void phy_pm_runtime_allow(struct phy *phy);
 void phy_pm_runtime_forbid(struct phy *phy);
 int phy_init(struct phy *phy);
@@ -240,6 +241,11 @@ static inline int phy_pm_runtime_put_sync(struct phy *phy)
 	return -ENOSYS;
 }
 
+static inline bool phy_pm_runtime_enabled(struct phy *phy)
+{
+	return false
+}
+
 static inline void phy_pm_runtime_allow(struct phy *phy)
 {
 	return;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [1/2] phy: core: Add phy_pm_runtime_enabled
@ 2018-11-17 15:38   ` Johan Hovold
  2018-11-17 15:43     ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Johan Hovold @ 2018-11-17 15:38 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Kishon Vijay Abraham I, linux-kernel, linux-usb, linux-omap,
	Pavel Machek, Sebastian Reichel

On Sat, Nov 17, 2018 at 05:37:54AM -0800, Tony Lindgren wrote:
> The phy driver may need to check phy_pm_runtime_enabled() in suspend as
> PM runtime for phy may be already disabled when phy power_off() is called.
> 
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Sebastian Reichel <sre@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/phy/phy-core.c  | 9 +++++++++
>  include/linux/phy/phy.h | 6 ++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c

> diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
> --- a/include/linux/phy/phy.h
> +++ b/include/linux/phy/phy.h
> @@ -158,6 +158,7 @@ int phy_pm_runtime_get(struct phy *phy);
>  int phy_pm_runtime_get_sync(struct phy *phy);
>  int phy_pm_runtime_put(struct phy *phy);
>  int phy_pm_runtime_put_sync(struct phy *phy);
> +bool phy_pm_runtime_enabled(struct phy *phy);
>  void phy_pm_runtime_allow(struct phy *phy);
>  void phy_pm_runtime_forbid(struct phy *phy);
>  int phy_init(struct phy *phy);
> @@ -240,6 +241,11 @@ static inline int phy_pm_runtime_put_sync(struct phy *phy)
>  	return -ENOSYS;
>  }
>  
> +static inline bool phy_pm_runtime_enabled(struct phy *phy)
> +{
> +	return false

Missing semicolon.

> +}
> +
>  static inline void phy_pm_runtime_allow(struct phy *phy)
>  {
>  	return;

Johan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [1/2] phy: core: Add phy_pm_runtime_enabled
@ 2018-11-17 15:43     ` Tony Lindgren
  2019-06-02 10:14       ` [PATCH 1/2] " Pavel Machek
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2018-11-17 15:43 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Kishon Vijay Abraham I, linux-kernel, linux-usb, linux-omap,
	Pavel Machek, Sebastian Reichel

* Johan Hovold <johan@kernel.org> [181117 15:38]:
> On Sat, Nov 17, 2018 at 05:37:54AM -0800, Tony Lindgren wrote:
> > The phy driver may need to check phy_pm_runtime_enabled() in suspend as
> > PM runtime for phy may be already disabled when phy power_off() is called.
> > 
> > Cc: Pavel Machek <pavel@ucw.cz>
> > Cc: Sebastian Reichel <sre@kernel.org>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > ---
> >  drivers/phy/phy-core.c  | 9 +++++++++
> >  include/linux/phy/phy.h | 6 ++++++
> >  2 files changed, 15 insertions(+)
> > 
> > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> > --- a/drivers/phy/phy-core.c
> > +++ b/drivers/phy/phy-core.c
> 
> > diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
> > --- a/include/linux/phy/phy.h
> > +++ b/include/linux/phy/phy.h
> > @@ -158,6 +158,7 @@ int phy_pm_runtime_get(struct phy *phy);
> >  int phy_pm_runtime_get_sync(struct phy *phy);
> >  int phy_pm_runtime_put(struct phy *phy);
> >  int phy_pm_runtime_put_sync(struct phy *phy);
> > +bool phy_pm_runtime_enabled(struct phy *phy);
> >  void phy_pm_runtime_allow(struct phy *phy);
> >  void phy_pm_runtime_forbid(struct phy *phy);
> >  int phy_init(struct phy *phy);
> > @@ -240,6 +241,11 @@ static inline int phy_pm_runtime_put_sync(struct phy *phy)
> >  	return -ENOSYS;
> >  }
> >  
> > +static inline bool phy_pm_runtime_enabled(struct phy *phy)
> > +{
> > +	return false
> 
> Missing semicolon.

Oops thanks for catching that. I guess I did not try building
without CONFIG_GENERIC_PHY. Will fix and repost.

Regards,

Tony

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [1/2] phy: core: Add phy_pm_runtime_enabled
@ 2018-11-19 14:46 kbuild test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2018-11-19 14:46 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: kbuild-all, Kishon Vijay Abraham I, linux-kernel, linux-usb,
	linux-omap, Pavel Machek, Sebastian Reichel

Hi Tony,

I love your patch! Yet something to improve:

[auto build test ERROR on phy/next]
[also build test ERROR on v4.20-rc3 next-20181119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Tony-Lindgren/Improve-phy-mapphone-pm/20181119-222603
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git next
config: riscv-tinyconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 8.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=8.1.0 make.cross ARCH=riscv 

All errors (new ones prefixed by >>):

   In file included from include/linux/usb/otg.h:13,
                    from include/linux/usb/of.h:12,
                    from drivers/usb/phy/of.c:9:
   include/linux/phy/phy.h: In function 'phy_pm_runtime_enabled':
>> include/linux/phy/phy.h:246:14: error: expected ';' before '}' token
     return false
                 ^
                 ;
    }
    ~             

vim +246 include/linux/phy/phy.h

   243	
   244	static inline bool phy_pm_runtime_enabled(struct phy *phy)
   245	{
 > 246		return false
   247	}
   248
---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] phy: core: Add phy_pm_runtime_enabled
  2018-11-17 15:43     ` Tony Lindgren
@ 2019-06-02 10:14       ` Pavel Machek
  2019-06-02 10:25         ` Pavel Machek
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Machek @ 2019-06-02 10:14 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Johan Hovold, Kishon Vijay Abraham I, linux-kernel, linux-usb,
	linux-omap, Sebastian Reichel

Hi!

> > > The phy driver may need to check phy_pm_runtime_enabled() in suspend as
> > > PM runtime for phy may be already disabled when phy power_off() is called.
> > > 
> > > Cc: Pavel Machek <pavel@ucw.cz>
> > > Cc: Sebastian Reichel <sre@kernel.org>
> > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > > ---
> > >  drivers/phy/phy-core.c  | 9 +++++++++
> > >  include/linux/phy/phy.h | 6 ++++++
> > >  2 files changed, 15 insertions(+)
> > > 
> > > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> > > --- a/drivers/phy/phy-core.c
> > > +++ b/drivers/phy/phy-core.c
> > 
> > > diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
> > > --- a/include/linux/phy/phy.h
> > > +++ b/include/linux/phy/phy.h
> > > @@ -158,6 +158,7 @@ int phy_pm_runtime_get(struct phy *phy);
> > >  int phy_pm_runtime_get_sync(struct phy *phy);
> > >  int phy_pm_runtime_put(struct phy *phy);
> > >  int phy_pm_runtime_put_sync(struct phy *phy);
> > > +bool phy_pm_runtime_enabled(struct phy *phy);
> > >  void phy_pm_runtime_allow(struct phy *phy);
> > >  void phy_pm_runtime_forbid(struct phy *phy);
> > >  int phy_init(struct phy *phy);
> > > @@ -240,6 +241,11 @@ static inline int phy_pm_runtime_put_sync(struct phy *phy)
> > >  	return -ENOSYS;
> > >  }
> > >  
> > > +static inline bool phy_pm_runtime_enabled(struct phy *phy)
> > > +{
> > > +	return false
> > 
> > Missing semicolon.
> 
> Oops thanks for catching that. I guess I did not try building
> without CONFIG_GENERIC_PHY. Will fix and repost.

Did this series get lost/forgotten somewhere? Is it still needed? Any
way I can help?
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] phy: core: Add phy_pm_runtime_enabled
  2019-06-02 10:14       ` [PATCH 1/2] " Pavel Machek
@ 2019-06-02 10:25         ` Pavel Machek
  0 siblings, 0 replies; 6+ messages in thread
From: Pavel Machek @ 2019-06-02 10:25 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Johan Hovold, Kishon Vijay Abraham I, linux-kernel, linux-usb,
	linux-omap, Sebastian Reichel

Hi!

> > > > @@ -240,6 +241,11 @@ static inline int phy_pm_runtime_put_sync(struct phy *phy)
> > > >  	return -ENOSYS;
> > > >  }
> > > >  
> > > > +static inline bool phy_pm_runtime_enabled(struct phy *phy)
> > > > +{
> > > > +	return false
> > > 
> > > Missing semicolon.
> > 
> > Oops thanks for catching that. I guess I did not try building
> > without CONFIG_GENERIC_PHY. Will fix and repost.
> 
> Did this series get lost/forgotten somewhere? Is it still needed? Any
> way I can help?

Aha, it seems v2 of the series was applied, which touches different
files and that's why I did not detect it. Sorry for the noise.

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-02 10:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20181117133755.9129-1-tony@atomide.com>
2018-11-17 13:37 ` [1/2] phy: core: Add phy_pm_runtime_enabled Tony Lindgren
2018-11-17 15:38   ` Johan Hovold
2018-11-17 15:43     ` Tony Lindgren
2019-06-02 10:14       ` [PATCH 1/2] " Pavel Machek
2019-06-02 10:25         ` Pavel Machek
2018-11-19 14:46 [1/2] " kbuild test robot

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).