From: Stephen Boyd <sboyd@kernel.org>
To: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
Guo Zeng <Guo.Zeng@csr.com>, Barry Song <Baohua.Song@csr.com>
Subject: [PATCH 5/9] clk: sirf: Don't reference clk_init_data after registration
Date: Wed, 31 Jul 2019 12:35:13 -0700 [thread overview]
Message-ID: <20190731193517.237136-6-sboyd@kernel.org> (raw)
In-Reply-To: <20190731193517.237136-1-sboyd@kernel.org>
A future patch is going to change semantics of clk_register() so that
clk_hw::init is guaranteed to be NULL after a clk is registered. Avoid
referencing this member here so that we don't run into NULL pointer
exceptions.
Cc: Guo Zeng <Guo.Zeng@csr.com>
Cc: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
Please ack so I can take this through clk tree
drivers/clk/sirf/clk-common.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/sirf/clk-common.c b/drivers/clk/sirf/clk-common.c
index ad7951b6b285..dcf4e25a0216 100644
--- a/drivers/clk/sirf/clk-common.c
+++ b/drivers/clk/sirf/clk-common.c
@@ -297,9 +297,10 @@ static u8 dmn_clk_get_parent(struct clk_hw *hw)
{
struct clk_dmn *clk = to_dmnclk(hw);
u32 cfg = clkc_readl(clk->regofs);
+ const char *name = clk_hw_get_name(hw);
/* parent of io domain can only be pll3 */
- if (strcmp(hw->init->name, "io") == 0)
+ if (strcmp(name, "io") == 0)
return 4;
WARN_ON((cfg & (BIT(3) - 1)) > 4);
@@ -311,9 +312,10 @@ static int dmn_clk_set_parent(struct clk_hw *hw, u8 parent)
{
struct clk_dmn *clk = to_dmnclk(hw);
u32 cfg = clkc_readl(clk->regofs);
+ const char *name = clk_hw_get_name(hw);
/* parent of io domain can only be pll3 */
- if (strcmp(hw->init->name, "io") == 0)
+ if (strcmp(name, "io") == 0)
return -EINVAL;
cfg &= ~(BIT(3) - 1);
@@ -353,7 +355,8 @@ static long dmn_clk_round_rate(struct clk_hw *hw, unsigned long rate,
{
unsigned long fin;
unsigned ratio, wait, hold;
- unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4;
+ const char *name = clk_hw_get_name(hw);
+ unsigned bits = (strcmp(name, "mem") == 0) ? 3 : 4;
fin = *parent_rate;
ratio = fin / rate;
@@ -375,7 +378,8 @@ static int dmn_clk_set_rate(struct clk_hw *hw, unsigned long rate,
struct clk_dmn *clk = to_dmnclk(hw);
unsigned long fin;
unsigned ratio, wait, hold, reg;
- unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4;
+ const char *name = clk_hw_get_name(hw);
+ unsigned bits = (strcmp(name, "mem") == 0) ? 3 : 4;
fin = parent_rate;
ratio = fin / rate;
--
Sent by a computer through tubes
next prev parent reply other threads:[~2019-07-31 19:35 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-31 19:35 [PATCH 0/9] Make clk_hw::init NULL after clk registration Stephen Boyd
2019-07-31 19:35 ` [PATCH 1/9] clk: actions: Don't reference clk_init_data after registration Stephen Boyd
2019-08-03 12:48 ` Manivannan Sadhasivam
2019-08-14 0:24 ` Stephen Boyd
2019-08-16 11:22 ` Manivannan Sadhasivam
2019-08-16 14:50 ` Stephen Boyd
2019-07-31 19:35 ` [PATCH 2/9] clk: lochnagar: " Stephen Boyd
2019-08-01 8:07 ` Charles Keepax
2019-08-14 0:24 ` Stephen Boyd
2019-07-31 19:35 ` [PATCH 3/9] clk: meson: axg-audio: " Stephen Boyd
2019-07-31 19:53 ` Neil Armstrong
2019-08-06 8:49 ` Jerome Brunet
2019-08-06 21:48 ` Stephen Boyd
2019-08-07 13:57 ` Jerome Brunet
2019-08-14 0:24 ` Stephen Boyd
2019-07-31 19:35 ` [PATCH 4/9] clk: qcom: " Stephen Boyd
2019-08-04 17:49 ` Taniya Das
2019-08-14 0:24 ` Stephen Boyd
2019-07-31 19:35 ` Stephen Boyd [this message]
2019-08-14 0:25 ` [PATCH 5/9] clk: sirf: " Stephen Boyd
2019-07-31 19:35 ` [PATCH 6/9] clk: socfpga: " Stephen Boyd
2019-08-01 15:12 ` Dinh Nguyen
2019-08-01 16:13 ` Stephen Boyd
2019-08-14 0:25 ` Stephen Boyd
2019-07-31 19:35 ` [PATCH 7/9] clk: sprd: " Stephen Boyd
2019-08-01 7:41 ` Baolin Wang
2019-08-02 1:57 ` Chunyan Zhang
2019-08-14 0:25 ` Stephen Boyd
2019-07-31 19:35 ` [PATCH 8/9] phy: ti: am654-serdes: " Stephen Boyd
2019-08-02 12:45 ` Kishon Vijay Abraham I
2019-08-14 0:25 ` Stephen Boyd
2019-07-31 19:35 ` [PATCH 9/9] clk: Overwrite clk_hw::init with NULL during clk_register() Stephen Boyd
2019-08-08 16:14 ` Sylwester Nawrocki
2019-08-14 0:25 ` 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=20190731193517.237136-6-sboyd@kernel.org \
--to=sboyd@kernel.org \
--cc=Baohua.Song@csr.com \
--cc=Guo.Zeng@csr.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).