diff options
author | Maxime Ripard <[email protected]> | 2023-05-05 13:26:10 +0200 |
---|---|---|
committer | Stephen Boyd <[email protected]> | 2023-06-08 18:39:36 -0700 |
commit | 326cc42f9fdc3030676e949d5cea3ccc923fd1de (patch) | |
tree | f20c4abb13cbd0d0ad56ac97a16e0372f3edc688 | |
parent | 2b6c9b0eee89379fda238d543c5acf098a2ac5a5 (diff) |
clk: Forbid to register a mux without determine_rate
The determine_rate hook allows to select the proper parent and its rate
for a given clock configuration. On another hand, set_parent is there to
change the parent of a mux.
Some clocks provide a set_parent hook but don't implement
determine_rate. In such a case, set_parent is pretty much useless since
the clock framework will always assume the current parent is to be used,
and we will thus never change it.
This situation can be solved in two ways:
- either we don't need to change the parent, and we thus shouldn't
implement set_parent;
- or we don't want to change the parent, in this case we should set
CLK_SET_RATE_NO_REPARENT;
- or we're missing a determine_rate implementation.
The latter is probably just an oversight from the driver's author, and
we should thus raise their awareness about the fact that the current
state of the driver is confusing.
All the drivers in-tree have been converted by now, so let's prevent any
clock with set_parent but without determine_rate to register so that it
can't sneak in again in the future.
Cc: Abel Vesa <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: "Andreas Färber" <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Cc: Baolin Wang <[email protected]>
Cc: Charles Keepax <[email protected]>
Cc: Chen-Yu Tsai <[email protected]>
Cc: Chen-Yu Tsai <[email protected]>
Cc: Chunyan Zhang <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: David Lechner <[email protected]>
Cc: Dinh Nguyen <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Jaroslav Kysela <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonathan Hunter <[email protected]>
Cc: Kishon Vijay Abraham I <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Luca Ceresoli <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Markus Schneider-Pargmann <[email protected]>
Cc: Max Filippov <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Mikko Perttunen <[email protected]>
Cc: Miles Chen <[email protected]>
Cc: Nicolas Ferre <[email protected]>
Cc: Orson Zhai <[email protected]>
Cc: Paul Cercueil <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Peter De Schrijver <[email protected]>
Cc: Prashant Gaikwad <[email protected]>
Cc: Richard Fitzgerald <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Sekhar Nori <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: Vinod Koul <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: NXP Linux Team <[email protected]>
Cc: [email protected]
Cc: Pengutronix Kernel Team <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Maxime Ripard <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Stephen Boyd <[email protected]>
-rw-r--r-- | drivers/clk/clk.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index ad4488dedd01..ffc9f03840b7 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3776,6 +3776,13 @@ static int __clk_core_init(struct clk_core *core) goto out; } + if (core->ops->set_parent && !core->ops->determine_rate) { + pr_err("%s: %s must implement .set_parent & .determine_rate\n", + __func__, core->name); + ret = -EINVAL; + goto out; + } + if (core->num_parents > 1 && !core->ops->get_parent) { pr_err("%s: %s must implement .get_parent as it has multi parents\n", __func__, core->name); |