From mboxrd@z Thu Jan 1 00:00:00 1970 From: York Sun Date: Mon, 7 Dec 2015 08:50:28 -0800 Subject: [U-Boot] [PATCH 3/5] Data type defined for pointer addresses In-Reply-To: <1447911713-28639-3-git-send-email-aneesh.bansal@freescale.com> References: <1447911713-28639-1-git-send-email-aneesh.bansal@freescale.com> <1447911713-28639-3-git-send-email-aneesh.bansal@freescale.com> Message-ID: <5665B8D4.2070206@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Guys, Please comment on this new typedef. I am not comfortable to accept it. On 11/18/2015 09:41 PM, Aneesh Bansal wrote: > A new data type uintptr_t has been defined for creating > pointers (32 or 64 bit depending on Core) from 32 bit variables > storing the address. > If a 32 bit variable (u32) is typecasted to a pointer (void *), > compiler gives a warning in case size of pointer on the core is 64 bit. > > Signed-off-by: Aneesh Bansal > --- > arch/arm/include/asm/types.h | 2 ++ > arch/powerpc/include/asm/types.h | 1 + > 2 files changed, 3 insertions(+) > > diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h > index 388058e..5555765 100644 > --- a/arch/arm/include/asm/types.h > +++ b/arch/arm/include/asm/types.h > @@ -56,6 +56,8 @@ typedef unsigned long phys_addr_t; > typedef unsigned long phys_size_t; > #endif > > +typedef unsigned long uintptr_t; It is used in next patch of this series http://patchwork.ozlabs.org/patch/552669/, in two-step casting such as (u8 *)(uintptr_t)csf_hdr_addr As OP indicated, the variable is u32. Casting to a pointer causes compiling warning. Is this the right approach? York