Skip to contentSkip to conversation

nvmem: core: fix nvmem_cell_write inline function

PATCH In review Sebastian Reichel 4 participants 6 messages Sep 8, 2019 – Sep 17, 2019 NVMEM framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmem: core: fix nvmem_cell_write inline function

From: Sebastian Reichel <[email protected]>

nvmem_cell_write's buf argument uses different types based on the configuration of CONFIG_NVMEM. The function prototype for enabled NVMEM uses 'void *' type, but the static dummy function for disabled NVMEM uses 'const char *' instead. Fix the different behaviour by always expecting a 'void *' typed buf argument.

Fixes 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
Cc Han Nandor <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
---
 include/linux/nvmem-consumer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/nvmem-consumer.h +1 -1
index 8f8be5b00060..5c17cb733224 100644
@@ -118,7 +118,7 @@ static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
 }
 
 static inline int nvmem_cell_write(struct nvmem_cell *cell,
-				    const char *buf, size_t len)
+				   void *buf, size_t len)
 {
 	return -EOPNOTSUPP;
 }
Signature · 1 line
2.23.0.rc1
#1 lore raw
Quoted 23 lines · Sebastian Reichel

From: Sebastian Reichel <[email protected]>

nvmem_cell_write's buf argument uses different types based on the configuration of CONFIG_NVMEM. The function prototype for enabled NVMEM uses 'void *' type, but the static dummy function for disabled NVMEM uses 'const char *' instead. Fix the different behaviour by always expecting a 'void *' typed buf argument.

Fixes 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
Cc Han Nandor <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
---
  include/linux/nvmem-consumer.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/nvmem-consumer.h +0 -0
index 8f8be5b00060..5c17cb733224 100644

include/linux/nvmem-consumer.h static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) · line 121

Quoted 5 lines
include/linux/nvmem-consumer.h +1 -1
@@ -118,7 +118,7 @@ static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
  }
 
  static inline int nvmem_cell_write(struct nvmem_cell *cell,
-				    const char *buf, size_t len)
+				   void *buf, size_t len)

nitpick: alignment issue?

Nandor

#2 lore raw

Hi,

Quoted 19 lines · Nandor Han
Quoted 18 lines · Sebastian Reichel

From: Sebastian Reichel <[email protected]>

nvmem_cell_write's buf argument uses different types based on the configuration of CONFIG_NVMEM. The function prototype for enabled NVMEM uses 'void *' type, but the static dummy function for disabled NVMEM uses 'const char *' instead. Fix the different behaviour by always expecting a 'void *' typed buf argument.

Fixes 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
Cc Han Nandor <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
---
  include/linux/nvmem-consumer.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines

include/linux/nvmem-consumer.h static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) · line 120

Quoted 9 lines
include/linux/nvmem-consumer.h +1 -1
index 8f8be5b00060..5c17cb733224 100644
@@ -118,7 +118,7 @@ static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
  }
  static inline int nvmem_cell_write(struct nvmem_cell *cell,
-				    const char *buf, size_t len)
+				   void *buf, size_t len)

nitpick: alignment issue?

This actually fixes the alignment issue as a side-effect. I guess I should have mentioned it in the changelog.

Quoted 1 line

I suppose you meant to write "Reviewed-by" instead of inventing your own tag?

-- Sebastian

#3 lore raw
Quoted 34 lines · Sebastian Reichel

Hi,

Quoted 19 lines · Nandor Han
Quoted 18 lines · Sebastian Reichel

From: Sebastian Reichel <[email protected]>

nvmem_cell_write's buf argument uses different types based on the configuration of CONFIG_NVMEM. The function prototype for enabled NVMEM uses 'void *' type, but the static dummy function for disabled NVMEM uses 'const char *' instead. Fix the different behaviour by always expecting a 'void *' typed buf argument.

Fixes 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
Cc Han Nandor <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
---
   include/linux/nvmem-consumer.h | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines

include/linux/nvmem-consumer.h static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) · line 120

Quoted 9 lines
include/linux/nvmem-consumer.h +1 -1
index 8f8be5b00060..5c17cb733224 100644
@@ -118,7 +118,7 @@ static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
   }
   static inline int nvmem_cell_write(struct nvmem_cell *cell,
-				    const char *buf, size_t len)
+				   void *buf, size_t len)

nitpick: alignment issue?

Quoted 8 lines

This actually fixes the alignment issue as a side-effect. I guess I should have mentioned it in the changelog.

Quoted 1 line

I suppose you meant to write "Reviewed-by" instead of inventing your own tag?

Yes :)

Nandor

#4 lore raw
In reply to Sebastian Reichel
Quoted 9 lines · Sebastian Reichel

From: Sebastian Reichel <[email protected]>

nvmem_cell_write's buf argument uses different types based on the configuration of CONFIG_NVMEM. The function prototype for enabled NVMEM uses 'void *' type, but the static dummy function for disabled NVMEM uses 'const char *' instead. Fix the different behaviour by always expecting a 'void *' typed buf argument.

Quoted 6 lines
Fixes 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
Cc Han Nandor <[email protected]>
Cc Srinivas Kandagatla <[email protected]>

I still see the issue in linux-next, did this get dropped by accident?

Arnd

#5 lore raw
Quoted 10 lines · Arnd Bergmann
Quoted 9 lines · Sebastian Reichel

From: Sebastian Reichel <[email protected]>

nvmem_cell_write's buf argument uses different types based on the configuration of CONFIG_NVMEM. The function prototype for enabled NVMEM uses 'void *' type, but the static dummy function for disabled NVMEM uses 'const char *' instead. Fix the different behaviour by always expecting a 'void *' typed buf argument.

Quoted 9 lines
Quoted 6 lines
Fixes 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
Cc Han Nandor <[email protected]>
Cc Srinivas Kandagatla <[email protected]>

I still see the issue in linux-next, did this get dropped by accident?

I just pushed it to nvmem tree, should be fixed in next soon!

--srini

Quoted 2 lines

Arnd