mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Claudiu Beznea <claudiu.beznea@tuxon.dev>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Broadcom internal kernel review list 
	<bcm-kernel-feedback-list@broadcom.com>
Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH] memory: Use device_get_match_data()
Date: Fri,  6 Oct 2023 17:44:01 -0500	[thread overview]
Message-ID: <20231006224402.442078-1-robh@kernel.org> (raw)

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: Rob Herring <robh@kernel.org>
---
 drivers/memory/atmel-ebi.c      | 14 +++++++-------
 drivers/memory/brcmstb_memc.c   |  9 +++------
 drivers/memory/fsl-corenet-cf.c | 11 ++---------
 3 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
index ec6100bc94c5..e8bb5f37f5cb 100644
--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -12,7 +12,10 @@
 #include <linux/mfd/syscon/atmel-matrix.h>
 #include <linux/mfd/syscon/atmel-smc.h>
 #include <linux/init.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
 #include <linux/regmap.h>
 #include <soc/at91/atmel-sfr.h>
 
@@ -515,16 +518,11 @@ static int atmel_ebi_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct device_node *child, *np = dev->of_node, *smc_np;
-	const struct of_device_id *match;
 	struct atmel_ebi *ebi;
 	int ret, reg_cells;
 	struct clk *clk;
 	u32 val;
 
-	match = of_match_device(atmel_ebi_id_table, dev);
-	if (!match || !match->data)
-		return -EINVAL;
-
 	ebi = devm_kzalloc(dev, sizeof(*ebi), GFP_KERNEL);
 	if (!ebi)
 		return -ENOMEM;
@@ -532,7 +530,9 @@ static int atmel_ebi_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, ebi);
 
 	INIT_LIST_HEAD(&ebi->devs);
-	ebi->caps = match->data;
+	ebi->caps = device_get_match_data(dev);
+	if (!ebi->caps)
+		return -EINVAL;
 	ebi->dev = dev;
 
 	clk = devm_clk_get(dev, NULL);
diff --git a/drivers/memory/brcmstb_memc.c b/drivers/memory/brcmstb_memc.c
index 233a53f5bce1..a6ea51996522 100644
--- a/drivers/memory/brcmstb_memc.c
+++ b/drivers/memory/brcmstb_memc.c
@@ -8,8 +8,9 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 
 #define REG_MEMC_CNTRLR_CONFIG		0x00
 #define  CNTRLR_CONFIG_LPDDR4_SHIFT	5
@@ -121,12 +122,9 @@ static struct attribute_group dev_attr_group = {
 	.attrs = dev_attrs,
 };
 
-static const struct of_device_id brcmstb_memc_of_match[];
-
 static int brcmstb_memc_probe(struct platform_device *pdev)
 {
 	const struct brcmstb_memc_data *memc_data;
-	const struct of_device_id *of_id;
 	struct device *dev = &pdev->dev;
 	struct brcmstb_memc *memc;
 	int ret;
@@ -137,8 +135,7 @@ static int brcmstb_memc_probe(struct platform_device *pdev)
 
 	dev_set_drvdata(dev, memc);
 
-	of_id = of_match_device(brcmstb_memc_of_match, dev);
-	memc_data = of_id->data;
+	memc_data = device_get_match_data(dev);
 	memc->srpd_offset = memc_data->srpd_offset;
 
 	memc->ddr_ctrl = devm_platform_ioremap_resource(pdev, 0);
diff --git a/drivers/memory/fsl-corenet-cf.c b/drivers/memory/fsl-corenet-cf.c
index 7fc9f57ae278..8096c4f33303 100644
--- a/drivers/memory/fsl-corenet-cf.c
+++ b/drivers/memory/fsl-corenet-cf.c
@@ -10,10 +10,8 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/of_address.h>
-#include <linux/of_device.h>
-#include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 
 enum ccf_version {
 	CCF1,
@@ -172,14 +170,9 @@ static irqreturn_t ccf_irq(int irq, void *dev_id)
 static int ccf_probe(struct platform_device *pdev)
 {
 	struct ccf_private *ccf;
-	const struct of_device_id *match;
 	u32 errinten;
 	int ret, irq;
 
-	match = of_match_device(ccf_matches, &pdev->dev);
-	if (WARN_ON(!match))
-		return -ENODEV;
-
 	ccf = devm_kzalloc(&pdev->dev, sizeof(*ccf), GFP_KERNEL);
 	if (!ccf)
 		return -ENOMEM;
@@ -189,7 +182,7 @@ static int ccf_probe(struct platform_device *pdev)
 		return PTR_ERR(ccf->regs);
 
 	ccf->dev = &pdev->dev;
-	ccf->info = match->data;
+	ccf->info = device_get_match_data(&pdev->dev);
 	ccf->err_regs = ccf->regs + ccf->info->err_reg_offs;
 
 	if (ccf->info->has_brr) {
-- 
2.40.1


             reply	other threads:[~2023-10-06 22:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 22:44 Rob Herring [this message]
2023-10-06 22:47 ` Florian Fainelli
2023-10-08 11:33 ` Krzysztof Kozlowski
2023-10-09 12:10   ` Rob Herring
2023-10-12 13:43 ` Krzysztof Kozlowski

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=20231006224402.442078-1-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=florian.fainelli@broadcom.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@microchip.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

all inboxes | Powered by JetHome®