All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Prashant Gaikwad
	<pgaikwad-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	"mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
	<mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v4 2/9] clk: tegra: Add tegra specific clocks
Date: Fri, 11 Jan 2013 14:35:28 -0700	[thread overview]
Message-ID: <50F085A0.4090100@wwwdotorg.org> (raw)
In-Reply-To: <20130111.134820.1392079432650652356.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

On 01/11/2013 04:48 AM, Hiroshi Doyu wrote:
> Hi Prahant,
> 
> Some nit-pick/cosmetic comments inlined...

FYI, Prashant is on vacation for the next week or two, so I'll take over
this series to clean up any last review comments.

> Prashant Gaikwad <pgaikwad-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote @ Fri, 11 Jan 2013 08:46:20 +0100:
> 
>> Add tegra specific clocks, pll, pll_out, peripheral,
>> frac_divider, super.

(it's a good idea to quote as little text as possible; paging through
the whole patch to find your comments was slightly painful).

>> diff --git a/drivers/clk/tegra/clk-audio-sync.c b/drivers/clk/tegra/clk-audio-sync.c

>> +struct clk *tegra_clk_sync_source(const char *name, unsigned long rate,
>> +                                 unsigned long max_rate)
>> +{
>> +       struct tegra_clk_sync_source *sync;
>> +       struct clk_init_data init;
>> +       struct clk *clk;
>> +
>> +       sync = kzalloc(sizeof(struct tegra_clk_sync_source), GFP_KERNEL);
>> +       if (!sync) {
>> +               pr_err("%s: could not allocate sync source clk\n", __func__);
>> +               return ERR_PTR(-ENOMEM);
>> +       }
>> +
>> +       sync->rate = rate;
>> +       sync->max_rate = max_rate;
>> +
>> +       init.ops = &tegra_clk_sync_source_ops;
>> +       init.name = name;
>> +       init.flags = CLK_IS_ROOT;
>> +       init.parent_names = NULL;
>> +       init.num_parents = 0;
>> +
>> +       sync->hw.init = &init;
>> +
>> +       clk = clk_register(NULL, &sync->hw);
> 
> The above usage of "init" from stack may be a bit
> unfamilier. I can guess that its content is copied in clk_register()
> but it's originally defined in stack. So I just prefer to writing this
> as below. It may be somewhat explict that we know init is from stack.

The issue you mention is more about whether "init" is copied from the
stack or not; simplying changing the initialization to:

> struct clk *tegra_clk_sync_source(const char *name, unsigned long rate,
>                                  unsigned long max_rate)
> {
>         struct tegra_clk_sync_source *sync;
>         struct clk_init_data init = {
>                 .ops = &tegra_clk_sync_source_ops;
>                 .name = name;
>                 .flags = CLK_IS_ROOT;
>                 .parent_names = NULL;
>                 .num_parents = 0;
>         };

... doesn't really address that, although it's a perfectly reasonable
change.

To address the copying issue, why not just add a comment:

       /*
        * This data pointed at by this field is copied by
        * clk_register(), so a pointer to the stack is OK.
        */
       sync->hw.init = &init;

       clk = clk_register(NULL, &sync->hw);

I'll make the other changes you suggested.

WARNING: multiple messages have this Message-ID (diff)
From: swarren@wwwdotorg.org (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 2/9] clk: tegra: Add tegra specific clocks
Date: Fri, 11 Jan 2013 14:35:28 -0700	[thread overview]
Message-ID: <50F085A0.4090100@wwwdotorg.org> (raw)
In-Reply-To: <20130111.134820.1392079432650652356.hdoyu@nvidia.com>

On 01/11/2013 04:48 AM, Hiroshi Doyu wrote:
> Hi Prahant,
> 
> Some nit-pick/cosmetic comments inlined...

FYI, Prashant is on vacation for the next week or two, so I'll take over
this series to clean up any last review comments.

> Prashant Gaikwad <pgaikwad@nvidia.com> wrote @ Fri, 11 Jan 2013 08:46:20 +0100:
> 
>> Add tegra specific clocks, pll, pll_out, peripheral,
>> frac_divider, super.

(it's a good idea to quote as little text as possible; paging through
the whole patch to find your comments was slightly painful).

>> diff --git a/drivers/clk/tegra/clk-audio-sync.c b/drivers/clk/tegra/clk-audio-sync.c

>> +struct clk *tegra_clk_sync_source(const char *name, unsigned long rate,
>> +                                 unsigned long max_rate)
>> +{
>> +       struct tegra_clk_sync_source *sync;
>> +       struct clk_init_data init;
>> +       struct clk *clk;
>> +
>> +       sync = kzalloc(sizeof(struct tegra_clk_sync_source), GFP_KERNEL);
>> +       if (!sync) {
>> +               pr_err("%s: could not allocate sync source clk\n", __func__);
>> +               return ERR_PTR(-ENOMEM);
>> +       }
>> +
>> +       sync->rate = rate;
>> +       sync->max_rate = max_rate;
>> +
>> +       init.ops = &tegra_clk_sync_source_ops;
>> +       init.name = name;
>> +       init.flags = CLK_IS_ROOT;
>> +       init.parent_names = NULL;
>> +       init.num_parents = 0;
>> +
>> +       sync->hw.init = &init;
>> +
>> +       clk = clk_register(NULL, &sync->hw);
> 
> The above usage of "init" from stack may be a bit
> unfamilier. I can guess that its content is copied in clk_register()
> but it's originally defined in stack. So I just prefer to writing this
> as below. It may be somewhat explict that we know init is from stack.

The issue you mention is more about whether "init" is copied from the
stack or not; simplying changing the initialization to:

> struct clk *tegra_clk_sync_source(const char *name, unsigned long rate,
>                                  unsigned long max_rate)
> {
>         struct tegra_clk_sync_source *sync;
>         struct clk_init_data init = {
>                 .ops = &tegra_clk_sync_source_ops;
>                 .name = name;
>                 .flags = CLK_IS_ROOT;
>                 .parent_names = NULL;
>                 .num_parents = 0;
>         };

... doesn't really address that, although it's a perfectly reasonable
change.

To address the copying issue, why not just add a comment:

       /*
        * This data pointed at by this field is copied by
        * clk_register(), so a pointer to the stack is OK.
        */
       sync->hw.init = &init;

       clk = clk_register(NULL, &sync->hw);

I'll make the other changes you suggested.

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Warren <swarren@wwwdotorg.org>
To: Hiroshi Doyu <hdoyu@nvidia.com>
Cc: Prashant Gaikwad <pgaikwad@nvidia.com>,
	"mturquette@linaro.org" <mturquette@linaro.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 2/9] clk: tegra: Add tegra specific clocks
Date: Fri, 11 Jan 2013 14:35:28 -0700	[thread overview]
Message-ID: <50F085A0.4090100@wwwdotorg.org> (raw)
In-Reply-To: <20130111.134820.1392079432650652356.hdoyu@nvidia.com>

On 01/11/2013 04:48 AM, Hiroshi Doyu wrote:
> Hi Prahant,
> 
> Some nit-pick/cosmetic comments inlined...

FYI, Prashant is on vacation for the next week or two, so I'll take over
this series to clean up any last review comments.

> Prashant Gaikwad <pgaikwad@nvidia.com> wrote @ Fri, 11 Jan 2013 08:46:20 +0100:
> 
>> Add tegra specific clocks, pll, pll_out, peripheral,
>> frac_divider, super.

(it's a good idea to quote as little text as possible; paging through
the whole patch to find your comments was slightly painful).

>> diff --git a/drivers/clk/tegra/clk-audio-sync.c b/drivers/clk/tegra/clk-audio-sync.c

>> +struct clk *tegra_clk_sync_source(const char *name, unsigned long rate,
>> +                                 unsigned long max_rate)
>> +{
>> +       struct tegra_clk_sync_source *sync;
>> +       struct clk_init_data init;
>> +       struct clk *clk;
>> +
>> +       sync = kzalloc(sizeof(struct tegra_clk_sync_source), GFP_KERNEL);
>> +       if (!sync) {
>> +               pr_err("%s: could not allocate sync source clk\n", __func__);
>> +               return ERR_PTR(-ENOMEM);
>> +       }
>> +
>> +       sync->rate = rate;
>> +       sync->max_rate = max_rate;
>> +
>> +       init.ops = &tegra_clk_sync_source_ops;
>> +       init.name = name;
>> +       init.flags = CLK_IS_ROOT;
>> +       init.parent_names = NULL;
>> +       init.num_parents = 0;
>> +
>> +       sync->hw.init = &init;
>> +
>> +       clk = clk_register(NULL, &sync->hw);
> 
> The above usage of "init" from stack may be a bit
> unfamilier. I can guess that its content is copied in clk_register()
> but it's originally defined in stack. So I just prefer to writing this
> as below. It may be somewhat explict that we know init is from stack.

The issue you mention is more about whether "init" is copied from the
stack or not; simplying changing the initialization to:

> struct clk *tegra_clk_sync_source(const char *name, unsigned long rate,
>                                  unsigned long max_rate)
> {
>         struct tegra_clk_sync_source *sync;
>         struct clk_init_data init = {
>                 .ops = &tegra_clk_sync_source_ops;
>                 .name = name;
>                 .flags = CLK_IS_ROOT;
>                 .parent_names = NULL;
>                 .num_parents = 0;
>         };

... doesn't really address that, although it's a perfectly reasonable
change.

To address the copying issue, why not just add a comment:

       /*
        * This data pointed at by this field is copied by
        * clk_register(), so a pointer to the stack is OK.
        */
       sync->hw.init = &init;

       clk = clk_register(NULL, &sync->hw);

I'll make the other changes you suggested.

  parent reply	other threads:[~2013-01-11 21:35 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-11  7:46 [PATCH v4 0/9] Migrate Tegra to common clock framework Prashant Gaikwad
2013-01-11  7:46 ` Prashant Gaikwad
2013-01-11  7:46 ` Prashant Gaikwad
2013-01-11  7:46 ` [PATCH v4 1/9] ARM: tegra: Add function to read chipid Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad
2013-01-11  7:46 ` [PATCH v4 2/9] clk: tegra: Add tegra specific clocks Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad
2013-01-14  7:28   ` Sivaram Nair
2013-01-14  7:28     ` Sivaram Nair
     [not found]   ` <1357890387-23245-3-git-send-email-pgaikwad-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-11 11:48     ` Hiroshi Doyu
2013-01-11 11:48       ` Hiroshi Doyu
2013-01-11 11:48       ` Hiroshi Doyu
     [not found]       ` <20130111.134820.1392079432650652356.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-11 21:35         ` Stephen Warren [this message]
2013-01-11 21:35           ` Stephen Warren
2013-01-11 21:35           ` Stephen Warren
     [not found]           ` <50F085A0.4090100-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-01-16  8:19             ` Hiroshi Doyu
2013-01-16  8:19               ` Hiroshi Doyu
2013-01-16  8:19               ` Hiroshi Doyu
     [not found]               ` <20130116.101906.399662310268585658.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-16 18:04                 ` Stephen Warren
2013-01-16 18:04                   ` Stephen Warren
2013-01-16 18:04                   ` Stephen Warren
2013-01-16 12:31     ` Hiroshi Doyu
2013-01-16 12:31       ` Hiroshi Doyu
2013-01-16 12:31       ` Hiroshi Doyu
     [not found]       ` <20130116.143151.1531468192773974887.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-16 18:44         ` Stephen Warren
2013-01-16 18:44           ` Stephen Warren
2013-01-16 18:44           ` Stephen Warren
2013-01-16 15:12     ` Hiroshi Doyu
2013-01-16 15:12       ` Hiroshi Doyu
2013-01-16 15:12       ` Hiroshi Doyu
     [not found]       ` <20130116.171242.2189136612266237422.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-16 20:11         ` Stephen Warren
2013-01-16 20:11           ` Stephen Warren
2013-01-16 20:11           ` Stephen Warren
     [not found]           ` <50F7096C.7020803-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-01-17  5:03             ` Hiroshi Doyu
2013-01-17  5:03               ` Hiroshi Doyu
2013-01-17  5:03               ` Hiroshi Doyu
     [not found]               ` <20130117.070327.1625310713330263780.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-17 16:35                 ` Stephen Warren
2013-01-17 16:35                   ` Stephen Warren
2013-01-17 16:35                   ` Stephen Warren
2013-01-11  7:46 ` [PATCH v4 3/9] arm: tegra: Move tegra_cpu_car.h to linux/clk/tegra.h Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad
2013-01-11  7:46 ` [PATCH v4 4/9] ARM: tegra: Define Tegra20 CAR binding Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad
2013-01-11  7:46 ` [PATCH v4 5/9] ARM: Tegra: Define Tegra30 " Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad
     [not found]   ` <1357890387-23245-6-git-send-email-pgaikwad-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-16 11:28     ` Hiroshi Doyu
2013-01-16 11:28       ` Hiroshi Doyu
2013-01-16 11:28       ` Hiroshi Doyu
     [not found]       ` <20130116132856.2896df94f553f78273c4574c-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-16 17:30         ` Stephen Warren
2013-01-16 17:30           ` Stephen Warren
2013-01-16 17:30           ` Stephen Warren
     [not found] ` <1357890387-23245-1-git-send-email-pgaikwad-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-11  7:46   ` [PATCH v4 6/9] clk: tegra: add clock support for tegra20 Prashant Gaikwad
2013-01-11  7:46     ` Prashant Gaikwad
2013-01-11  7:46     ` Prashant Gaikwad
2013-01-11 20:54     ` Stephen Warren
2013-01-11 20:54       ` Stephen Warren
2013-01-11  7:46   ` [PATCH v4 7/9] clk: tegra: add clock support for tegra30 Prashant Gaikwad
2013-01-11  7:46     ` Prashant Gaikwad
2013-01-11  7:46     ` Prashant Gaikwad
     [not found]     ` <1357890387-23245-8-git-send-email-pgaikwad-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-11 12:17       ` Hiroshi Doyu
2013-01-11 12:17         ` Hiroshi Doyu
2013-01-11 12:17         ` Hiroshi Doyu
     [not found]         ` <20130111141725.ce3177ad04fc700186dc694d-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-11 21:40           ` Stephen Warren
2013-01-11 21:40             ` Stephen Warren
2013-01-11 21:40             ` Stephen Warren
     [not found]             ` <50F086E2.6010806-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-01-14  5:33               ` Hiroshi Doyu
2013-01-14  5:33                 ` Hiroshi Doyu
2013-01-14  5:33                 ` Hiroshi Doyu
2013-01-11  7:46 ` [PATCH v4 8/9] arm: tegra: Migrate to new clock code Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad
2013-01-11  7:46 ` [PATCH v4 9/9] arm: tegra: Remove legacy " Prashant Gaikwad
2013-01-11  7:48   ` Prashant Gaikwad
2013-01-11  7:46   ` Prashant Gaikwad

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=50F085A0.4090100@wwwdotorg.org \
    --to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
    --cc=hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=pgaikwad-DDmLM1+adcrQT0dZR+AlfA@public.gmane.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.