diff mbox

[U-Boot,3/5,v5] include/linux: move typdef for uintptr_t

Message ID 1449563070-5761-3-git-send-email-aneesh.bansal@freescale.com
State Accepted
Delegated to: York Sun
Headers show

Commit Message

Aneesh Bansal Dec. 8, 2015, 8:24 a.m. UTC
uintptr_t which is a typdef for unsigned long is needed 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.

The typdef has been moved from include/compiler.h to include/linux/types.h

Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
---
Changes in v5:
New patch instead of http://patchwork.ozlabs.org/patch/546319/

Changes in v4: None

Changes in v3: None

Changes in v2: None

 include/compiler.h    | 3 ---
 include/linux/types.h | 1 +
 2 files changed, 1 insertion(+), 3 deletions(-)

Comments

York Sun Dec. 8, 2015, 4:45 p.m. UTC | #1
On 12/08/2015 12:24 AM, Aneesh Bansal wrote:
> uintptr_t which is a typdef for unsigned long is needed 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.
> 
> The typdef has been moved from include/compiler.h to include/linux/types.h
> 
> Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
> ---
> Changes in v5:
> New patch instead of http://patchwork.ozlabs.org/patch/546319/
> 
> Changes in v4: None
> 
> Changes in v3: None
> 
> Changes in v2: None
> 
>  include/compiler.h    | 3 ---
>  include/linux/types.h | 1 +
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/compiler.h b/include/compiler.h
> index 47c296e..f853ed4 100644
> --- a/include/compiler.h
> +++ b/include/compiler.h
> @@ -115,9 +115,6 @@ typedef unsigned int uint;
>  #ifdef CONFIG_USE_STDINT
>  /* Provided by gcc. */
>  #include <stdint.h>
> -#else
> -/* Type for `void *' pointers. */
> -typedef unsigned long int uintptr_t;
>  #endif
>  
>  #include <linux/string.h>
> diff --git a/include/linux/types.h b/include/linux/types.h
> index 6f75be4..c7e8fdb 100644
> --- a/include/linux/types.h
> +++ b/include/linux/types.h
> @@ -124,6 +124,7 @@ typedef		__UINT64_TYPE__	u_int64_t;
>  typedef		__INT64_TYPE__		int64_t;
>  #endif
>  
> +typedef unsigned long uintptr_t;
>  /*
>   * Below are truly Linux-specific types that should never collide with
>   * any application/library that wants linux/types.h.
> 

Tom,

Please help review this change. I can compile test for power and arm but I don't
have the setup for other platforms.

York
York Sun Dec. 14, 2015, 2:08 a.m. UTC | #2
I would like to merge this one if no objection.

York


On 12/08/2015 08:45 AM, York Sun wrote:
> 
> 
> On 12/08/2015 12:24 AM, Aneesh Bansal wrote:
>> uintptr_t which is a typdef for unsigned long is needed 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.
>>
>> The typdef has been moved from include/compiler.h to include/linux/types.h
>>
>> Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
>> ---
>> Changes in v5:
>> New patch instead of http://patchwork.ozlabs.org/patch/546319/
>>
>> Changes in v4: None
>>
>> Changes in v3: None
>>
>> Changes in v2: None
>>
>>  include/compiler.h    | 3 ---
>>  include/linux/types.h | 1 +
>>  2 files changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/include/compiler.h b/include/compiler.h
>> index 47c296e..f853ed4 100644
>> --- a/include/compiler.h
>> +++ b/include/compiler.h
>> @@ -115,9 +115,6 @@ typedef unsigned int uint;
>>  #ifdef CONFIG_USE_STDINT
>>  /* Provided by gcc. */
>>  #include <stdint.h>
>> -#else
>> -/* Type for `void *' pointers. */
>> -typedef unsigned long int uintptr_t;
>>  #endif
>>  
>>  #include <linux/string.h>
>> diff --git a/include/linux/types.h b/include/linux/types.h
>> index 6f75be4..c7e8fdb 100644
>> --- a/include/linux/types.h
>> +++ b/include/linux/types.h
>> @@ -124,6 +124,7 @@ typedef		__UINT64_TYPE__	u_int64_t;
>>  typedef		__INT64_TYPE__		int64_t;
>>  #endif
>>  
>> +typedef unsigned long uintptr_t;
>>  /*
>>   * Below are truly Linux-specific types that should never collide with
>>   * any application/library that wants linux/types.h.
>>
> 
> Tom,
> 
> Please help review this change. I can compile test for power and arm but I don't
> have the setup for other platforms.
> 
> York
>
York Sun Dec. 14, 2015, 2:10 a.m. UTC | #3
Resend with my freescale id.

I would like to merge this patch if no objection.

York


On 12/08/2015 08:45 AM, York Sun wrote:
> 
> 
> On 12/08/2015 12:24 AM, Aneesh Bansal wrote:
>> uintptr_t which is a typdef for unsigned long is needed 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.
>>
>> The typdef has been moved from include/compiler.h to include/linux/types.h
>>
>> Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
>> ---
>> Changes in v5:
>> New patch instead of http://patchwork.ozlabs.org/patch/546319/
>>
>> Changes in v4: None
>>
>> Changes in v3: None
>>
>> Changes in v2: None
>>
>>  include/compiler.h    | 3 ---
>>  include/linux/types.h | 1 +
>>  2 files changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/include/compiler.h b/include/compiler.h
>> index 47c296e..f853ed4 100644
>> --- a/include/compiler.h
>> +++ b/include/compiler.h
>> @@ -115,9 +115,6 @@ typedef unsigned int uint;
>>  #ifdef CONFIG_USE_STDINT
>>  /* Provided by gcc. */
>>  #include <stdint.h>
>> -#else
>> -/* Type for `void *' pointers. */
>> -typedef unsigned long int uintptr_t;
>>  #endif
>>  
>>  #include <linux/string.h>
>> diff --git a/include/linux/types.h b/include/linux/types.h
>> index 6f75be4..c7e8fdb 100644
>> --- a/include/linux/types.h
>> +++ b/include/linux/types.h
>> @@ -124,6 +124,7 @@ typedef		__UINT64_TYPE__	u_int64_t;
>>  typedef		__INT64_TYPE__		int64_t;
>>  #endif
>>  
>> +typedef unsigned long uintptr_t;
>>  /*
>>   * Below are truly Linux-specific types that should never collide with
>>   * any application/library that wants linux/types.h.
>>
> 
> Tom,
> 
> Please help review this change. I can compile test for power and arm but I don't
> have the setup for other platforms.
> 
> York
>
York Sun Dec. 15, 2015, 1:07 a.m. UTC | #4
On 12/08/2015 04:24 PM, Aneesh Bansal wrote:
> uintptr_t which is a typdef for unsigned long is needed 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.
> 
> The typdef has been moved from include/compiler.h to include/linux/types.h
> 
> Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
> ---
> Changes in v5:
> New patch instead of http://patchwork.ozlabs.org/patch/546319/
> 
> Changes in v4: None
> 
> Changes in v3: None
> 
> Changes in v2: None
> 

Applied to fsl-qoriq master. Awaiting upstream.

York
York Sun Dec. 16, 2015, 3:48 a.m. UTC | #5
On 12/08/2015 04:24 PM, Aneesh Bansal wrote:
> uintptr_t which is a typdef for unsigned long is needed 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.
> 
> The typdef has been moved from include/compiler.h to include/linux/types.h
> 
> Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
> ---
> Changes in v5:
> New patch instead of http://patchwork.ozlabs.org/patch/546319/
> 
> Changes in v4: None
> 
> Changes in v3: None
> 
> Changes in v2: None
> 
>  include/compiler.h    | 3 ---
>  include/linux/types.h | 1 +
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/compiler.h b/include/compiler.h
> index 47c296e..f853ed4 100644
> --- a/include/compiler.h
> +++ b/include/compiler.h
> @@ -115,9 +115,6 @@ typedef unsigned int uint;
>  #ifdef CONFIG_USE_STDINT
>  /* Provided by gcc. */
>  #include <stdint.h>
> -#else
> -/* Type for `void *' pointers. */
> -typedef unsigned long int uintptr_t;
>  #endif
>  
>  #include <linux/string.h>
> diff --git a/include/linux/types.h b/include/linux/types.h
> index 6f75be4..c7e8fdb 100644
> --- a/include/linux/types.h
> +++ b/include/linux/types.h
> @@ -124,6 +124,7 @@ typedef		__UINT64_TYPE__	u_int64_t;
>  typedef		__INT64_TYPE__		int64_t;
>  #endif
>  
> +typedef unsigned long uintptr_t;
>  /*
>   * Below are truly Linux-specific types that should never collide with
>   * any application/library that wants linux/types.h.
> 

Aneesh,

This change is tested OK on 64-bit hosts, but failed on 32-bit hosts.
A second thought, is this change needed? I reverted this one and still passed
tests for all aarch64 targets, including ls1043ardb_SECURE_BOOT. I didn't boot
it though.

York
diff mbox

Patch

diff --git a/include/compiler.h b/include/compiler.h
index 47c296e..f853ed4 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -115,9 +115,6 @@  typedef unsigned int uint;
 #ifdef CONFIG_USE_STDINT
 /* Provided by gcc. */
 #include <stdint.h>
-#else
-/* Type for `void *' pointers. */
-typedef unsigned long int uintptr_t;
 #endif
 
 #include <linux/string.h>
diff --git a/include/linux/types.h b/include/linux/types.h
index 6f75be4..c7e8fdb 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -124,6 +124,7 @@  typedef		__UINT64_TYPE__	u_int64_t;
 typedef		__INT64_TYPE__		int64_t;
 #endif
 
+typedef unsigned long uintptr_t;
 /*
  * Below are truly Linux-specific types that should never collide with
  * any application/library that wants linux/types.h.