Skip to content

Commit

Permalink
nvmem: core: add nvmem_dev_size() helper
Browse files Browse the repository at this point in the history
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@milecki.pl>
  • Loading branch information
Rafał Miłecki authored and intel-lab-lkp committed Jan 10, 2023
1 parent 435bf71 commit 4d5cc61
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/nvmem/core.c
Expand Up @@ -2060,6 +2060,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)
{
return nvmem->size;
}
EXPORT_SYMBOL_GPL(nvmem_dev_size);

/**
* nvmem_dev_name() - Get the name of a given nvmem device.
*
Expand Down
1 change: 1 addition & 0 deletions include/linux/nvmem-consumer.h
Expand Up @@ -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,
Expand Down

0 comments on commit 4d5cc61

Please sign in to comment.