0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-11-24 14:06:15 +00:00
openwrt/target/linux/generic/backport-6.6/820-v6.9-0003-nvmem-zynqmp_nvmem-zynqmp_nvmem_probe-cleanup.patch
Rafał Miłecki 944dfb1ed6 kernel: backport nvmem changes from v6.9
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2024-09-10 13:42:55 +02:00

98 lines
2.7 KiB
Diff

From 29be47fcd6a06ea2e79eeeca6e69ad1e23254a69 Mon Sep 17 00:00:00 2001
From: Praveen Teja Kundanala <praveen.teja.kundanala@amd.com>
Date: Sat, 24 Feb 2024 11:45:11 +0000
Subject: [PATCH] nvmem: zynqmp_nvmem: zynqmp_nvmem_probe cleanup
- Remove static nvmem_config declaration
- Remove zynqmp_nvmem_data
Signed-off-by: Praveen Teja Kundanala <praveen.teja.kundanala@amd.com>
Acked-by: Kalyani Akula <Kalyani.akula@amd.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20240224114516.86365-7-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvmem/zynqmp_nvmem.c | 37 ++++++++++++------------------------
1 file changed, 12 insertions(+), 25 deletions(-)
--- a/drivers/nvmem/zynqmp_nvmem.c
+++ b/drivers/nvmem/zynqmp_nvmem.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2019 Xilinx, Inc.
+ * Copyright (C) 2022 - 2023, Advanced Micro Devices, Inc.
*/
#include <linux/module.h>
@@ -11,36 +12,25 @@
#define SILICON_REVISION_MASK 0xF
-struct zynqmp_nvmem_data {
- struct device *dev;
- struct nvmem_device *nvmem;
-};
static int zynqmp_nvmem_read(void *context, unsigned int offset,
void *val, size_t bytes)
{
+ struct device *dev = context;
int ret;
- int idcode, version;
- struct zynqmp_nvmem_data *priv = context;
+ int idcode;
+ int version;
ret = zynqmp_pm_get_chipid(&idcode, &version);
if (ret < 0)
return ret;
- dev_dbg(priv->dev, "Read chipid val %x %x\n", idcode, version);
+ dev_dbg(dev, "Read chipid val %x %x\n", idcode, version);
*(int *)val = version & SILICON_REVISION_MASK;
return 0;
}
-static struct nvmem_config econfig = {
- .name = "zynqmp-nvmem",
- .owner = THIS_MODULE,
- .word_size = 1,
- .size = 1,
- .read_only = true,
-};
-
static const struct of_device_id zynqmp_nvmem_match[] = {
{ .compatible = "xlnx,zynqmp-nvmem-fw", },
{ /* sentinel */ },
@@ -50,21 +40,18 @@ MODULE_DEVICE_TABLE(of, zynqmp_nvmem_mat
static int zynqmp_nvmem_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- struct zynqmp_nvmem_data *priv;
+ struct nvmem_config econfig = {};
- priv = devm_kzalloc(dev, sizeof(struct zynqmp_nvmem_data), GFP_KERNEL);
- if (!priv)
- return -ENOMEM;
-
- priv->dev = dev;
+ econfig.name = "zynqmp-nvmem";
+ econfig.owner = THIS_MODULE;
+ econfig.word_size = 1;
+ econfig.size = 1;
econfig.dev = dev;
econfig.add_legacy_fixed_of_cells = true;
+ econfig.read_only = true;
econfig.reg_read = zynqmp_nvmem_read;
- econfig.priv = priv;
-
- priv->nvmem = devm_nvmem_register(dev, &econfig);
- return PTR_ERR_OR_ZERO(priv->nvmem);
+ return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &econfig));
}
static struct platform_driver zynqmp_nvmem_driver = {