2024-03-05 07:00:06

by Mukesh Ojha

[permalink] [raw]
Subject: [PATCH] nvmem: meson-mx-efuse: Remove nvmem_device from efuse struct

nvmem_device is used at one place while registering nvmem
device and it is not required to be present in efuse struct
for just this purpose.

Drop nvmem_device and manage with nvmem device stack variable.

Signed-off-by: Mukesh Ojha <[email protected]>
---
drivers/nvmem/meson-mx-efuse.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/nvmem/meson-mx-efuse.c b/drivers/nvmem/meson-mx-efuse.c
index 3ff04d5ca8f8..3f01fe03dde5 100644
--- a/drivers/nvmem/meson-mx-efuse.c
+++ b/drivers/nvmem/meson-mx-efuse.c
@@ -43,7 +43,6 @@ struct meson_mx_efuse_platform_data {
struct meson_mx_efuse {
void __iomem *base;
struct clk *core_clk;
- struct nvmem_device *nvmem;
struct nvmem_config config;
};

@@ -223,9 +222,9 @@ static int meson_mx_efuse_probe(struct platform_device *pdev)
return PTR_ERR(efuse->core_clk);
}

- efuse->nvmem = devm_nvmem_register(&pdev->dev, &efuse->config);
+ nvmem = devm_nvmem_register(&pdev->dev, &efuse->config);

- return PTR_ERR_OR_ZERO(efuse->nvmem);
+ return PTR_ERR_OR_ZERO(nvmem);
}

static struct platform_driver meson_mx_efuse_driver = {
--
2.7.4



2024-03-07 20:57:16

by Martin Blumenstingl

[permalink] [raw]
Subject: Re: [PATCH] nvmem: meson-mx-efuse: Remove nvmem_device from efuse struct

Hello Mukesh,

On Tue, Mar 5, 2024 at 7:58 AM Mukesh Ojha <[email protected]> wrote:
>
> nvmem_device is used at one place while registering nvmem
> device and it is not required to be present in efuse struct
> for just this purpose.
>
> Drop nvmem_device and manage with nvmem device stack variable.
I'm generally fine with this approach

[...]
> @@ -223,9 +222,9 @@ static int meson_mx_efuse_probe(struct platform_device *pdev)
> return PTR_ERR(efuse->core_clk);
> }
>
> - efuse->nvmem = devm_nvmem_register(&pdev->dev, &efuse->config);
> + nvmem = devm_nvmem_register(&pdev->dev, &efuse->config);
But this doesn't compile for me:
CC drivers/nvmem/meson-mx-efuse.o
./drivers/nvmem/meson-mx-efuse.c: In function 'meson_mx_efuse_probe':
./drivers/nvmem/meson-mx-efuse.c:252:9: error: 'nvmem' undeclared
(first use in this function)
252 | nvmem = devm_nvmem_register(&pdev->dev, &efuse->config);


Best regards,
Martin

2024-03-12 16:13:11

by Mukesh Ojha

[permalink] [raw]
Subject: Re: [PATCH] nvmem: meson-mx-efuse: Remove nvmem_device from efuse struct

Hi Martin,

On 3/8/2024 2:26 AM, Martin Blumenstingl wrote:
> Hello Mukesh,
>
> On Tue, Mar 5, 2024 at 7:58 AM Mukesh Ojha <[email protected]> wrote:
>>
>> nvmem_device is used at one place while registering nvmem
>> device and it is not required to be present in efuse struct
>> for just this purpose.
>>
>> Drop nvmem_device and manage with nvmem device stack variable.
> I'm generally fine with this approach

Thanks.
Sorry for the late reply, was on vacation.

>
> [...]
>> @@ -223,9 +222,9 @@ static int meson_mx_efuse_probe(struct platform_device *pdev)
>> return PTR_ERR(efuse->core_clk);
>> }
>>
>> - efuse->nvmem = devm_nvmem_register(&pdev->dev, &efuse->config);
>> + nvmem = devm_nvmem_register(&pdev->dev, &efuse->config);
> But this doesn't compile for me:
> CC drivers/nvmem/meson-mx-efuse.o
> ../drivers/nvmem/meson-mx-efuse.c: In function 'meson_mx_efuse_probe':
> ../drivers/nvmem/meson-mx-efuse.c:252:9: error: 'nvmem' undeclared
> (first use in this function)
> 252 | nvmem = devm_nvmem_register(&pdev->dev, &efuse->config);

Sent too soon., change was cached never got commited..

v2:
https://lore.kernel.org/lkml/[email protected]/

Thanks,
-Mukesh

>
>
> Best regards,
> Martin