From mboxrd@z Thu Jan 1 00:00:00 1970 From: jenskuske@gmail.com (Jens Kuske) Date: Mon, 18 May 2015 11:15:42 +0200 Subject: [PATCH v2 03/10] clk: sunxi: Let divs clocks read the base factor clock name from devicetree In-Reply-To: References: <1431707940-19372-1-git-send-email-jenskuske@gmail.com> <1431707940-19372-4-git-send-email-jenskuske@gmail.com> Message-ID: <5559ADBE.7060506@gmail.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi, On 05/16/15 04:10, Chen-Yu Tsai wrote: > 2015?5?16? ??12:39? "Jens Kuske" ??? [..] >> @@ -1141,6 +1133,7 @@ static void __init sunxi_divs_clk_setup(struct > device_node *node, >> struct clk_gate *gate = NULL; >> struct clk_fixed_factor *fix_factor; >> struct clk_divider *divider; >> + struct factors_data factors = *data->factors; Isn't this a copy? >> void __iomem *reg; >> int ndivs = SUNXI_DIVS_MAX_QTY, i = 0; >> int flags, clkflags; >> @@ -1149,8 +1142,17 @@ static void __init sunxi_divs_clk_setup(struct > device_node *node, >> if (data->ndivs) >> ndivs = data->ndivs; >> >> + /* Try to find a name for base factor clock */ >> + for (i = 0; i < ndivs; i++) { >> + if (data->div[i].self) { >> + of_property_read_string_index(node, > "clock-output-names", >> + i, &factors.name); > > Please excuse the bad formatting. > I'm at the airport without my laptop. > > This will not work. All the static factors_data structs are const. > You should make a copy of it, maybe on the stack, > update the .name field, and pass that to sunxi_factors_clk_setup(). > If I didn't miss anything, or misunderstood what you want to copy, this should be working fine. Jens From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens Kuske Subject: Re: [PATCH v2 03/10] clk: sunxi: Let divs clocks read the base factor clock name from devicetree Date: Mon, 18 May 2015 11:15:42 +0200 Message-ID: <5559ADBE.7060506@gmail.com> References: <1431707940-19372-1-git-send-email-jenskuske@gmail.com> <1431707940-19372-4-git-send-email-jenskuske@gmail.com> Reply-To: jenskuske-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Chen-Yu Tsai Cc: VishnuPatekar , Rob Herring , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Mike Turquette , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Hans de Goede , Linus Walleij , Maxime Ripard , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, =?UTF-8?B?RW1pbGlvIEzDs3Bleg==?= List-Id: devicetree@vger.kernel.org Hi, On 05/16/15 04:10, Chen-Yu Tsai wrote: > 2015=E5=B9=B45=E6=9C=8816=E6=97=A5 =E4=B8=8A=E5=8D=8812:39=E6=96=BC "Jens= Kuske" =E5=AF=AB=E9=81=93=EF=BC=9A [..] >> @@ -1141,6 +1133,7 @@ static void __init sunxi_divs_clk_setup(struct > device_node *node, >> struct clk_gate *gate =3D NULL; >> struct clk_fixed_factor *fix_factor; >> struct clk_divider *divider; >> + struct factors_data factors =3D *data->factors; Isn't this a copy? >> void __iomem *reg; >> int ndivs =3D SUNXI_DIVS_MAX_QTY, i =3D 0; >> int flags, clkflags; >> @@ -1149,8 +1142,17 @@ static void __init sunxi_divs_clk_setup(struct > device_node *node, >> if (data->ndivs) >> ndivs =3D data->ndivs; >> >> + /* Try to find a name for base factor clock */ >> + for (i =3D 0; i < ndivs; i++) { >> + if (data->div[i].self) { >> + of_property_read_string_index(node, > "clock-output-names", >> + i, &factors.name); >=20 > Please excuse the bad formatting. > I'm at the airport without my laptop. >=20 > This will not work. All the static factors_data structs are const. > You should make a copy of it, maybe on the stack, > update the .name field, and pass that to sunxi_factors_clk_setup(). >=20 If I didn't miss anything, or misunderstood what you want to copy, this should be working fine. Jens --=20 You received this message because you are subscribed to the Google Groups "= linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753839AbbERKJI (ORCPT ); Mon, 18 May 2015 06:09:08 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:35837 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753327AbbERKHB (ORCPT ); Mon, 18 May 2015 06:07:01 -0400 Message-ID: <5559ADBE.7060506@gmail.com> Date: Mon, 18 May 2015 11:15:42 +0200 From: Jens Kuske User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Chen-Yu Tsai CC: VishnuPatekar , Rob Herring , linux-kernel@vger.kernel.org, Mike Turquette , devicetree@vger.kernel.org, Hans de Goede , Linus Walleij , Maxime Ripard , linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, =?UTF-8?B?RW1pbGlvIEzDs3Bleg==?= Subject: Re: [PATCH v2 03/10] clk: sunxi: Let divs clocks read the base factor clock name from devicetree References: <1431707940-19372-1-git-send-email-jenskuske@gmail.com> <1431707940-19372-4-git-send-email-jenskuske@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 05/16/15 04:10, Chen-Yu Tsai wrote: > 2015年5月16日 上午12:39於 "Jens Kuske" 寫道: [..] >> @@ -1141,6 +1133,7 @@ static void __init sunxi_divs_clk_setup(struct > device_node *node, >> struct clk_gate *gate = NULL; >> struct clk_fixed_factor *fix_factor; >> struct clk_divider *divider; >> + struct factors_data factors = *data->factors; Isn't this a copy? >> void __iomem *reg; >> int ndivs = SUNXI_DIVS_MAX_QTY, i = 0; >> int flags, clkflags; >> @@ -1149,8 +1142,17 @@ static void __init sunxi_divs_clk_setup(struct > device_node *node, >> if (data->ndivs) >> ndivs = data->ndivs; >> >> + /* Try to find a name for base factor clock */ >> + for (i = 0; i < ndivs; i++) { >> + if (data->div[i].self) { >> + of_property_read_string_index(node, > "clock-output-names", >> + i, &factors.name); > > Please excuse the bad formatting. > I'm at the airport without my laptop. > > This will not work. All the static factors_data structs are const. > You should make a copy of it, maybe on the stack, > update the .name field, and pass that to sunxi_factors_clk_setup(). > If I didn't miss anything, or misunderstood what you want to copy, this should be working fine. Jens