From: Shawn Guo <shawnguo@kernel.org> To: Stephen Boyd <sboyd@codeaurora.org>, Michael Turquette <mturquette@baylibre.com> Cc: Dong Aisheng <aisheng.dong@nxp.com>, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Shawn Guo <shawn.guo@linaro.org> Subject: [PATCH] clk: bulk: call of_clk_get() when id is NULL Date: Wed, 9 Aug 2017 09:50:42 +0800 [thread overview] Message-ID: <1502243442-28055-1-git-send-email-shawnguo@kernel.org> (raw) From: Shawn Guo <shawn.guo@linaro.org> Most of clk API users have their clocks defined in device tree, and client drivers will have to parse clk ids from DT 'clock-names' property before using clk_bulk_get(). This is a burden for client driver code. And 'clock-names' being an optional DT property makes it even worse. The client driver will have no way to provide clock id. The patch makes a little improvement on clk_bulk_get() to call of_clk_get() with index for DT users, if clock id is not available, so that client drivers working with DT can use clk_bulk_get() to retrieve clocks more easily. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> --- drivers/clk/clk-bulk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c index c834f5abfc49..65cee595a67e 100644 --- a/drivers/clk/clk-bulk.c +++ b/drivers/clk/clk-bulk.c @@ -39,7 +39,10 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks, clks[i].clk = NULL; for (i = 0; i < num_clks; i++) { - clks[i].clk = clk_get(dev, clks[i].id); + if (clks[i].id) + clks[i].clk = clk_get(dev, clks[i].id); + else if (dev->of_node) + clks[i].clk = of_clk_get(dev->of_node, i); if (IS_ERR(clks[i].clk)) { ret = PTR_ERR(clks[i].clk); dev_err(dev, "Failed to get clk '%s': %d\n", -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: shawnguo@kernel.org (Shawn Guo) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] clk: bulk: call of_clk_get() when id is NULL Date: Wed, 9 Aug 2017 09:50:42 +0800 [thread overview] Message-ID: <1502243442-28055-1-git-send-email-shawnguo@kernel.org> (raw) From: Shawn Guo <shawn.guo@linaro.org> Most of clk API users have their clocks defined in device tree, and client drivers will have to parse clk ids from DT 'clock-names' property before using clk_bulk_get(). This is a burden for client driver code. And 'clock-names' being an optional DT property makes it even worse. The client driver will have no way to provide clock id. The patch makes a little improvement on clk_bulk_get() to call of_clk_get() with index for DT users, if clock id is not available, so that client drivers working with DT can use clk_bulk_get() to retrieve clocks more easily. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> --- drivers/clk/clk-bulk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c index c834f5abfc49..65cee595a67e 100644 --- a/drivers/clk/clk-bulk.c +++ b/drivers/clk/clk-bulk.c @@ -39,7 +39,10 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks, clks[i].clk = NULL; for (i = 0; i < num_clks; i++) { - clks[i].clk = clk_get(dev, clks[i].id); + if (clks[i].id) + clks[i].clk = clk_get(dev, clks[i].id); + else if (dev->of_node) + clks[i].clk = of_clk_get(dev->of_node, i); if (IS_ERR(clks[i].clk)) { ret = PTR_ERR(clks[i].clk); dev_err(dev, "Failed to get clk '%s': %d\n", -- 1.9.1
next reply other threads:[~2017-08-09 1:50 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-08-09 1:50 Shawn Guo [this message] 2017-08-09 1:50 ` [PATCH] clk: bulk: call of_clk_get() when id is NULL Shawn Guo 2017-08-09 17:33 ` Stephen Boyd 2017-08-09 17:33 ` Stephen Boyd 2017-08-10 1:31 ` Shawn Guo 2017-08-10 1:31 ` Shawn Guo 2017-08-13 14:18 ` Shawn Guo 2017-08-13 14:18 ` Shawn Guo 2017-08-30 15:31 ` A.s. Dong 2017-08-30 15:31 ` A.s. Dong 2017-08-31 5:26 ` Stephen Boyd 2017-08-31 5:26 ` Stephen Boyd 2017-09-11 4:51 ` A.s. Dong 2017-09-11 4:51 ` A.s. Dong 2017-09-11 5:57 ` Shawn Guo 2017-09-11 5:57 ` Shawn Guo 2017-08-31 7:01 ` Shawn Guo 2017-08-31 7:01 ` Shawn Guo 2017-08-31 7:12 ` A.s. Dong 2017-08-31 7:12 ` A.s. Dong
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=1502243442-28055-1-git-send-email-shawnguo@kernel.org \ --to=shawnguo@kernel.org \ --cc=aisheng.dong@nxp.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-clk@vger.kernel.org \ --cc=mturquette@baylibre.com \ --cc=sboyd@codeaurora.org \ --cc=shawn.guo@linaro.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: linkBe 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.