[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220307033546.2075097-1-chi.minghao@zte.com.cn>
Date: Mon, 7 Mar 2022 03:35:46 +0000
From: cgel.zte@...il.com
To: s.nawrocki@...sung.com
Cc: tomasz.figa@...il.com, cw00.choi@...sung.com,
alim.akhtar@...sung.com, mturquette@...libre.com, sboyd@...nel.org,
krzysztof.kozlowski@...onical.com,
linux-samsung-soc@...r.kernel.org, linux-clk@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Minghao Chi <chi.minghao@....com.cn>
Subject: [PATCH V2] clk/samsung: Use of_device_get_match_data()
From: Minghao Chi (CGEL ZTE) <chi.minghao@....com.cn>
Use of_device_get_match_data() to simplify the code.
v1->v2:
Add a judgment for returning variant to NULL
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@....com.cn>
---
drivers/clk/samsung/clk-exynos-clkout.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c
index e6d6cbf8c4e6..273f77d54dab 100644
--- a/drivers/clk/samsung/clk-exynos-clkout.c
+++ b/drivers/clk/samsung/clk-exynos-clkout.c
@@ -81,19 +81,17 @@ MODULE_DEVICE_TABLE(of, exynos_clkout_ids);
static int exynos_clkout_match_parent_dev(struct device *dev, u32 *mux_mask)
{
const struct exynos_clkout_variant *variant;
- const struct of_device_id *match;
if (!dev->parent) {
dev_err(dev, "not instantiated from MFD\n");
return -EINVAL;
}
- match = of_match_device(exynos_clkout_ids, dev->parent);
- if (!match) {
+ variant = of_device_get_match_data(dev->parent);
+ if (!variant) {
dev_err(dev, "cannot match parent device\n");
return -EINVAL;
}
- variant = match->data;
*mux_mask = variant->mux_mask;
--
2.25.1
Powered by blists - more mailing lists