gperf: build as C++11
[openwrt/openwrt.git] / target / linux / generic / backport-6.6 / 816-v6.7-0003-nvmem-Use-device_get_match_data.patch
1 From 0720219f4d34a88a9badb4de70cfad7585687d48 Mon Sep 17 00:00:00 2001
2 From: Rob Herring <robh@kernel.org>
3 Date: Fri, 20 Oct 2023 11:55:45 +0100
4 Subject: [PATCH] nvmem: Use device_get_match_data()
5
6 Use preferred device_get_match_data() instead of of_match_device() to
7 get the driver match data. With this, adjust the includes to explicitly
8 include the correct headers.
9
10 Signed-off-by: Rob Herring <robh@kernel.org>
11 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
12 Link: https://lore.kernel.org/r/20231020105545.216052-7-srinivas.kandagatla@linaro.org
13 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
14 ---
15 drivers/nvmem/mxs-ocotp.c | 10 ++++------
16 drivers/nvmem/stm32-romem.c | 7 ++++---
17 2 files changed, 8 insertions(+), 9 deletions(-)
18
19 --- a/drivers/nvmem/mxs-ocotp.c
20 +++ b/drivers/nvmem/mxs-ocotp.c
21 @@ -13,8 +13,9 @@
22 #include <linux/io.h>
23 #include <linux/module.h>
24 #include <linux/nvmem-provider.h>
25 -#include <linux/of_device.h>
26 +#include <linux/of.h>
27 #include <linux/platform_device.h>
28 +#include <linux/property.h>
29 #include <linux/slab.h>
30 #include <linux/stmp_device.h>
31
32 @@ -140,11 +141,10 @@ static int mxs_ocotp_probe(struct platfo
33 struct device *dev = &pdev->dev;
34 const struct mxs_data *data;
35 struct mxs_ocotp *otp;
36 - const struct of_device_id *match;
37 int ret;
38
39 - match = of_match_device(dev->driver->of_match_table, dev);
40 - if (!match || !match->data)
41 + data = device_get_match_data(dev);
42 + if (!data)
43 return -EINVAL;
44
45 otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL);
46 @@ -169,8 +169,6 @@ static int mxs_ocotp_probe(struct platfo
47 if (ret)
48 return ret;
49
50 - data = match->data;
51 -
52 ocotp_config.size = data->size;
53 ocotp_config.priv = otp;
54 ocotp_config.dev = dev;
55 --- a/drivers/nvmem/stm32-romem.c
56 +++ b/drivers/nvmem/stm32-romem.c
57 @@ -10,7 +10,9 @@
58 #include <linux/io.h>
59 #include <linux/module.h>
60 #include <linux/nvmem-provider.h>
61 -#include <linux/of_device.h>
62 +#include <linux/of.h>
63 +#include <linux/platform_device.h>
64 +#include <linux/property.h>
65 #include <linux/tee_drv.h>
66
67 #include "stm32-bsec-optee-ta.h"
68 @@ -211,8 +213,7 @@ static int stm32_romem_probe(struct plat
69
70 priv->lower = 0;
71
72 - cfg = (const struct stm32_romem_cfg *)
73 - of_match_device(dev->driver->of_match_table, dev)->data;
74 + cfg = device_get_match_data(dev);
75 if (!cfg) {
76 priv->cfg.read_only = true;
77 priv->cfg.size = resource_size(res);