summaryrefslogtreecommitdiff
path: root/drivers/nvmem
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2023-04-04 20:21:28 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-05 20:41:11 +0300
commit8a134fd9f9323f4c39ec27055b3d3723cfb5c1e9 (patch)
tree6e5aaa7c3bec04736c3e1c29c129b3f66396732a /drivers/nvmem
parent011e40a166fdaa65fb9946b7cd91efec85b70dbb (diff)
downloadlinux-8a134fd9f9323f4c39ec27055b3d3723cfb5c1e9.tar.xz
nvmem: core: provide own priv pointer in post process callback
It doesn't make any more sense to have a opaque pointer set up by the nvmem device. Usually, the layout isn't associated with a particular nvmem device. Instead, let the caller who set the post process callback provide the priv pointer. Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20230404172148.82422-21-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r--drivers/nvmem/core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index fccb2728193a..212c5ba5789f 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -54,6 +54,7 @@ struct nvmem_cell_entry {
int bit_offset;
int nbits;
nvmem_cell_post_process_t read_post_process;
+ void *priv;
struct device_node *np;
struct nvmem_device *nvmem;
struct list_head node;
@@ -471,6 +472,7 @@ static int nvmem_cell_info_to_nvmem_cell_entry_nodup(struct nvmem_device *nvmem,
cell->bytes = info->bytes;
cell->name = info->name;
cell->read_post_process = info->read_post_process;
+ cell->priv = info->priv;
cell->bit_offset = info->bit_offset;
cell->nbits = info->nbits;
@@ -1568,7 +1570,7 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
nvmem_shift_read_buffer_in_place(cell, buf);
if (cell->read_post_process) {
- rc = cell->read_post_process(nvmem->priv, id, index,
+ rc = cell->read_post_process(cell->priv, id, index,
cell->offset, buf, cell->bytes);
if (rc)
return rc;