1 From 29be47fcd6a06ea2e79eeeca6e69ad1e23254a69 Mon Sep 17 00:00:00 2001
2 From: Praveen Teja Kundanala <praveen.teja.kundanala@amd.com>
3 Date: Sat, 24 Feb 2024 11:45:11 +0000
4 Subject: [PATCH] nvmem: zynqmp_nvmem: zynqmp_nvmem_probe cleanup
6 - Remove static nvmem_config declaration
7 - Remove zynqmp_nvmem_data
9 Signed-off-by: Praveen Teja Kundanala <praveen.teja.kundanala@amd.com>
10 Acked-by: Kalyani Akula <Kalyani.akula@amd.com>
11 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
12 Link: https://lore.kernel.org/r/20240224114516.86365-7-srinivas.kandagatla@linaro.org
13 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
15 drivers/nvmem/zynqmp_nvmem.c | 37 ++++++++++++------------------------
16 1 file changed, 12 insertions(+), 25 deletions(-)
18 --- a/drivers/nvmem/zynqmp_nvmem.c
19 +++ b/drivers/nvmem/zynqmp_nvmem.c
21 // SPDX-License-Identifier: GPL-2.0+
23 * Copyright (C) 2019 Xilinx, Inc.
24 + * Copyright (C) 2022 - 2023, Advanced Micro Devices, Inc.
27 #include <linux/module.h>
30 #define SILICON_REVISION_MASK 0xF
32 -struct zynqmp_nvmem_data {
34 - struct nvmem_device *nvmem;
37 static int zynqmp_nvmem_read(void *context, unsigned int offset,
38 void *val, size_t bytes)
40 + struct device *dev = context;
42 - int idcode, version;
43 - struct zynqmp_nvmem_data *priv = context;
47 ret = zynqmp_pm_get_chipid(&idcode, &version);
51 - dev_dbg(priv->dev, "Read chipid val %x %x\n", idcode, version);
52 + dev_dbg(dev, "Read chipid val %x %x\n", idcode, version);
53 *(int *)val = version & SILICON_REVISION_MASK;
58 -static struct nvmem_config econfig = {
59 - .name = "zynqmp-nvmem",
60 - .owner = THIS_MODULE,
66 static const struct of_device_id zynqmp_nvmem_match[] = {
67 { .compatible = "xlnx,zynqmp-nvmem-fw", },
69 @@ -50,21 +40,18 @@ MODULE_DEVICE_TABLE(of, zynqmp_nvmem_mat
70 static int zynqmp_nvmem_probe(struct platform_device *pdev)
72 struct device *dev = &pdev->dev;
73 - struct zynqmp_nvmem_data *priv;
74 + struct nvmem_config econfig = {};
76 - priv = devm_kzalloc(dev, sizeof(struct zynqmp_nvmem_data), GFP_KERNEL);
81 + econfig.name = "zynqmp-nvmem";
82 + econfig.owner = THIS_MODULE;
83 + econfig.word_size = 1;
86 econfig.add_legacy_fixed_of_cells = true;
87 + econfig.read_only = true;
88 econfig.reg_read = zynqmp_nvmem_read;
89 - econfig.priv = priv;
91 - priv->nvmem = devm_nvmem_register(dev, &econfig);
93 - return PTR_ERR_OR_ZERO(priv->nvmem);
94 + return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &econfig));
97 static struct platform_driver zynqmp_nvmem_driver = {