From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-clk@vger.kernel.org, kuninori.morimoto.gx@renesas.com,
gaku.inami.xw@bp.renesas.com, mturquette@baylibre.com,
linux-sh@vger.kernel.org, sboyd@codeaurora.org,
horms@verge.net.au, geert@linux-m68k.org
Subject: Re: [PATCH v3 02/04] clk: shmobile: Make MSTP clock-output-names optional
Date: Fri, 28 Aug 2015 22:37:47 +0300 [thread overview]
Message-ID: <1776985.pyjG3Le2BL@avalon> (raw)
In-Reply-To: <20150828091613.21731.8527.sendpatchset@little-apple>
Hi Magnus,
Thank you for the patch.
On Friday 28 August 2015 18:16:13 Magnus Damm wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
>
> This patch updates the MSTP driver to make the "clock-output-names"
> DT property optional instead of mandatory. In case the DT property
> is omitted then the function clk_register_clkdev() is skipped.
>
> The default for new SoCs is to not use "clock-output-names".
>
> This version of the patch is kind of early, so please handle with care.
> So far the patch has only been tested with a single MSTP clock. =)
>
> Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
> ---
>
> drivers/clk/shmobile/clk-mstp.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> --- 0001/drivers/clk/shmobile/clk-mstp.c
> +++ work/drivers/clk/shmobile/clk-mstp.c 2015-08-28 15:03:28.002366518
+0900
> @@ -198,15 +198,12 @@ static void __init cpg_mstp_clocks_init(
>
> for (i = 0; i < MSTP_MAX_CLOCKS; ++i) {
> const char *parent_name;
> - const char *name;
> + const char *name = NULL;
> u32 clkidx;
> int ret;
>
> - /* Skip clocks with no name. */
> ret = of_property_read_string_index(np, "clock-output-names",
> i, &name);
I think we can remove this completely.
> - if (ret < 0 || strlen(name) == 0)
> - continue;
>
> parent_name = of_clk_get_parent_name(np, i);
> ret = of_property_read_u32_index(np, idxname, i, &clkidx);
> @@ -214,12 +211,13 @@ static void __init cpg_mstp_clocks_init(
> break;
>
> if (clkidx >= MSTP_MAX_CLOCKS) {
> - pr_err("%s: invalid clock %s %s index %u)\n",
> - __func__, np->name, name, clkidx);
> + pr_err("%s: invalid clock %s index %u)\n",
> + __func__, np->name, clkidx);
> continue;
> }
>
> - clks[clkidx] = cpg_mstp_clock_register(name, parent_name,
> + clks[clkidx] = cpg_mstp_clock_register(name ? name : np->name,
This would result in several clocks being registered with the same name. I
would instead construct the name with sprintf(name, "%s.%u", np->name,
clkidx).
> + parent_name,
> clkidx, group);
> if (!IS_ERR(clks[clkidx])) {
> group->data.clk_num = max(group->data.clk_num,
> @@ -232,7 +230,8 @@ static void __init cpg_mstp_clocks_init(
> * FIXME: Remove this when all devices that require a
> * clock will be instantiated from DT.
> */
> - clk_register_clkdev(clks[clkidx], name, NULL);
> + if (name) /* only if clock-output-names is provided */
> + clk_register_clkdev(clks[clkidx], name, NULL);
Better than that, as all our devices are now instantiated from DT, we can
remove the clk_register_clkdev() call completely as well as the FIXME comment.
> } else {
> pr_err("%s: failed to register %s %s clock (%ld)\n",
> __func__, np->name, name, PTR_ERR(clks[clkidx]));
name can be NULL here, I'd use "%s.%u", np->name, clkidx.
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-clk@vger.kernel.org, kuninori.morimoto.gx@renesas.com,
gaku.inami.xw@bp.renesas.com, mturquette@baylibre.com,
linux-sh@vger.kernel.org, sboyd@codeaurora.org,
horms@verge.net.au, geert@linux-m68k.org
Subject: Re: [PATCH v3 02/04] clk: shmobile: Make MSTP clock-output-names optional
Date: Fri, 28 Aug 2015 19:37:47 +0000 [thread overview]
Message-ID: <1776985.pyjG3Le2BL@avalon> (raw)
In-Reply-To: <20150828091613.21731.8527.sendpatchset@little-apple>
Hi Magnus,
Thank you for the patch.
On Friday 28 August 2015 18:16:13 Magnus Damm wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
>
> This patch updates the MSTP driver to make the "clock-output-names"
> DT property optional instead of mandatory. In case the DT property
> is omitted then the function clk_register_clkdev() is skipped.
>
> The default for new SoCs is to not use "clock-output-names".
>
> This version of the patch is kind of early, so please handle with care.
> So far the patch has only been tested with a single MSTP clock. =)
>
> Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
> ---
>
> drivers/clk/shmobile/clk-mstp.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> --- 0001/drivers/clk/shmobile/clk-mstp.c
> +++ work/drivers/clk/shmobile/clk-mstp.c 2015-08-28 15:03:28.002366518
+0900
> @@ -198,15 +198,12 @@ static void __init cpg_mstp_clocks_init(
>
> for (i = 0; i < MSTP_MAX_CLOCKS; ++i) {
> const char *parent_name;
> - const char *name;
> + const char *name = NULL;
> u32 clkidx;
> int ret;
>
> - /* Skip clocks with no name. */
> ret = of_property_read_string_index(np, "clock-output-names",
> i, &name);
I think we can remove this completely.
> - if (ret < 0 || strlen(name) = 0)
> - continue;
>
> parent_name = of_clk_get_parent_name(np, i);
> ret = of_property_read_u32_index(np, idxname, i, &clkidx);
> @@ -214,12 +211,13 @@ static void __init cpg_mstp_clocks_init(
> break;
>
> if (clkidx >= MSTP_MAX_CLOCKS) {
> - pr_err("%s: invalid clock %s %s index %u)\n",
> - __func__, np->name, name, clkidx);
> + pr_err("%s: invalid clock %s index %u)\n",
> + __func__, np->name, clkidx);
> continue;
> }
>
> - clks[clkidx] = cpg_mstp_clock_register(name, parent_name,
> + clks[clkidx] = cpg_mstp_clock_register(name ? name : np->name,
This would result in several clocks being registered with the same name. I
would instead construct the name with sprintf(name, "%s.%u", np->name,
clkidx).
> + parent_name,
> clkidx, group);
> if (!IS_ERR(clks[clkidx])) {
> group->data.clk_num = max(group->data.clk_num,
> @@ -232,7 +230,8 @@ static void __init cpg_mstp_clocks_init(
> * FIXME: Remove this when all devices that require a
> * clock will be instantiated from DT.
> */
> - clk_register_clkdev(clks[clkidx], name, NULL);
> + if (name) /* only if clock-output-names is provided */
> + clk_register_clkdev(clks[clkidx], name, NULL);
Better than that, as all our devices are now instantiated from DT, we can
remove the clk_register_clkdev() call completely as well as the FIXME comment.
> } else {
> pr_err("%s: failed to register %s %s clock (%ld)\n",
> __func__, np->name, name, PTR_ERR(clks[clkidx]));
name can be NULL here, I'd use "%s.%u", np->name, clkidx.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2015-08-28 19:37 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-28 9:15 [PATCH v3 00/04] Renesas R-Car Gen3 CPG support V3 Magnus Damm
2015-08-28 9:15 ` Magnus Damm
2015-08-28 9:16 ` [PATCH v3 01/04] clk: shmobile: Get rid of CONFIG_ARCH_SHMOBILE_MULTI Magnus Damm
2015-08-28 9:16 ` Magnus Damm
2015-08-28 19:59 ` Laurent Pinchart
2015-08-28 19:59 ` Laurent Pinchart
2015-08-29 8:33 ` Magnus Damm
2015-08-29 8:33 ` Magnus Damm
2015-08-28 9:16 ` [PATCH v3 02/04] clk: shmobile: Make MSTP clock-output-names optional Magnus Damm
2015-08-28 9:16 ` Magnus Damm
2015-08-28 19:37 ` Laurent Pinchart [this message]
2015-08-28 19:37 ` Laurent Pinchart
2015-08-28 21:05 ` Geert Uytterhoeven
2015-08-28 21:05 ` Geert Uytterhoeven
2015-08-28 9:16 ` [PATCH v3 03/04] clk: shmobile: Add Renesas R-Car Gen3 CPG support Magnus Damm
2015-08-28 9:16 ` Magnus Damm
2015-08-28 17:20 ` Stephen Boyd
2015-08-28 17:20 ` Stephen Boyd
2015-08-29 8:46 ` Geert Uytterhoeven
2015-08-29 8:46 ` Geert Uytterhoeven
2015-08-29 9:31 ` Magnus Damm
2015-08-29 9:31 ` Magnus Damm
2015-08-28 9:16 ` [PATCH v3 04/04] clk: shmobile: rcar-gen3: Add CPG/MSTP Clock Domain support Magnus Damm
2015-08-28 9:16 ` Magnus Damm
2015-08-28 9:19 ` Geert Uytterhoeven
2015-08-28 9:19 ` Geert Uytterhoeven
2015-08-28 9:21 ` Magnus Damm
2015-08-28 9:21 ` Magnus Damm
2015-08-28 17:21 ` [PATCH v3 00/04] Renesas R-Car Gen3 CPG support V3 Stephen Boyd
2015-08-28 17:21 ` Stephen Boyd
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=1776985.pyjG3Le2BL@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=gaku.inami.xw@bp.renesas.com \
--cc=geert@linux-m68k.org \
--cc=horms@verge.net.au \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mturquette@baylibre.com \
--cc=sboyd@codeaurora.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.