[PATCH 10/17] MIPS: fix *ADDR macro usage warnings on CONFIG_64BIT
Denis Orlov
denorl2009 at gmail.com
Mon Jun 5 13:10:41 PDT 2023
Fixes "warning: cast from pointer to integer of different size"
messages.
Signed-off-by: Denis Orlov <denorl2009 at gmail.com>
---
arch/mips/include/asm/dma.h | 16 +++++++++-------
arch/mips/include/asm/io.h | 2 +-
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/arch/mips/include/asm/dma.h b/arch/mips/include/asm/dma.h
index 62d9c7c548..d7570cce71 100644
--- a/arch/mips/include/asm/dma.h
+++ b/arch/mips/include/asm/dma.h
@@ -25,18 +25,20 @@ static inline void *dma_alloc(size_t size)
#define dma_alloc_coherent dma_alloc_coherent
static inline void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle)
{
- void *ret;
+ void *ptr;
+ unsigned long virt;
- ret = xmemalign(PAGE_SIZE, size);
+ ptr = xmemalign(PAGE_SIZE, size);
+ memset(ptr, 0, size);
- memset(ret, 0, size);
+ virt = (unsigned long)ptr;
if (dma_handle)
- *dma_handle = CPHYSADDR(ret);
+ *dma_handle = CPHYSADDR(virt);
- dma_flush_range((unsigned long)ret, (unsigned long)(ret + size));
+ dma_flush_range(virt, virt + size);
- return (void *)CKSEG1ADDR(ret);
+ return (void *)CKSEG1ADDR(virt);
}
#define dma_free_coherent dma_free_coherent
@@ -44,7 +46,7 @@ static inline void dma_free_coherent(void *vaddr, dma_addr_t dma_handle,
size_t size)
{
if (IS_ENABLED(CONFIG_MMU) && vaddr)
- free((void *)CKSEG0ADDR(vaddr));
+ free((void *)CKSEG0ADDR((unsigned long)vaddr));
else
free(vaddr);
}
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index a3acbd7017..9c856c7b15 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -30,7 +30,7 @@ void dma_inv_range(unsigned long, unsigned long);
#define virt_to_phys virt_to_phys
static inline unsigned long virt_to_phys(const void *address)
{
- return (unsigned long)CPHYSADDR(address);
+ return CPHYSADDR((unsigned long)address);
}
/*
--
2.41.0
More information about the barebox
mailing list