diff options
author | Yangtao Li <tiny.windzz@gmail.com> | 2020-03-10 14:22:46 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-03-19 07:41:02 +0100 |
commit | 8b977c5498b8336b0c61b0fa72f6353e71f938da (patch) | |
tree | 0f3fc0615140f4f6c0036e32e44675aaded61fa7 /drivers/nvmem | |
parent | nvmem: core: add nvmem_cell_read_common (diff) | |
download | linux-8b977c5498b8336b0c61b0fa72f6353e71f938da.tar.xz linux-8b977c5498b8336b0c61b0fa72f6353e71f938da.zip |
nvmem: core: add nvmem_cell_read_u64
Add nvmem_cell_read_u64() helper to ease read of an u64 value on consumer
side. This helper is useful on some sunxi platform that has 64 bits data
cells stored in no volatile memory.
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200310132257.23358-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r-- | drivers/nvmem/core.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index b3619f335693..4634af1f6341 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -1147,6 +1147,21 @@ int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val) EXPORT_SYMBOL_GPL(nvmem_cell_read_u32); /** + * nvmem_cell_read_u64() - Read a cell value as an u64 + * + * @dev: Device that requests the nvmem cell. + * @cell_id: Name of nvmem cell to read. + * @val: pointer to output value. + * + * Return: 0 on success or negative errno. + */ +int nvmem_cell_read_u64(struct device *dev, const char *cell_id, u64 *val) +{ + return nvmem_cell_read_common(dev, cell_id, val, sizeof(*val)); +} +EXPORT_SYMBOL_GPL(nvmem_cell_read_u64); + +/** * nvmem_device_cell_read() - Read a given nvmem device and cell * * @nvmem: nvmem device to read from. |