From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Burton Date: Tue, 17 May 2016 11:56:40 +0100 Subject: [U-Boot] [PATCH 2/4] MIPS: Fix _ACAST32_ for pointers on MIPS64 In-Reply-To: <1463482602-24982-1-git-send-email-paul.burton@imgtec.com> References: <1463482602-24982-1-git-send-email-paul.burton@imgtec.com> Message-ID: <1463482602-24982-3-git-send-email-paul.burton@imgtec.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de When building for MIPS64 and providing a pointer to _ACAST32_, optionally via CPHYSADDR or one of the CKSEGxADDR macros, the cast directly to a 32 bit int leads to compilation warnings such as the following: In file included from ./arch/mips/include/asm/io.h:17:0, from drivers/net/pcnet.c:14: drivers/net/pcnet.c: In function ?pcnet_virt_to_mem?: ./arch/mips/include/asm/addrspace.h:39:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] #define _ACAST32_ (_ATYPE_)(_ATYPE32_) /* widen if necessary */ ^ ./arch/mips/include/asm/addrspace.h:51:25: note: in expansion of macro ?_ACAST32_? #define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff) ^ ./arch/mips/include/asm/addrspace.h:71:25: note: in expansion of macro ?CPHYSADDR? #define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0) ^ drivers/net/pcnet.c:144:23: note: in expansion of macro ?CKSEG0ADDR? virt_addr = (void *)CKSEG0ADDR(addr); ^ Fix this by first casting provided values to a pointer-width integer, then truncating to a 32 bit int & widening back to pointer-width. Signed-off-by: Paul Burton --- arch/mips/include/asm/addrspace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h index 0994e96..fe497b5 100644 --- a/arch/mips/include/asm/addrspace.h +++ b/arch/mips/include/asm/addrspace.h @@ -36,8 +36,8 @@ #define _ACAST32_ #define _ACAST64_ #else -#define _ACAST32_ (_ATYPE_)(_ATYPE32_) /* widen if necessary */ -#define _ACAST64_ (_ATYPE64_) /* do _not_ narrow */ +#define _ACAST32_ (_ATYPE_)(_ATYPE32_)(_ATYPE_) /* widen if necessary */ +#define _ACAST64_ (_ATYPE64_) /* do _not_ narrow */ #endif /* -- 2.8.2