All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tero Kristo <t-kristo@ti.com>
To: Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>
Cc: linux-clk <linux-clk@vger.kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	linux-omap <linux-omap@vger.kernel.org>,
	Tony Lindgren <tony@atomide.com>
Subject: Re: [PATCH 04/11] clk: ti: clkctrl: support multiple clkctrl nodes under a cm node
Date: Tue, 16 Oct 2018 10:37:06 +0300	[thread overview]
Message-ID: <e886fb85-c857-5aec-d1e2-5c428be9c059@ti.com> (raw)
In-Reply-To: <153964669678.5275.18141587800966295694@swboyd.mtv.corp.google.com>

On 16/10/18 02:38, Stephen Boyd wrote:
> Quoting Tero Kristo (2018-10-15 08:58:21)
>> On 13/10/18 01:03, Stephen Boyd wrote:
>>> Quoting Rob Herring (2018-10-12 14:45:08)
>>>> On Fri, Oct 12, 2018 at 4:25 PM Stephen Boyd <sboyd@kernel.org> wrote:
>>>>>
>>>>> Quoting Tero Kristo (2018-08-31 08:07:00)
>>>>>> @@ -492,19 +501,35 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
>>>>>>
>>>>>>           provider->base = of_iomap(node, 0);
>>>>>>
>>>>>> -       provider->clkdm_name = kmalloc(strlen(node->parent->name) + 3,
>>>>>> -                                      GFP_KERNEL);
>>>>>> -       if (!provider->clkdm_name) {
>>>>>> -               kfree(provider);
>>>>>> -               return;
>>>>>> +       if (ti_clk_get_features()->flags & TI_CLK_CLKCTRL_COMPAT) {
>>>>>> +               provider->clkdm_name = kmalloc(strlen(node->parent->name) + 3,
>>>>>> +                                              GFP_KERNEL);
>>>>>> +               if (!provider->clkdm_name) {
>>>>>> +                       kfree(provider);
>>>>>> +                       return;
>>>>>> +               }
>>>>>> +
>>>>>> +               /*
>>>>>> +                * Create default clkdm name, replace _cm from end of parent
>>>>>> +                * node name with _clkdm
>>>>>> +                */
>>>>>> +               strcpy(provider->clkdm_name, node->parent->name);
>>>>
>>>> kasprintf can replace kmalloc, strlen and strcpy here and remove the
>>>> direct access of .name in the process.
>>>>
>>>>>> +               provider->clkdm_name[strlen(provider->clkdm_name) - 2] = 0;
>>>>>> +       } else {
>>>>>> +               provider->clkdm_name = kmalloc(strlen(node->name), GFP_KERNEL);
>>>>>> +               if (!provider->clkdm_name) {
>>>>>> +                       kfree(provider);
>>>>>> +                       return;
>>>>>> +               }
>>>>>> +
>>>>>> +               /*
>>>>>> +                * Create default clkdm name, replace _clkctrl from end of
>>>>>> +                * node name with _clkdm
>>>>>> +                */
>>>>>> +               strcpy(provider->clkdm_name, node->name);
>>>>
>>>> and here.
>>>>
>>>>>> +               provider->clkdm_name[strlen(provider->clkdm_name) - 7] = 0;
>>>>>>           }
>>>>>>
>>>>>
>>>>> This conflicts with Rob's change so I tried to fix it up. Let me know if
>>>>> something is horribly wrong with it. I suspect Rob will need to figure
>>>>> out how to make node::name usage go away again, but I put it back.
>>>>
>>>> Then I don't have to find and fix. :)
>>>>
>>>
>>> Can you send a patch? Otherwise I will try and fix this up tomorrow.
>>> You can use this git tree for reference:
>>>
>>> https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-ti
>>>
>>
>> Sorry, I've also been OoO for last week, just captured this.
>>
>> Do you need help on this one? I can take a look at it tomorrow if there
>> is a specific merge conflict you want me to take a look at.
> 
> This is what I got:

Ok that looks fine except one detail below:

> 
> ----8<---
> diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
> index 955f2e26ab00..78deca44789d 100644
> --- a/drivers/clk/ti/clkctrl.c
> +++ b/drivers/clk/ti/clkctrl.c
> @@ -520,8 +520,7 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
>   	provider->base = of_iomap(node, 0);
>   
>   	if (ti_clk_get_features()->flags & TI_CLK_CLKCTRL_COMPAT) {
> -		provider->clkdm_name = kmalloc(strlen(node->parent->name) + 3,
> -					       GFP_KERNEL);
> +		provider->clkdm_name = kasprintf(GFP_KERNEL, "%pOFn%s", node->parent, "xxx");
>   		if (!provider->clkdm_name) {
>   			kfree(provider);
>   			return;
> @@ -531,10 +530,9 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
>   		 * Create default clkdm name, replace _cm from end of parent
>   		 * node name with _clkdm
>   		 */
> -		strcpy(provider->clkdm_name, node->parent->name);
> -		provider->clkdm_name[strlen(provider->clkdm_name) - 2] = 0;
> +		provider->clkdm_name[strlen(provider->clkdm_name) - 5] = 0;
>   	} else {
> -		provider->clkdm_name = kmalloc(strlen(node->name), GFP_KERNEL);
> +		provider->clkdm_name = kasprintf(GFP_KERNEL, "%pOFn", node->name);

should be:

  +		provider->clkdm_name = kasprintf(GFP_KERNEL, "%pOFn", node);

...instead right?

-Tero


>   		if (!provider->clkdm_name) {
>   			kfree(provider);
>   			return;
> @@ -544,7 +542,6 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
>   		 * Create default clkdm name, replace _clkctrl from end of
>   		 * node name with _clkdm
>   		 */
> -		strcpy(provider->clkdm_name, node->name);
>   		provider->clkdm_name[strlen(provider->clkdm_name) - 7] = 0;
>   	}
>   
> 

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

  reply	other threads:[~2018-10-16  7:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-31 15:06 [PATCH 00/11] clk: ti: clkctrl data split based on clkdm boundaries Tero Kristo
2018-08-31 15:06 ` [PATCH 01/11] dt-bindings: clock: am33xx: add clkctrl indices for new data layout Tero Kristo
2018-08-31 15:06 ` [PATCH 02/11] dt-bindings: clock: am43xx: " Tero Kristo
2018-08-31 15:06 ` [PATCH 03/11] dt-bindings: clock: dra7xx: " Tero Kristo
2018-08-31 15:07 ` [PATCH 04/11] clk: ti: clkctrl: support multiple clkctrl nodes under a cm node Tero Kristo
2018-10-12 21:25   ` Stephen Boyd
2018-10-12 21:45     ` Rob Herring
2018-10-12 22:03       ` Stephen Boyd
2018-10-15 15:58         ` Tero Kristo
2018-10-15 23:38           ` Stephen Boyd
2018-10-16  7:37             ` Tero Kristo [this message]
2018-10-16 15:37               ` Stephen Boyd
2018-08-31 15:07 ` [PATCH 05/11] clk: ti: clkctrl: replace dashes from clkdm name with underscore Tero Kristo
2018-08-31 15:07 ` [PATCH 06/11] clk: ti: am33xx: rename existing clkctrl data as compat data Tero Kristo
2018-08-31 15:07 ` [PATCH 07/11] clk: ti: am33xx: add new clkctrl data for am33xx Tero Kristo
2018-08-31 15:07 ` [PATCH 08/11] clk: ti: am43xx: rename existing clkctrl data as compat data Tero Kristo
2018-08-31 15:07 ` [PATCH 09/11] clk: ti: am43xx: add new clkctrl data for am43xx Tero Kristo
2018-08-31 15:07 ` [PATCH 10/11] clk: ti: dra7xx: rename existing clkctrl data as compat data Tero Kristo
2018-08-31 15:07 ` [PATCH 11/11] clk: ti: dra7: add new clkctrl data Tero Kristo
2018-09-04 15:36 ` [PATCH 00/11] clk: ti: clkctrl data split based on clkdm boundaries Tony Lindgren
2018-09-26 19:13   ` Tony Lindgren
2018-09-27  6:31     ` Tero Kristo
2018-09-27 14:49       ` Tony Lindgren
2018-10-03 13:17         ` Tero Kristo

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=e886fb85-c857-5aec-d1e2-5c428be9c059@ti.com \
    --to=t-kristo@ti.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tony@atomide.com \
    /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.