Commit 0720219f authored by Rob Herring's avatar Rob Herring Committed by Greg Kroah-Hartman

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: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231020105545.216052-7-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 716a8027
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/nvmem-provider.h> #include <linux/nvmem-provider.h>
#include <linux/of_device.h> #include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/stmp_device.h> #include <linux/stmp_device.h>
...@@ -140,11 +141,10 @@ static int mxs_ocotp_probe(struct platform_device *pdev) ...@@ -140,11 +141,10 @@ static int mxs_ocotp_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const struct mxs_data *data; const struct mxs_data *data;
struct mxs_ocotp *otp; struct mxs_ocotp *otp;
const struct of_device_id *match;
int ret; int ret;
match = of_match_device(dev->driver->of_match_table, dev); data = device_get_match_data(dev);
if (!match || !match->data) if (!data)
return -EINVAL; return -EINVAL;
otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL); otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL);
...@@ -169,8 +169,6 @@ static int mxs_ocotp_probe(struct platform_device *pdev) ...@@ -169,8 +169,6 @@ static int mxs_ocotp_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
data = match->data;
ocotp_config.size = data->size; ocotp_config.size = data->size;
ocotp_config.priv = otp; ocotp_config.priv = otp;
ocotp_config.dev = dev; ocotp_config.dev = dev;
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/nvmem-provider.h> #include <linux/nvmem-provider.h>
#include <linux/of_device.h> #include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/tee_drv.h> #include <linux/tee_drv.h>
#include "stm32-bsec-optee-ta.h" #include "stm32-bsec-optee-ta.h"
...@@ -211,8 +213,7 @@ static int stm32_romem_probe(struct platform_device *pdev) ...@@ -211,8 +213,7 @@ static int stm32_romem_probe(struct platform_device *pdev)
priv->lower = 0; priv->lower = 0;
cfg = (const struct stm32_romem_cfg *) cfg = device_get_match_data(dev);
of_match_device(dev->driver->of_match_table, dev)->data;
if (!cfg) { if (!cfg) {
priv->cfg.read_only = true; priv->cfg.read_only = true;
priv->cfg.size = resource_size(res); priv->cfg.size = resource_size(res);
......
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