Commit 09de3691 authored by Rob Herring's avatar Rob Herring Committed by Krzysztof Kozlowski

memory: 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>
Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20231006224402.442078-1-robh@kernel.orgSigned-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
parent 9def28f3
...@@ -12,7 +12,10 @@ ...@@ -12,7 +12,10 @@
#include <linux/mfd/syscon/atmel-matrix.h> #include <linux/mfd/syscon/atmel-matrix.h>
#include <linux/mfd/syscon/atmel-smc.h> #include <linux/mfd/syscon/atmel-smc.h>
#include <linux/init.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 <linux/regmap.h>
#include <soc/at91/atmel-sfr.h> #include <soc/at91/atmel-sfr.h>
...@@ -515,16 +518,11 @@ static int atmel_ebi_probe(struct platform_device *pdev) ...@@ -515,16 +518,11 @@ static int atmel_ebi_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *child, *np = dev->of_node, *smc_np; struct device_node *child, *np = dev->of_node, *smc_np;
const struct of_device_id *match;
struct atmel_ebi *ebi; struct atmel_ebi *ebi;
int ret, reg_cells; int ret, reg_cells;
struct clk *clk; struct clk *clk;
u32 val; 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); ebi = devm_kzalloc(dev, sizeof(*ebi), GFP_KERNEL);
if (!ebi) if (!ebi)
return -ENOMEM; return -ENOMEM;
...@@ -532,7 +530,9 @@ static int atmel_ebi_probe(struct platform_device *pdev) ...@@ -532,7 +530,9 @@ static int atmel_ebi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ebi); platform_set_drvdata(pdev, ebi);
INIT_LIST_HEAD(&ebi->devs); INIT_LIST_HEAD(&ebi->devs);
ebi->caps = match->data; ebi->caps = device_get_match_data(dev);
if (!ebi->caps)
return -EINVAL;
ebi->dev = dev; ebi->dev = dev;
clk = devm_clk_get(dev, NULL); clk = devm_clk_get(dev, NULL);
......
...@@ -8,8 +8,9 @@ ...@@ -8,8 +8,9 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_device.h> #include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#define REG_MEMC_CNTRLR_CONFIG 0x00 #define REG_MEMC_CNTRLR_CONFIG 0x00
#define CNTRLR_CONFIG_LPDDR4_SHIFT 5 #define CNTRLR_CONFIG_LPDDR4_SHIFT 5
...@@ -121,12 +122,9 @@ static struct attribute_group dev_attr_group = { ...@@ -121,12 +122,9 @@ static struct attribute_group dev_attr_group = {
.attrs = dev_attrs, .attrs = dev_attrs,
}; };
static const struct of_device_id brcmstb_memc_of_match[];
static int brcmstb_memc_probe(struct platform_device *pdev) static int brcmstb_memc_probe(struct platform_device *pdev)
{ {
const struct brcmstb_memc_data *memc_data; const struct brcmstb_memc_data *memc_data;
const struct of_device_id *of_id;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct brcmstb_memc *memc; struct brcmstb_memc *memc;
int ret; int ret;
...@@ -137,8 +135,7 @@ static int brcmstb_memc_probe(struct platform_device *pdev) ...@@ -137,8 +135,7 @@ static int brcmstb_memc_probe(struct platform_device *pdev)
dev_set_drvdata(dev, memc); dev_set_drvdata(dev, memc);
of_id = of_match_device(brcmstb_memc_of_match, dev); memc_data = device_get_match_data(dev);
memc_data = of_id->data;
memc->srpd_offset = memc_data->srpd_offset; memc->srpd_offset = memc_data->srpd_offset;
memc->ddr_ctrl = devm_platform_ioremap_resource(pdev, 0); memc->ddr_ctrl = devm_platform_ioremap_resource(pdev, 0);
......
...@@ -10,10 +10,8 @@ ...@@ -10,10 +10,8 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.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/platform_device.h>
#include <linux/property.h>
enum ccf_version { enum ccf_version {
CCF1, CCF1,
...@@ -172,14 +170,9 @@ static irqreturn_t ccf_irq(int irq, void *dev_id) ...@@ -172,14 +170,9 @@ static irqreturn_t ccf_irq(int irq, void *dev_id)
static int ccf_probe(struct platform_device *pdev) static int ccf_probe(struct platform_device *pdev)
{ {
struct ccf_private *ccf; struct ccf_private *ccf;
const struct of_device_id *match;
u32 errinten; u32 errinten;
int ret, irq; 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); ccf = devm_kzalloc(&pdev->dev, sizeof(*ccf), GFP_KERNEL);
if (!ccf) if (!ccf)
return -ENOMEM; return -ENOMEM;
...@@ -189,7 +182,7 @@ static int ccf_probe(struct platform_device *pdev) ...@@ -189,7 +182,7 @@ static int ccf_probe(struct platform_device *pdev)
return PTR_ERR(ccf->regs); return PTR_ERR(ccf->regs);
ccf->dev = &pdev->dev; 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; ccf->err_regs = ccf->regs + ccf->info->err_reg_offs;
if (ccf->info->has_brr) { if (ccf->info->has_brr) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment