mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 18:05:21 +02:00
nvmem: core: add nvmem_dev_size() helper
[ Upstream commit33cf42e68e
] This is required by layouts that need to read whole NVMEM content. It's especially useful for NVMEM devices without hardcoded layout (like U-Boot environment data block). Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20231221173421.13737-2-zajec5@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Stable-dep-of:8679e8b4a1
("nvmem: u-boot-env: error if NVMEM device is too small") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
f7dc14df1b
commit
820b1b981a
|
@ -2131,6 +2131,19 @@ const char *nvmem_dev_name(struct nvmem_device *nvmem)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(nvmem_dev_name);
|
EXPORT_SYMBOL_GPL(nvmem_dev_name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nvmem_dev_size() - Get the size of a given nvmem device.
|
||||||
|
*
|
||||||
|
* @nvmem: nvmem device.
|
||||||
|
*
|
||||||
|
* Return: size of the nvmem device.
|
||||||
|
*/
|
||||||
|
size_t nvmem_dev_size(struct nvmem_device *nvmem)
|
||||||
|
{
|
||||||
|
return nvmem->size;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(nvmem_dev_size);
|
||||||
|
|
||||||
static int __init nvmem_init(void)
|
static int __init nvmem_init(void)
|
||||||
{
|
{
|
||||||
return bus_register(&nvmem_bus_type);
|
return bus_register(&nvmem_bus_type);
|
||||||
|
|
|
@ -81,6 +81,7 @@ int nvmem_device_cell_write(struct nvmem_device *nvmem,
|
||||||
struct nvmem_cell_info *info, void *buf);
|
struct nvmem_cell_info *info, void *buf);
|
||||||
|
|
||||||
const char *nvmem_dev_name(struct nvmem_device *nvmem);
|
const char *nvmem_dev_name(struct nvmem_device *nvmem);
|
||||||
|
size_t nvmem_dev_size(struct nvmem_device *nvmem);
|
||||||
|
|
||||||
void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries,
|
void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries,
|
||||||
size_t nentries);
|
size_t nentries);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user