Thread (41 messages) 41 messages, 6 authors, 2022-09-23

Re: [PATCH v2 13/20] nvmem: core: drop priv pointer in post process callback

From: Srinivas Kandagatla <hidden>
Date: 2022-09-09 08:52:36
Also in: linux-arm-kernel, lkml


On 01/09/2022 23:18, Michael Walle wrote:
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.
This is really not a good idea to remove the context pointer, as this is 
the only way for callback to get context which it can make use of.

I would prefer this to be left as it is.

--srini
quoted hunk ↗ jump to hunk
Signed-off-by: Michael Walle <redacted>
---
changes since v1:
  - new patch

  drivers/nvmem/core.c           | 4 ++--
  drivers/nvmem/imx-ocotp.c      | 4 ++--
  include/linux/nvmem-provider.h | 5 +++--
  3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index d31d3f0ab517..6910796937f9 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -1523,8 +1523,8 @@ 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,
-					     cell->offset, buf, cell->bytes);
+		rc = cell->read_post_process(id, index, cell->offset, buf,
+					     cell->bytes);
  		if (rc)
  			return rc;
  	}
diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
index ac0edb6398f1..5e869d4a81c5 100644
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -222,8 +222,8 @@ static int imx_ocotp_read(void *context, unsigned int offset,
  	return ret;
  }
  
-static int imx_ocotp_cell_pp(void *context, const char *id, int index,
-			     unsigned int offset, void *data, size_t bytes)
+static int imx_ocotp_cell_pp(const char *id, int index, unsigned int offset,
+			     void *data, size_t bytes)
  {
  	u8 *buf = data;
  	int i;
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index 9d22dc5a3fa5..46067a6a0395 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -19,8 +19,9 @@ typedef int (*nvmem_reg_read_t)(void *priv, unsigned int offset,
  typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset,
  				 void *val, size_t bytes);
  /* used for vendor specific post processing of cell data */
-typedef int (*nvmem_cell_post_process_t)(void *priv, const char *id, int index,
-					 unsigned int offset, void *buf, size_t bytes);
+typedef int (*nvmem_cell_post_process_t)(const char *id, int index,
+					 unsigned int offset, void *buf,
+					 size_t bytes);
  
  enum nvmem_type {
  	NVMEM_TYPE_UNKNOWN = 0,
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help