All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Leonard Crestez <leonard.crestez@nxp.com>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Peter De Schrijver <pdeschrijver@nvidia.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] clk: Add clk_parent entry in debugfs
Date: Fri, 07 Jun 2019 12:05:22 -0700	[thread overview]
Message-ID: <20190607190522.D276520868@mail.kernel.org> (raw)
In-Reply-To: <057720844e78e615e46de34a73b16ffaf7dbfc10.1558686047.git.leonard.crestez@nxp.com>

Quoting Leonard Crestez (2019-05-24 01:25:25)
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index aa51756fd4d6..94a93b07dd37 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -3009,10 +3009,21 @@ static int possible_parents_show(struct seq_file *s, void *data)
>  
>         return 0;
>  }
>  DEFINE_SHOW_ATTRIBUTE(possible_parents);
>  
> +static int current_parent_show(struct seq_file *s, void *data)
> +{
> +       struct clk_core *core = s->private;
> +
> +       if (core->parent)
> +               seq_printf(s, "%s\n", core->parent->name);
> +
> +       return 0;
> +}
> +DEFINE_SHOW_ATTRIBUTE(current_parent);

Looks OK.

> +
>  static int clk_duty_cycle_show(struct seq_file *s, void *data)
>  {
>         struct clk_core *core = s->private;
>         struct clk_duty *duty = &core->duty;
>  
> @@ -3040,10 +3051,11 @@ static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
>         debugfs_create_u32("clk_enable_count", 0444, root, &core->enable_count);
>         debugfs_create_u32("clk_protect_count", 0444, root, &core->protect_count);
>         debugfs_create_u32("clk_notifier_count", 0444, root, &core->notifier_count);
>         debugfs_create_file("clk_duty_cycle", 0444, root, core,
>                             &clk_duty_cycle_fops);
> +       debugfs_create_file("clk_parent", 0444, root, core, &current_parent_fops);

Shouldn't we skip creation of this file if core->num_parents == 0? So
put this under the if condition below?

>  
>         if (core->num_parents > 1)
>                 debugfs_create_file("clk_possible_parents", 0444, root, core,
>                                     &possible_parents_fops);
>  

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@kernel.org>
To: Leonard Crestez <leonard.crestez@nxp.com>
Cc: Peter De Schrijver <pdeschrijver@nvidia.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michael Turquette <mturquette@baylibre.com>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] clk: Add clk_parent entry in debugfs
Date: Fri, 07 Jun 2019 12:05:22 -0700	[thread overview]
Message-ID: <20190607190522.D276520868@mail.kernel.org> (raw)
In-Reply-To: <057720844e78e615e46de34a73b16ffaf7dbfc10.1558686047.git.leonard.crestez@nxp.com>

Quoting Leonard Crestez (2019-05-24 01:25:25)
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index aa51756fd4d6..94a93b07dd37 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -3009,10 +3009,21 @@ static int possible_parents_show(struct seq_file *s, void *data)
>  
>         return 0;
>  }
>  DEFINE_SHOW_ATTRIBUTE(possible_parents);
>  
> +static int current_parent_show(struct seq_file *s, void *data)
> +{
> +       struct clk_core *core = s->private;
> +
> +       if (core->parent)
> +               seq_printf(s, "%s\n", core->parent->name);
> +
> +       return 0;
> +}
> +DEFINE_SHOW_ATTRIBUTE(current_parent);

Looks OK.

> +
>  static int clk_duty_cycle_show(struct seq_file *s, void *data)
>  {
>         struct clk_core *core = s->private;
>         struct clk_duty *duty = &core->duty;
>  
> @@ -3040,10 +3051,11 @@ static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
>         debugfs_create_u32("clk_enable_count", 0444, root, &core->enable_count);
>         debugfs_create_u32("clk_protect_count", 0444, root, &core->protect_count);
>         debugfs_create_u32("clk_notifier_count", 0444, root, &core->notifier_count);
>         debugfs_create_file("clk_duty_cycle", 0444, root, core,
>                             &clk_duty_cycle_fops);
> +       debugfs_create_file("clk_parent", 0444, root, core, &current_parent_fops);

Shouldn't we skip creation of this file if core->num_parents == 0? So
put this under the if condition below?

>  
>         if (core->num_parents > 1)
>                 debugfs_create_file("clk_possible_parents", 0444, root, core,
>                                     &possible_parents_fops);
>  

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-06-07 19:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-24  8:25 [PATCH] clk: Add clk_parent entry in debugfs Leonard Crestez
2019-05-24  8:25 ` Leonard Crestez
2019-06-07 19:05 ` Stephen Boyd [this message]
2019-06-07 19:05   ` Stephen Boyd
2019-06-08  7:26   ` Leonard Crestez
2019-06-08  7:26     ` Leonard Crestez
2019-06-08 12:19     ` Geert Uytterhoeven
2019-06-08 12:19       ` Geert Uytterhoeven
2019-06-08 12:48       ` Leonard Crestez
2019-06-08 12:48         ` Leonard Crestez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190607190522.D276520868@mail.kernel.org \
    --to=sboyd@kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=leonard.crestez@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=pdeschrijver@nvidia.com \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.