Commit 409c39ec authored by Rob Herring's avatar Rob Herring Committed by Stephen Boyd
Browse files

clk: Use device_get_match_data()



Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: default avatarRob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231006213959.334439-1-robh@kernel.org


Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> #msm part
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> # Samsung
Acked-by: default avatarDavid Lechner <david@lechnology.com>
Acked-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: default avatarBjorn Andersson <andersson@kernel.org>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent faf6b92e
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -12,8 +12,8 @@
#include <linux/device.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>

#include <linux/mfd/lochnagar1_regs.h>
@@ -242,22 +242,17 @@ static int lochnagar_clk_probe(struct platform_device *pdev)
	};
	struct device *dev = &pdev->dev;
	struct lochnagar_clk_priv *priv;
	const struct of_device_id *of_id;
	struct lochnagar_clk *lclk;
	struct lochnagar_config *conf;
	int ret, i;

	of_id = of_match_device(lochnagar_of_match, dev);
	if (!of_id)
		return -EINVAL;

	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
	if (!priv)
		return -ENOMEM;

	priv->dev = dev;
	priv->regmap = dev_get_regmap(dev->parent, NULL);
	conf = (struct lochnagar_config *)of_id->data;
	conf = (struct lochnagar_config *)device_get_match_data(dev);

	memcpy(priv->lclks, conf->clks, sizeof(priv->lclks));

+3 −5
Original line number Diff line number Diff line
@@ -11,10 +11,10 @@
#include <linux/init.h>
#include <linux/mfd/da8xx-cfgchip.h>
#include <linux/mfd/syscon.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_data/clk-da8xx-cfgchip.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/slab.h>

@@ -744,15 +744,13 @@ static int da8xx_cfgchip_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct da8xx_cfgchip_clk_platform_data *pdata = dev->platform_data;
	const struct of_device_id *of_id;
	da8xx_cfgchip_init clk_init = NULL;
	struct regmap *regmap = NULL;

	of_id = of_match_device(da8xx_cfgchip_of_match, dev);
	if (of_id) {
	clk_init = device_get_match_data(dev);
	if (clk_init) {
		struct device_node *parent;

		clk_init = of_id->data;
		parent = of_get_parent(dev->of_node);
		regmap = syscon_node_to_regmap(parent);
		of_node_put(parent);
+3 −7
Original line number Diff line number Diff line
@@ -18,11 +18,10 @@
#include <linux/kernel.h>
#include <linux/mfd/syscon.h>
#include <linux/notifier.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_data/clk-davinci-pll.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/types.h>
@@ -892,14 +891,11 @@ static int davinci_pll_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct davinci_pll_platform_data *pdata;
	const struct of_device_id *of_id;
	davinci_pll_init pll_init = NULL;
	void __iomem *base;

	of_id = of_match_device(davinci_pll_of_match, dev);
	if (of_id)
		pll_init = of_id->data;
	else if (pdev->id_entry)
	pll_init = device_get_match_data(dev);
	if (!pll_init && pdev->id_entry)
		pll_init = (void *)pdev->id_entry->driver_data;

	if (!pll_init) {
+3 −7
Original line number Diff line number Diff line
@@ -18,10 +18,9 @@
#include <linux/clk/davinci.h>
#include <linux/clkdev.h>
#include <linux/err.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/pm_clock.h>
#include <linux/pm_domain.h>
#include <linux/regmap.h>
@@ -517,15 +516,12 @@ static const struct platform_device_id davinci_psc_id_table[] = {
static int davinci_psc_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	const struct of_device_id *of_id;
	const struct davinci_psc_init_data *init_data = NULL;
	void __iomem *base;
	int ret;

	of_id = of_match_device(davinci_psc_of_match, dev);
	if (of_id)
		init_data = of_id->data;
	else if (pdev->id_entry)
	init_data = device_get_match_data(dev);
	if (!init_data && pdev->id_entry)
		init_data = (void *)pdev->id_entry->driver_data;

	if (!init_data) {
+5 −8
Original line number Diff line number Diff line
@@ -7,9 +7,10 @@
#include <linux/bitops.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_platform.h>
#include <linux/clk-provider.h>
#include <linux/regmap.h>
#include <linux/reset-controller.h>
@@ -3716,14 +3717,10 @@ MODULE_DEVICE_TABLE(of, gcc_msm8960_match_table);
static int gcc_msm8960_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	const struct of_device_id *match;
	struct platform_device *tsens;
	const struct qcom_cc_desc *desc = device_get_match_data(dev);
	int ret;

	match = of_match_device(gcc_msm8960_match_table, &pdev->dev);
	if (!match)
		return -EINVAL;

	ret = qcom_cc_register_board_clk(dev, "cxo_board", "cxo", 19200000);
	if (ret)
		return ret;
@@ -3732,11 +3729,11 @@ static int gcc_msm8960_probe(struct platform_device *pdev)
	if (ret)
		return ret;

	ret = qcom_cc_probe(pdev, match->data);
	ret = qcom_cc_probe(pdev, desc);
	if (ret)
		return ret;

	if (match->data == &gcc_apq8064_desc) {
	if (desc == &gcc_apq8064_desc) {
		hfpll1.d = &hfpll1_8064_data;
		hfpll_l2.d = &hfpll_l2_8064_data;
	}
Loading