[PATCH 2/3] clk: keystone: syscon-clk: specify whether a parent is required in match data

From: Matthias Schiffer
Date: Tue Aug 01 2023 - 06:36:37 EST


Avoid checking the compatible string again in the probe function.

No functional change intended.

Fixes: 6acab96ee337 ("clk: keystone: syscon-clk: Add support for audio refclk")
Signed-off-by: Matthias Schiffer <matthias.schiffer@xxxxxxxxxxxxxxx>
---
drivers/clk/keystone/syscon-clk.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/keystone/syscon-clk.c b/drivers/clk/keystone/syscon-clk.c
index 68ac536f564e..9626a877e072 100644
--- a/drivers/clk/keystone/syscon-clk.c
+++ b/drivers/clk/keystone/syscon-clk.c
@@ -27,6 +27,7 @@ struct ti_syscon_gate_clk_entry {
struct ti_syscon_gate_clk_data {
const struct ti_syscon_gate_clk_entry *clks;
size_t num_clks;
+ bool needs_parent;
};

static struct
@@ -129,11 +130,9 @@ static int ti_syscon_gate_clk_probe(struct platform_device *pdev)
"failed to get regmap\n");

num_parents = of_clk_get_parent_count(dev->of_node);
- if (of_device_is_compatible(dev->of_node, "ti,am62-audio-refclk") &&
- num_parents == 0) {
+ if (data->needs_parent && num_parents == 0)
return dev_err_probe(dev, -EINVAL,
"must specify a parent clock\n");
- }

hw_data = devm_kzalloc(dev, struct_size(hw_data, hws, data->num_clks),
GFP_KERNEL);
@@ -208,6 +207,7 @@ static const struct ti_syscon_gate_clk_entry am62_audio_clks[] = {
static const struct ti_syscon_gate_clk_data am62_audio_clk_data = {
.clks = am62_audio_clks,
.num_clks = ARRAY_SIZE(am62_audio_clks),
+ .needs_parent = true,
};

static const struct of_device_id ti_syscon_gate_clk_ids[] = {
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/