diff mbox series

[U-Boot,2/5] sandbox: Drop 'const' from sandbox_write()

Message ID 20191011221650.19482-3-sjg@chromium.org
State Accepted
Commit 8417385dc911f9ad049ae610b4e23557e890b353
Delegated to: Simon Glass
Headers show
Series dm: regmap: Various fixes for regmap | expand

Commit Message

Simon Glass Oct. 11, 2019, 10:16 p.m. UTC
This function writes to its address so the address should not be declared
as const. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/sandbox/cpu/cpu.c        |  3 +--
 arch/sandbox/include/asm/io.h | 11 +++++------
 2 files changed, 6 insertions(+), 8 deletions(-)

Comments

Bin Meng Oct. 12, 2019, 2:12 a.m. UTC | #1
Hi Simon,

On Sat, Oct 12, 2019 at 6:22 AM Simon Glass <sjg@chromium.org> wrote:
>
> This function writes to its address so the address should not be declared
> as const. Fix it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/sandbox/cpu/cpu.c        |  3 +--
>  arch/sandbox/include/asm/io.h | 11 +++++------
>  2 files changed, 6 insertions(+), 8 deletions(-)
>

It looks I did something wrong when testing the previous patch :) I
remember adding const was to fix build warning somewhere else.

Anyway the changes look good to me. But I suspect we need give it a
full build to see whether it generates warning somewhere.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass Oct. 29, 2019, 11:21 p.m. UTC | #2
Hi Simon,

On Sat, Oct 12, 2019 at 6:22 AM Simon Glass <sjg@chromium.org> wrote:
>
> This function writes to its address so the address should not be declared
> as const. Fix it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/sandbox/cpu/cpu.c        |  3 +--
>  arch/sandbox/include/asm/io.h | 11 +++++------
>  2 files changed, 6 insertions(+), 8 deletions(-)
>

It looks I did something wrong when testing the previous patch :) I
remember adding const was to fix build warning somewhere else.

Anyway the changes look good to me. But I suspect we need give it a
full build to see whether it generates warning somewhere.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index 2046cb53c4a..f3af88d79e9 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -246,8 +246,7 @@  unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size)
 	return 0;
 }
 
-void sandbox_write(const void *addr, unsigned int val,
-		   enum sandboxio_size_t size)
+void sandbox_write(void *addr, unsigned int val, enum sandboxio_size_t size)
 {
 	struct sandbox_state *state = state_get_current();
 
diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index 4a35c419723..ad6c29a4e26 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -46,8 +46,7 @@  static inline void unmap_sysmem(const void *vaddr)
 phys_addr_t map_to_sysmem(const void *ptr);
 
 unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size);
-void sandbox_write(const void *addr, unsigned int val,
-		   enum sandboxio_size_t size);
+void sandbox_write(void *addr, unsigned int val, enum sandboxio_size_t size);
 
 #define readb(addr) sandbox_read((const void *)addr, SB_SIZE_8)
 #define readw(addr) sandbox_read((const void *)addr, SB_SIZE_16)
@@ -55,11 +54,11 @@  void sandbox_write(const void *addr, unsigned int val,
 #ifdef CONFIG_SANDBOX64
 #define readq(addr) sandbox_read((const void *)addr, SB_SIZE_64)
 #endif
-#define writeb(v, addr) sandbox_write((const void *)addr, v, SB_SIZE_8)
-#define writew(v, addr) sandbox_write((const void *)addr, v, SB_SIZE_16)
-#define writel(v, addr) sandbox_write((const void *)addr, v, SB_SIZE_32)
+#define writeb(v, addr) sandbox_write((void *)addr, v, SB_SIZE_8)
+#define writew(v, addr) sandbox_write((void *)addr, v, SB_SIZE_16)
+#define writel(v, addr) sandbox_write((void *)addr, v, SB_SIZE_32)
 #ifdef CONFIG_SANDBOX64
-#define writeq(v, addr) sandbox_write((const void *)addr, v, SB_SIZE_64)
+#define writeq(v, addr) sandbox_write((void *)addr, v, SB_SIZE_64)
 #endif
 
 /*