linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / core: Cleanup some function definitions in power.h
@ 2019-10-16 14:16 Ulf Hansson
  2019-11-08 11:40 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Ulf Hansson @ 2019-10-16 14:16 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-pm; +Cc: Ulf Hansson

The power.h is a bit messy due to the various existing CONFIG_PM* Kconfig
combinations. However the final section for wakeup_source_sysfs*() can be
moved inside one of the existing sections rather than adding yet another
one, so let's do that to clean up the code a little bit.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/base/power/power.h | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index 39a06a0cfdaa..444f5c169a0b 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -117,6 +117,13 @@ static inline bool device_pm_initialized(struct device *dev)
 	return dev->power.in_dpm_list;
 }
 
+/* drivers/base/power/wakeup_stats.c */
+extern int wakeup_source_sysfs_add(struct device *parent,
+				   struct wakeup_source *ws);
+extern void wakeup_source_sysfs_remove(struct wakeup_source *ws);
+
+extern int pm_wakeup_source_sysfs_add(struct device *parent);
+
 #else /* !CONFIG_PM_SLEEP */
 
 static inline void device_pm_sleep_init(struct device *dev) {}
@@ -141,6 +148,11 @@ static inline bool device_pm_initialized(struct device *dev)
 	return device_is_registered(dev);
 }
 
+static inline int pm_wakeup_source_sysfs_add(struct device *parent)
+{
+	return 0;
+}
+
 #endif /* !CONFIG_PM_SLEEP */
 
 static inline void device_pm_init(struct device *dev)
@@ -149,21 +161,3 @@ static inline void device_pm_init(struct device *dev)
 	device_pm_sleep_init(dev);
 	pm_runtime_init(dev);
 }
-
-#ifdef CONFIG_PM_SLEEP
-
-/* drivers/base/power/wakeup_stats.c */
-extern int wakeup_source_sysfs_add(struct device *parent,
-				   struct wakeup_source *ws);
-extern void wakeup_source_sysfs_remove(struct wakeup_source *ws);
-
-extern int pm_wakeup_source_sysfs_add(struct device *parent);
-
-#else /* !CONFIG_PM_SLEEP */
-
-static inline int pm_wakeup_source_sysfs_add(struct device *parent)
-{
-	return 0;
-}
-
-#endif /* CONFIG_PM_SLEEP */
-- 
2.17.1


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

* Re: [PATCH] PM / core: Cleanup some function definitions in power.h
  2019-10-16 14:16 [PATCH] PM / core: Cleanup some function definitions in power.h Ulf Hansson
@ 2019-11-08 11:40 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2019-11-08 11:40 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-pm

On Wednesday, October 16, 2019 4:16:27 PM CET Ulf Hansson wrote:
> The power.h is a bit messy due to the various existing CONFIG_PM* Kconfig
> combinations. However the final section for wakeup_source_sysfs*() can be
> moved inside one of the existing sections rather than adding yet another
> one, so let's do that to clean up the code a little bit.

Fair enough.

> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  drivers/base/power/power.h | 30 ++++++++++++------------------
>  1 file changed, 12 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
> index 39a06a0cfdaa..444f5c169a0b 100644
> --- a/drivers/base/power/power.h
> +++ b/drivers/base/power/power.h
> @@ -117,6 +117,13 @@ static inline bool device_pm_initialized(struct device *dev)
>  	return dev->power.in_dpm_list;
>  }
>  
> +/* drivers/base/power/wakeup_stats.c */
> +extern int wakeup_source_sysfs_add(struct device *parent,
> +				   struct wakeup_source *ws);
> +extern void wakeup_source_sysfs_remove(struct wakeup_source *ws);
> +
> +extern int pm_wakeup_source_sysfs_add(struct device *parent);
> +
>  #else /* !CONFIG_PM_SLEEP */
>  
>  static inline void device_pm_sleep_init(struct device *dev) {}
> @@ -141,6 +148,11 @@ static inline bool device_pm_initialized(struct device *dev)
>  	return device_is_registered(dev);
>  }
>  
> +static inline int pm_wakeup_source_sysfs_add(struct device *parent)
> +{
> +	return 0;
> +}
> +
>  #endif /* !CONFIG_PM_SLEEP */
>  
>  static inline void device_pm_init(struct device *dev)
> @@ -149,21 +161,3 @@ static inline void device_pm_init(struct device *dev)
>  	device_pm_sleep_init(dev);
>  	pm_runtime_init(dev);
>  }
> -
> -#ifdef CONFIG_PM_SLEEP
> -
> -/* drivers/base/power/wakeup_stats.c */
> -extern int wakeup_source_sysfs_add(struct device *parent,
> -				   struct wakeup_source *ws);
> -extern void wakeup_source_sysfs_remove(struct wakeup_source *ws);
> -
> -extern int pm_wakeup_source_sysfs_add(struct device *parent);
> -
> -#else /* !CONFIG_PM_SLEEP */
> -
> -static inline int pm_wakeup_source_sysfs_add(struct device *parent)
> -{
> -	return 0;
> -}
> -
> -#endif /* CONFIG_PM_SLEEP */
> 

Applying as 5.5 material, thanks!




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

end of thread, other threads:[~2019-11-08 12:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 14:16 [PATCH] PM / core: Cleanup some function definitions in power.h Ulf Hansson
2019-11-08 11:40 ` Rafael J. Wysocki

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