[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d7951827-1023-4cd6-4230-0915716ee276@pengutronix.de>
Date: Wed, 11 Jan 2023 07:52:22 +0100
From: Ahmad Fatoum <a.fatoum@...gutronix.de>
To: Rafał Miłecki <zajec5@...il.com>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>
Cc: devicetree@...r.kernel.org, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
linux-kernel@...r.kernel.org, u-boot@...ts.denx.de,
Michael Walle <michael@...le.cc>,
NXP Linux Team <linux-imx@....com>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Rafał Miłecki <rafal@...ecki.pl>,
Fabio Estevam <festevam@...il.com>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 1/6] nvmem: core: add nvmem_dev_size() helper
On 10.01.23 11:54, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@...ecki.pl>
>
> This is required by layouts that need to read whole NVMEM space. It
> applies to NVMEM devices without hardcoded layout (like U-Boot
> environment data block).
>
> Signed-off-by: Rafał Miłecki <rafal@...ecki.pl>
> ---
> drivers/nvmem/core.c | 13 +++++++++++++
> include/linux/nvmem-consumer.h | 1 +
> 2 files changed, 14 insertions(+)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 1f05f0a50d86..81743ae8793b 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -2062,6 +2062,19 @@ void nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries)
> }
> EXPORT_SYMBOL_GPL(nvmem_del_cell_lookups);
>
> +/**
> + * nvmem_dev_size() - Get the size of a given nvmem device.
> + *
> + * @nvmem: nvmem device.
> + *
> + * Return: size of the nvmem device.
> + */
> +const size_t nvmem_dev_size(struct nvmem_device *nvmem)
The const here is quite unusual. You can make the parameter
a const struct nvmem_device though.
> +{
> + return nvmem->size;
> +}
> +EXPORT_SYMBOL_GPL(nvmem_dev_size);
> +
> /**
> * nvmem_dev_name() - Get the name of a given nvmem device.
> *
> diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
> index fa030d93b768..d88294ddf562 100644
> --- a/include/linux/nvmem-consumer.h
> +++ b/include/linux/nvmem-consumer.h
> @@ -78,6 +78,7 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem,
> int nvmem_device_cell_write(struct nvmem_device *nvmem,
> struct nvmem_cell_info *info, void *buf);
>
> +const size_t nvmem_dev_size(struct nvmem_device *nvmem);
> const char *nvmem_dev_name(struct nvmem_device *nvmem);
>
> void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries,
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Powered by blists - more mailing lists