linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] PM: domains: create debugfs nodes when adding power domains
@ 2020-12-08 19:19 Thierry Strudel
  2020-12-08 19:51 ` Greg Kroah-Hartman
  2020-12-10  7:16 ` Ulf Hansson
  0 siblings, 2 replies; 6+ messages in thread
From: Thierry Strudel @ 2020-12-08 19:19 UTC (permalink / raw)
  To: Rafael J. Wysocki, Kevin Hilman, Ulf Hansson
  Cc: Greg Kroah-Hartman, linux-pm, linux-kernel, Thierry Strudel

debugfs nodes were created in genpd_debug_init alled in late_initcall
preventing power domains registered though loadable modules to have
a debugfs entry.

Create/remove debugfs nodes when the power domain is added/removed
to/from the internal gpd_list.

Signed-off-by: Thierry Strudel <tstrudel@google.com>
Change-Id: I8a2e0616746afe2a6bbd9c24bc3a0eaa84725a75
---
v2: fix forward declaration and genpd_debugfs_dir being NULL - Ulf
v3: remove extra trailing char added by mistake in v2 - kernel test robot
v4: cleanup includes and regroup CONFIG_DEBUG_FS CPP blocks - Greg
 drivers/base/power/domain.c | 73 +++++++++++++++++++++++--------------
 1 file changed, 45 insertions(+), 28 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 2cb5e04cf86c..49c87607cba7 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -21,6 +21,7 @@
 #include <linux/suspend.h>
 #include <linux/export.h>
 #include <linux/cpu.h>
+#include <linux/debugfs.h>
 
 #include "power.h"
 
@@ -210,6 +211,18 @@ static void genpd_sd_counter_inc(struct generic_pm_domain *genpd)
 }
 
 #ifdef CONFIG_DEBUG_FS
+static struct dentry *genpd_debugfs_dir;
+
+static void genpd_debug_add(struct generic_pm_domain *genpd);
+
+static void genpd_debug_remove(struct generic_pm_domain *genpd)
+{
+	struct dentry *d;
+
+	d = debugfs_lookup(genpd->name, genpd_debugfs_dir);
+	debugfs_remove(d);
+}
+
 static void genpd_update_accounting(struct generic_pm_domain *genpd)
 {
 	ktime_t delta, now;
@@ -234,6 +247,8 @@ static void genpd_update_accounting(struct generic_pm_domain *genpd)
 	genpd->accounting_time = now;
 }
 #else
+static inline void genpd_debug_add(struct generic_pm_domain *genpd) {}
+static inline void genpd_debug_remove(struct generic_pm_domain *genpd) {}
 static inline void genpd_update_accounting(struct generic_pm_domain *genpd) {}
 #endif
 
@@ -1827,6 +1842,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
 
 	mutex_lock(&gpd_list_lock);
 	list_add(&genpd->gpd_list_node, &gpd_list);
+	genpd_debug_add(genpd);
 	mutex_unlock(&gpd_list_lock);
 
 	return 0;
@@ -1860,6 +1876,7 @@ static int genpd_remove(struct generic_pm_domain *genpd)
 		kfree(link);
 	}
 
+	genpd_debug_remove(genpd);
 	list_del(&genpd->gpd_list_node);
 	genpd_unlock(genpd);
 	cancel_work_sync(&genpd->power_off_work);
@@ -2764,14 +2781,6 @@ core_initcall(genpd_bus_init);
 /***        debugfs support        ***/
 
 #ifdef CONFIG_DEBUG_FS
-#include <linux/pm.h>
-#include <linux/device.h>
-#include <linux/debugfs.h>
-#include <linux/seq_file.h>
-#include <linux/init.h>
-#include <linux/kobject.h>
-static struct dentry *genpd_debugfs_dir;
-
 /*
  * TODO: This function is a slightly modified version of rtpm_status_show
  * from sysfs.c, so generalize it.
@@ -3047,9 +3056,34 @@ DEFINE_SHOW_ATTRIBUTE(total_idle_time);
 DEFINE_SHOW_ATTRIBUTE(devices);
 DEFINE_SHOW_ATTRIBUTE(perf_state);
 
-static int __init genpd_debug_init(void)
+static void genpd_debug_add(struct generic_pm_domain *genpd)
 {
 	struct dentry *d;
+
+	if (!genpd_debugfs_dir)
+		return;
+
+	d = debugfs_create_dir(genpd->name, genpd_debugfs_dir);
+
+	debugfs_create_file("current_state", 0444,
+			    d, genpd, &status_fops);
+	debugfs_create_file("sub_domains", 0444,
+			    d, genpd, &sub_domains_fops);
+	debugfs_create_file("idle_states", 0444,
+			    d, genpd, &idle_states_fops);
+	debugfs_create_file("active_time", 0444,
+			    d, genpd, &active_time_fops);
+	debugfs_create_file("total_idle_time", 0444,
+			    d, genpd, &total_idle_time_fops);
+	debugfs_create_file("devices", 0444,
+			    d, genpd, &devices_fops);
+	if (genpd->set_performance_state)
+		debugfs_create_file("perf_state", 0444,
+				    d, genpd, &perf_state_fops);
+}
+
+static int __init genpd_debug_init(void)
+{
 	struct generic_pm_domain *genpd;
 
 	genpd_debugfs_dir = debugfs_create_dir("pm_genpd", NULL);
@@ -3057,25 +3091,8 @@ static int __init genpd_debug_init(void)
 	debugfs_create_file("pm_genpd_summary", S_IRUGO, genpd_debugfs_dir,
 			    NULL, &summary_fops);
 
-	list_for_each_entry(genpd, &gpd_list, gpd_list_node) {
-		d = debugfs_create_dir(genpd->name, genpd_debugfs_dir);
-
-		debugfs_create_file("current_state", 0444,
-				d, genpd, &status_fops);
-		debugfs_create_file("sub_domains", 0444,
-				d, genpd, &sub_domains_fops);
-		debugfs_create_file("idle_states", 0444,
-				d, genpd, &idle_states_fops);
-		debugfs_create_file("active_time", 0444,
-				d, genpd, &active_time_fops);
-		debugfs_create_file("total_idle_time", 0444,
-				d, genpd, &total_idle_time_fops);
-		debugfs_create_file("devices", 0444,
-				d, genpd, &devices_fops);
-		if (genpd->set_performance_state)
-			debugfs_create_file("perf_state", 0444,
-					    d, genpd, &perf_state_fops);
-	}
+	list_for_each_entry(genpd, &gpd_list, gpd_list_node)
+		genpd_debug_add(genpd);
 
 	return 0;
 }
-- 
2.29.2.576.ga3fc446d84-goog


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

* Re: [PATCH v4] PM: domains: create debugfs nodes when adding power domains
  2020-12-08 19:19 [PATCH v4] PM: domains: create debugfs nodes when adding power domains Thierry Strudel
@ 2020-12-08 19:51 ` Greg Kroah-Hartman
  2020-12-08 20:40   ` Thierry Strudel
  2020-12-09 15:32   ` Rafael J. Wysocki
  2020-12-10  7:16 ` Ulf Hansson
  1 sibling, 2 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-08 19:51 UTC (permalink / raw)
  To: Thierry Strudel
  Cc: Rafael J. Wysocki, Kevin Hilman, Ulf Hansson, linux-pm, linux-kernel

On Tue, Dec 08, 2020 at 11:19:55AM -0800, Thierry Strudel wrote:
> debugfs nodes were created in genpd_debug_init alled in late_initcall
> preventing power domains registered though loadable modules to have
> a debugfs entry.
> 
> Create/remove debugfs nodes when the power domain is added/removed
> to/from the internal gpd_list.
> 
> Signed-off-by: Thierry Strudel <tstrudel@google.com>
> Change-Id: I8a2e0616746afe2a6bbd9c24bc3a0eaa84725a75

You don't need this, checkpatch.pl should have warned you :)

> ---
> v2: fix forward declaration and genpd_debugfs_dir being NULL - Ulf
> v3: remove extra trailing char added by mistake in v2 - kernel test robot
> v4: cleanup includes and regroup CONFIG_DEBUG_FS CPP blocks - Greg
>  drivers/base/power/domain.c | 73 +++++++++++++++++++++++--------------
>  1 file changed, 45 insertions(+), 28 deletions(-)

Looks good to me, thanks for fixing it up.  Rafael, will this go through
your tree?

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH v4] PM: domains: create debugfs nodes when adding power domains
  2020-12-08 19:51 ` Greg Kroah-Hartman
@ 2020-12-08 20:40   ` Thierry Strudel
  2020-12-09 15:32   ` Rafael J. Wysocki
  1 sibling, 0 replies; 6+ messages in thread
From: Thierry Strudel @ 2020-12-08 20:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rafael J. Wysocki, Kevin Hilman, Ulf Hansson, Linux PM,
	Linux Kernel Mailing List

Sorry about that.
Thanks for the reviews

On Tue, Dec 8, 2020 at 11:49 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Tue, Dec 08, 2020 at 11:19:55AM -0800, Thierry Strudel wrote:
> > debugfs nodes were created in genpd_debug_init alled in late_initcall
> > preventing power domains registered though loadable modules to have
> > a debugfs entry.
> >
> > Create/remove debugfs nodes when the power domain is added/removed
> > to/from the internal gpd_list.
> >
> > Signed-off-by: Thierry Strudel <tstrudel@google.com>
> > Change-Id: I8a2e0616746afe2a6bbd9c24bc3a0eaa84725a75
>
> You don't need this, checkpatch.pl should have warned you :)
>
> > ---
> > v2: fix forward declaration and genpd_debugfs_dir being NULL - Ulf
> > v3: remove extra trailing char added by mistake in v2 - kernel test robot
> > v4: cleanup includes and regroup CONFIG_DEBUG_FS CPP blocks - Greg
> >  drivers/base/power/domain.c | 73 +++++++++++++++++++++++--------------
> >  1 file changed, 45 insertions(+), 28 deletions(-)
>
> Looks good to me, thanks for fixing it up.  Rafael, will this go through
> your tree?
>
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH v4] PM: domains: create debugfs nodes when adding power domains
  2020-12-08 19:51 ` Greg Kroah-Hartman
  2020-12-08 20:40   ` Thierry Strudel
@ 2020-12-09 15:32   ` Rafael J. Wysocki
  1 sibling, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2020-12-09 15:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Thierry Strudel, Rafael J. Wysocki, Kevin Hilman, Ulf Hansson,
	Linux PM, Linux Kernel Mailing List

On Tue, Dec 8, 2020 at 9:39 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Tue, Dec 08, 2020 at 11:19:55AM -0800, Thierry Strudel wrote:
> > debugfs nodes were created in genpd_debug_init alled in late_initcall
> > preventing power domains registered though loadable modules to have
> > a debugfs entry.
> >
> > Create/remove debugfs nodes when the power domain is added/removed
> > to/from the internal gpd_list.
> >
> > Signed-off-by: Thierry Strudel <tstrudel@google.com>
> > Change-Id: I8a2e0616746afe2a6bbd9c24bc3a0eaa84725a75
>
> You don't need this, checkpatch.pl should have warned you :)
>
> > ---
> > v2: fix forward declaration and genpd_debugfs_dir being NULL - Ulf
> > v3: remove extra trailing char added by mistake in v2 - kernel test robot
> > v4: cleanup includes and regroup CONFIG_DEBUG_FS CPP blocks - Greg
> >  drivers/base/power/domain.c | 73 +++++++++++++++++++++++--------------
> >  1 file changed, 45 insertions(+), 28 deletions(-)
>
> Looks good to me, thanks for fixing it up.  Rafael, will this go through
> your tree?

I can pick it up.

> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH v4] PM: domains: create debugfs nodes when adding power domains
  2020-12-08 19:19 [PATCH v4] PM: domains: create debugfs nodes when adding power domains Thierry Strudel
  2020-12-08 19:51 ` Greg Kroah-Hartman
@ 2020-12-10  7:16 ` Ulf Hansson
  2020-12-10 18:51   ` Rafael J. Wysocki
  1 sibling, 1 reply; 6+ messages in thread
From: Ulf Hansson @ 2020-12-10  7:16 UTC (permalink / raw)
  To: Thierry Strudel
  Cc: Rafael J. Wysocki, Kevin Hilman, Greg Kroah-Hartman, Linux PM,
	Linux Kernel Mailing List

On Tue, 8 Dec 2020 at 20:20, Thierry Strudel <tstrudel@google.com> wrote:
>
> debugfs nodes were created in genpd_debug_init alled in late_initcall
> preventing power domains registered though loadable modules to have
> a debugfs entry.
>
> Create/remove debugfs nodes when the power domain is added/removed
> to/from the internal gpd_list.
>
> Signed-off-by: Thierry Strudel <tstrudel@google.com>
> Change-Id: I8a2e0616746afe2a6bbd9c24bc3a0eaa84725a75

Thierry, thanks for fixing this!

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
> v2: fix forward declaration and genpd_debugfs_dir being NULL - Ulf
> v3: remove extra trailing char added by mistake in v2 - kernel test robot
> v4: cleanup includes and regroup CONFIG_DEBUG_FS CPP blocks - Greg
>  drivers/base/power/domain.c | 73 +++++++++++++++++++++++--------------
>  1 file changed, 45 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 2cb5e04cf86c..49c87607cba7 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -21,6 +21,7 @@
>  #include <linux/suspend.h>
>  #include <linux/export.h>
>  #include <linux/cpu.h>
> +#include <linux/debugfs.h>
>
>  #include "power.h"
>
> @@ -210,6 +211,18 @@ static void genpd_sd_counter_inc(struct generic_pm_domain *genpd)
>  }
>
>  #ifdef CONFIG_DEBUG_FS
> +static struct dentry *genpd_debugfs_dir;
> +
> +static void genpd_debug_add(struct generic_pm_domain *genpd);
> +
> +static void genpd_debug_remove(struct generic_pm_domain *genpd)
> +{
> +       struct dentry *d;
> +
> +       d = debugfs_lookup(genpd->name, genpd_debugfs_dir);
> +       debugfs_remove(d);
> +}
> +
>  static void genpd_update_accounting(struct generic_pm_domain *genpd)
>  {
>         ktime_t delta, now;
> @@ -234,6 +247,8 @@ static void genpd_update_accounting(struct generic_pm_domain *genpd)
>         genpd->accounting_time = now;
>  }
>  #else
> +static inline void genpd_debug_add(struct generic_pm_domain *genpd) {}
> +static inline void genpd_debug_remove(struct generic_pm_domain *genpd) {}
>  static inline void genpd_update_accounting(struct generic_pm_domain *genpd) {}
>  #endif
>
> @@ -1827,6 +1842,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
>
>         mutex_lock(&gpd_list_lock);
>         list_add(&genpd->gpd_list_node, &gpd_list);
> +       genpd_debug_add(genpd);
>         mutex_unlock(&gpd_list_lock);
>
>         return 0;
> @@ -1860,6 +1876,7 @@ static int genpd_remove(struct generic_pm_domain *genpd)
>                 kfree(link);
>         }
>
> +       genpd_debug_remove(genpd);
>         list_del(&genpd->gpd_list_node);
>         genpd_unlock(genpd);
>         cancel_work_sync(&genpd->power_off_work);
> @@ -2764,14 +2781,6 @@ core_initcall(genpd_bus_init);
>  /***        debugfs support        ***/
>
>  #ifdef CONFIG_DEBUG_FS
> -#include <linux/pm.h>
> -#include <linux/device.h>
> -#include <linux/debugfs.h>
> -#include <linux/seq_file.h>
> -#include <linux/init.h>
> -#include <linux/kobject.h>
> -static struct dentry *genpd_debugfs_dir;
> -
>  /*
>   * TODO: This function is a slightly modified version of rtpm_status_show
>   * from sysfs.c, so generalize it.
> @@ -3047,9 +3056,34 @@ DEFINE_SHOW_ATTRIBUTE(total_idle_time);
>  DEFINE_SHOW_ATTRIBUTE(devices);
>  DEFINE_SHOW_ATTRIBUTE(perf_state);
>
> -static int __init genpd_debug_init(void)
> +static void genpd_debug_add(struct generic_pm_domain *genpd)
>  {
>         struct dentry *d;
> +
> +       if (!genpd_debugfs_dir)
> +               return;
> +
> +       d = debugfs_create_dir(genpd->name, genpd_debugfs_dir);
> +
> +       debugfs_create_file("current_state", 0444,
> +                           d, genpd, &status_fops);
> +       debugfs_create_file("sub_domains", 0444,
> +                           d, genpd, &sub_domains_fops);
> +       debugfs_create_file("idle_states", 0444,
> +                           d, genpd, &idle_states_fops);
> +       debugfs_create_file("active_time", 0444,
> +                           d, genpd, &active_time_fops);
> +       debugfs_create_file("total_idle_time", 0444,
> +                           d, genpd, &total_idle_time_fops);
> +       debugfs_create_file("devices", 0444,
> +                           d, genpd, &devices_fops);
> +       if (genpd->set_performance_state)
> +               debugfs_create_file("perf_state", 0444,
> +                                   d, genpd, &perf_state_fops);
> +}
> +
> +static int __init genpd_debug_init(void)
> +{
>         struct generic_pm_domain *genpd;
>
>         genpd_debugfs_dir = debugfs_create_dir("pm_genpd", NULL);
> @@ -3057,25 +3091,8 @@ static int __init genpd_debug_init(void)
>         debugfs_create_file("pm_genpd_summary", S_IRUGO, genpd_debugfs_dir,
>                             NULL, &summary_fops);
>
> -       list_for_each_entry(genpd, &gpd_list, gpd_list_node) {
> -               d = debugfs_create_dir(genpd->name, genpd_debugfs_dir);
> -
> -               debugfs_create_file("current_state", 0444,
> -                               d, genpd, &status_fops);
> -               debugfs_create_file("sub_domains", 0444,
> -                               d, genpd, &sub_domains_fops);
> -               debugfs_create_file("idle_states", 0444,
> -                               d, genpd, &idle_states_fops);
> -               debugfs_create_file("active_time", 0444,
> -                               d, genpd, &active_time_fops);
> -               debugfs_create_file("total_idle_time", 0444,
> -                               d, genpd, &total_idle_time_fops);
> -               debugfs_create_file("devices", 0444,
> -                               d, genpd, &devices_fops);
> -               if (genpd->set_performance_state)
> -                       debugfs_create_file("perf_state", 0444,
> -                                           d, genpd, &perf_state_fops);
> -       }
> +       list_for_each_entry(genpd, &gpd_list, gpd_list_node)
> +               genpd_debug_add(genpd);
>
>         return 0;
>  }
> --
> 2.29.2.576.ga3fc446d84-goog
>

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

* Re: [PATCH v4] PM: domains: create debugfs nodes when adding power domains
  2020-12-10  7:16 ` Ulf Hansson
@ 2020-12-10 18:51   ` Rafael J. Wysocki
  0 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2020-12-10 18:51 UTC (permalink / raw)
  To: Ulf Hansson, Thierry Strudel
  Cc: Rafael J. Wysocki, Kevin Hilman, Greg Kroah-Hartman, Linux PM,
	Linux Kernel Mailing List

On Thu, Dec 10, 2020 at 8:18 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Tue, 8 Dec 2020 at 20:20, Thierry Strudel <tstrudel@google.com> wrote:
> >
> > debugfs nodes were created in genpd_debug_init alled in late_initcall
> > preventing power domains registered though loadable modules to have
> > a debugfs entry.
> >
> > Create/remove debugfs nodes when the power domain is added/removed
> > to/from the internal gpd_list.
> >
> > Signed-off-by: Thierry Strudel <tstrudel@google.com>
> > Change-Id: I8a2e0616746afe2a6bbd9c24bc3a0eaa84725a75
>
> Thierry, thanks for fixing this!
>
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Applied now (as 5.11-rc material), thanks!

> > ---
> > v2: fix forward declaration and genpd_debugfs_dir being NULL - Ulf
> > v3: remove extra trailing char added by mistake in v2 - kernel test robot
> > v4: cleanup includes and regroup CONFIG_DEBUG_FS CPP blocks - Greg
> >  drivers/base/power/domain.c | 73 +++++++++++++++++++++++--------------
> >  1 file changed, 45 insertions(+), 28 deletions(-)
> >
> > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> > index 2cb5e04cf86c..49c87607cba7 100644
> > --- a/drivers/base/power/domain.c
> > +++ b/drivers/base/power/domain.c
> > @@ -21,6 +21,7 @@
> >  #include <linux/suspend.h>
> >  #include <linux/export.h>
> >  #include <linux/cpu.h>
> > +#include <linux/debugfs.h>
> >
> >  #include "power.h"
> >
> > @@ -210,6 +211,18 @@ static void genpd_sd_counter_inc(struct generic_pm_domain *genpd)
> >  }
> >
> >  #ifdef CONFIG_DEBUG_FS
> > +static struct dentry *genpd_debugfs_dir;
> > +
> > +static void genpd_debug_add(struct generic_pm_domain *genpd);
> > +
> > +static void genpd_debug_remove(struct generic_pm_domain *genpd)
> > +{
> > +       struct dentry *d;
> > +
> > +       d = debugfs_lookup(genpd->name, genpd_debugfs_dir);
> > +       debugfs_remove(d);
> > +}
> > +
> >  static void genpd_update_accounting(struct generic_pm_domain *genpd)
> >  {
> >         ktime_t delta, now;
> > @@ -234,6 +247,8 @@ static void genpd_update_accounting(struct generic_pm_domain *genpd)
> >         genpd->accounting_time = now;
> >  }
> >  #else
> > +static inline void genpd_debug_add(struct generic_pm_domain *genpd) {}
> > +static inline void genpd_debug_remove(struct generic_pm_domain *genpd) {}
> >  static inline void genpd_update_accounting(struct generic_pm_domain *genpd) {}
> >  #endif
> >
> > @@ -1827,6 +1842,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
> >
> >         mutex_lock(&gpd_list_lock);
> >         list_add(&genpd->gpd_list_node, &gpd_list);
> > +       genpd_debug_add(genpd);
> >         mutex_unlock(&gpd_list_lock);
> >
> >         return 0;
> > @@ -1860,6 +1876,7 @@ static int genpd_remove(struct generic_pm_domain *genpd)
> >                 kfree(link);
> >         }
> >
> > +       genpd_debug_remove(genpd);
> >         list_del(&genpd->gpd_list_node);
> >         genpd_unlock(genpd);
> >         cancel_work_sync(&genpd->power_off_work);
> > @@ -2764,14 +2781,6 @@ core_initcall(genpd_bus_init);
> >  /***        debugfs support        ***/
> >
> >  #ifdef CONFIG_DEBUG_FS
> > -#include <linux/pm.h>
> > -#include <linux/device.h>
> > -#include <linux/debugfs.h>
> > -#include <linux/seq_file.h>
> > -#include <linux/init.h>
> > -#include <linux/kobject.h>
> > -static struct dentry *genpd_debugfs_dir;
> > -
> >  /*
> >   * TODO: This function is a slightly modified version of rtpm_status_show
> >   * from sysfs.c, so generalize it.
> > @@ -3047,9 +3056,34 @@ DEFINE_SHOW_ATTRIBUTE(total_idle_time);
> >  DEFINE_SHOW_ATTRIBUTE(devices);
> >  DEFINE_SHOW_ATTRIBUTE(perf_state);
> >
> > -static int __init genpd_debug_init(void)
> > +static void genpd_debug_add(struct generic_pm_domain *genpd)
> >  {
> >         struct dentry *d;
> > +
> > +       if (!genpd_debugfs_dir)
> > +               return;
> > +
> > +       d = debugfs_create_dir(genpd->name, genpd_debugfs_dir);
> > +
> > +       debugfs_create_file("current_state", 0444,
> > +                           d, genpd, &status_fops);
> > +       debugfs_create_file("sub_domains", 0444,
> > +                           d, genpd, &sub_domains_fops);
> > +       debugfs_create_file("idle_states", 0444,
> > +                           d, genpd, &idle_states_fops);
> > +       debugfs_create_file("active_time", 0444,
> > +                           d, genpd, &active_time_fops);
> > +       debugfs_create_file("total_idle_time", 0444,
> > +                           d, genpd, &total_idle_time_fops);
> > +       debugfs_create_file("devices", 0444,
> > +                           d, genpd, &devices_fops);
> > +       if (genpd->set_performance_state)
> > +               debugfs_create_file("perf_state", 0444,
> > +                                   d, genpd, &perf_state_fops);
> > +}
> > +
> > +static int __init genpd_debug_init(void)
> > +{
> >         struct generic_pm_domain *genpd;
> >
> >         genpd_debugfs_dir = debugfs_create_dir("pm_genpd", NULL);
> > @@ -3057,25 +3091,8 @@ static int __init genpd_debug_init(void)
> >         debugfs_create_file("pm_genpd_summary", S_IRUGO, genpd_debugfs_dir,
> >                             NULL, &summary_fops);
> >
> > -       list_for_each_entry(genpd, &gpd_list, gpd_list_node) {
> > -               d = debugfs_create_dir(genpd->name, genpd_debugfs_dir);
> > -
> > -               debugfs_create_file("current_state", 0444,
> > -                               d, genpd, &status_fops);
> > -               debugfs_create_file("sub_domains", 0444,
> > -                               d, genpd, &sub_domains_fops);
> > -               debugfs_create_file("idle_states", 0444,
> > -                               d, genpd, &idle_states_fops);
> > -               debugfs_create_file("active_time", 0444,
> > -                               d, genpd, &active_time_fops);
> > -               debugfs_create_file("total_idle_time", 0444,
> > -                               d, genpd, &total_idle_time_fops);
> > -               debugfs_create_file("devices", 0444,
> > -                               d, genpd, &devices_fops);
> > -               if (genpd->set_performance_state)
> > -                       debugfs_create_file("perf_state", 0444,
> > -                                           d, genpd, &perf_state_fops);
> > -       }
> > +       list_for_each_entry(genpd, &gpd_list, gpd_list_node)
> > +               genpd_debug_add(genpd);
> >
> >         return 0;
> >  }
> > --
> > 2.29.2.576.ga3fc446d84-goog
> >

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

end of thread, other threads:[~2020-12-10 18:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 19:19 [PATCH v4] PM: domains: create debugfs nodes when adding power domains Thierry Strudel
2020-12-08 19:51 ` Greg Kroah-Hartman
2020-12-08 20:40   ` Thierry Strudel
2020-12-09 15:32   ` Rafael J. Wysocki
2020-12-10  7:16 ` Ulf Hansson
2020-12-10 18:51   ` 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).