Skip to content

Commit 0720219

Browse files
robherringgregkh
authored andcommitted
nvmem: 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: Rob Herring <robh@kernel.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20231020105545.216052-7-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 716a802 commit 0720219

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

drivers/nvmem/mxs-ocotp.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
#include <linux/io.h>
1414
#include <linux/module.h>
1515
#include <linux/nvmem-provider.h>
16-
#include <linux/of_device.h>
16+
#include <linux/of.h>
1717
#include <linux/platform_device.h>
18+
#include <linux/property.h>
1819
#include <linux/slab.h>
1920
#include <linux/stmp_device.h>
2021

@@ -140,11 +141,10 @@ static int mxs_ocotp_probe(struct platform_device *pdev)
140141
struct device *dev = &pdev->dev;
141142
const struct mxs_data *data;
142143
struct mxs_ocotp *otp;
143-
const struct of_device_id *match;
144144
int ret;
145145

146-
match = of_match_device(dev->driver->of_match_table, dev);
147-
if (!match || !match->data)
146+
data = device_get_match_data(dev);
147+
if (!data)
148148
return -EINVAL;
149149

150150
otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL);
@@ -169,8 +169,6 @@ static int mxs_ocotp_probe(struct platform_device *pdev)
169169
if (ret)
170170
return ret;
171171

172-
data = match->data;
173-
174172
ocotp_config.size = data->size;
175173
ocotp_config.priv = otp;
176174
ocotp_config.dev = dev;

drivers/nvmem/stm32-romem.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#include <linux/io.h>
1111
#include <linux/module.h>
1212
#include <linux/nvmem-provider.h>
13-
#include <linux/of_device.h>
13+
#include <linux/of.h>
14+
#include <linux/platform_device.h>
15+
#include <linux/property.h>
1416
#include <linux/tee_drv.h>
1517

1618
#include "stm32-bsec-optee-ta.h"
@@ -211,8 +213,7 @@ static int stm32_romem_probe(struct platform_device *pdev)
211213

212214
priv->lower = 0;
213215

214-
cfg = (const struct stm32_romem_cfg *)
215-
of_match_device(dev->driver->of_match_table, dev)->data;
216+
cfg = device_get_match_data(dev);
216217
if (!cfg) {
217218
priv->cfg.read_only = true;
218219
priv->cfg.size = resource_size(res);

0 commit comments

Comments
 (0)