public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: York Sun <yorksun@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/5] Data type defined for pointer addresses
Date: Mon, 7 Dec 2015 09:33:45 -0800	[thread overview]
Message-ID: <5665C2F9.7000507@freescale.com> (raw)
In-Reply-To: <1449508442.15946.60.camel@freescale.com>



On 12/07/2015 09:14 AM, Scott Wood wrote:
> On Mon, 2015-12-07 at 12:08 -0500, Tom Rini wrote:
>> On Mon, Dec 07, 2015 at 08:50:28AM -0800, York Sun wrote:
>>> 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 <aneesh.bansal@freescale.com>
>>>> ---
>>>>  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?
>>
>> Approach is OK.  But please do it as a "backport" of 142956af from the
>> linux kernel which adds 142956af to <linux/types.h> so everyone has it.
> 
> There's also an existing uintptr_t typedef in include/compiler.h...
> 

Tom,

We seem not having the abuse of ptrdiff_t. So the equivalent of Linux commit
142956af would be moving this typedef from include/compiler.h to
include/linux/types.h.

York

  reply	other threads:[~2015-12-07 17:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19  5:41 [U-Boot] [PATCH 1/5][v2] armv8: usec2ticks function defined Aneesh Bansal
2015-11-19  5:41 ` [U-Boot] [PATCH 2/5][v2] armv8: Make SEC read/write as snoopable for LS1043 Aneesh Bansal
2015-11-19  5:41 ` [U-Boot] [PATCH 3/5] Data type defined for pointer addresses Aneesh Bansal
2015-12-07 16:50   ` York Sun
2015-12-07 17:02     ` Bansal Aneesh
2015-12-07 17:08     ` Tom Rini
2015-12-07 17:14       ` Scott Wood
2015-12-07 17:33         ` York Sun [this message]
2015-12-07 17:50           ` Tom Rini
2015-12-07 20:31             ` York Sun
2015-11-19  5:41 ` [U-Boot] [PATCH 4/5][v2] armv8/ls1043ardb: SECURE BOOT target added for NOR Aneesh Bansal
2015-12-02 19:03   ` York Sun
2015-11-19  5:41 ` [U-Boot] [PATCH 5/5][v2] drivers/crypto/fsl: fix endianness issue in RNG Aneesh Bansal
2015-11-19 16:56 ` [U-Boot] [PATCH 1/5][v2] armv8: usec2ticks function defined York Sun
2015-11-23 18:50   ` Bansal Aneesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5665C2F9.7000507@freescale.com \
    --to=yorksun@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox