All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] spl: Fix compilation warnings for arm64
@ 2016-07-15  6:48 Michal Simek
  2016-07-17 14:12 ` Simon Glass
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Simek @ 2016-07-15  6:48 UTC (permalink / raw)
  To: u-boot

Make code 64bit aware.

Warnings:
+../arch/arm/lib/spl.c: In function ?jump_to_image_linux?:
+../arch/arm/lib/spl.c:63:3: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
+../common/spl/spl_fat.c: In function ?spl_load_image_fat?:
+../common/spl/spl_fat.c:91:33: warning: cast to pointer from integer
of different size [-Wint-to-pointer-cast]

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 arch/arm/lib/spl.c   | 2 +-
 common/spl/spl_fat.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c
index e42886840ed6..c1b85340fad6 100644
--- a/arch/arm/lib/spl.c
+++ b/arch/arm/lib/spl.c
@@ -60,7 +60,7 @@ void __noreturn jump_to_image_linux(void *arg)
 	typedef void (*image_entry_arg_t)(int, int, void *)
 		__attribute__ ((noreturn));
 	image_entry_arg_t image_entry =
-		(image_entry_arg_t) spl_image.entry_point;
+		(image_entry_arg_t)(uintptr_t) spl_image.entry_point;
 	cleanup_before_linux();
 	image_entry(0, machid, arg);
 }
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index db676186d354..73d33f54fc13 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -88,7 +88,8 @@ int spl_load_image_fat(struct blk_desc *block_dev,
 		if (err)
 			goto end;
 
-		err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0);
+		err = file_fat_read(filename,
+				    (u8 *)(uintptr_t)spl_image.load_addr, 0);
 	}
 
 end:
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] spl: Fix compilation warnings for arm64
  2016-07-15  6:48 [U-Boot] [PATCH] spl: Fix compilation warnings for arm64 Michal Simek
@ 2016-07-17 14:12 ` Simon Glass
  2016-07-18  7:07   ` Michal Simek
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Glass @ 2016-07-17 14:12 UTC (permalink / raw)
  To: u-boot

Hi Michal,

On 15 July 2016 at 00:48, Michal Simek <michal.simek@xilinx.com> wrote:
> Make code 64bit aware.
>
> Warnings:
> +../arch/arm/lib/spl.c: In function ?jump_to_image_linux?:
> +../arch/arm/lib/spl.c:63:3: warning: cast to pointer from integer of
> different size [-Wint-to-pointer-cast]
> +../common/spl/spl_fat.c: In function ?spl_load_image_fat?:
> +../common/spl/spl_fat.c:91:33: warning: cast to pointer from integer
> of different size [-Wint-to-pointer-cast]
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  arch/arm/lib/spl.c   | 2 +-
>  common/spl/spl_fat.c | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

You could use map_sysmem() / unmap_sysmem() to convert a ulong address
into a pointer.

>
> diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c
> index e42886840ed6..c1b85340fad6 100644
> --- a/arch/arm/lib/spl.c
> +++ b/arch/arm/lib/spl.c
> @@ -60,7 +60,7 @@ void __noreturn jump_to_image_linux(void *arg)
>         typedef void (*image_entry_arg_t)(int, int, void *)
>                 __attribute__ ((noreturn));
>         image_entry_arg_t image_entry =
> -               (image_entry_arg_t) spl_image.entry_point;
> +               (image_entry_arg_t)(uintptr_t) spl_image.entry_point;
>         cleanup_before_linux();
>         image_entry(0, machid, arg);
>  }
> diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
> index db676186d354..73d33f54fc13 100644
> --- a/common/spl/spl_fat.c
> +++ b/common/spl/spl_fat.c
> @@ -88,7 +88,8 @@ int spl_load_image_fat(struct blk_desc *block_dev,
>                 if (err)
>                         goto end;
>
> -               err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0);
> +               err = file_fat_read(filename,
> +                                   (u8 *)(uintptr_t)spl_image.load_addr, 0);
>         }
>
>  end:
> --
> 1.9.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] spl: Fix compilation warnings for arm64
  2016-07-17 14:12 ` Simon Glass
@ 2016-07-18  7:07   ` Michal Simek
  2016-07-22  3:21     ` Simon Glass
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Simek @ 2016-07-18  7:07 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On 17.7.2016 16:12, Simon Glass wrote:
> Hi Michal,
> 
> On 15 July 2016 at 00:48, Michal Simek <michal.simek@xilinx.com> wrote:
>> Make code 64bit aware.
>>
>> Warnings:
>> +../arch/arm/lib/spl.c: In function ?jump_to_image_linux?:
>> +../arch/arm/lib/spl.c:63:3: warning: cast to pointer from integer of
>> different size [-Wint-to-pointer-cast]
>> +../common/spl/spl_fat.c: In function ?spl_load_image_fat?:
>> +../common/spl/spl_fat.c:91:33: warning: cast to pointer from integer
>> of different size [-Wint-to-pointer-cast]
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>>  arch/arm/lib/spl.c   | 2 +-
>>  common/spl/spl_fat.c | 3 ++-
>>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> You could use map_sysmem() / unmap_sysmem() to convert a ulong address
> into a pointer.

Isn't this used more for remapping with non zero length?
I see in the code that people are using it just for conversion but the
question is if this is right usage.

Thanks,
Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] spl: Fix compilation warnings for arm64
  2016-07-18  7:07   ` Michal Simek
@ 2016-07-22  3:21     ` Simon Glass
  2016-07-22  7:23       ` Michal Simek
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Glass @ 2016-07-22  3:21 UTC (permalink / raw)
  To: u-boot

Hi Michael,

On 18 July 2016 at 01:07, Michal Simek <michal.simek@xilinx.com> wrote:
> Hi Simon,
>
> On 17.7.2016 16:12, Simon Glass wrote:
>> Hi Michal,
>>
>> On 15 July 2016 at 00:48, Michal Simek <michal.simek@xilinx.com> wrote:
>>> Make code 64bit aware.
>>>
>>> Warnings:
>>> +../arch/arm/lib/spl.c: In function ?jump_to_image_linux?:
>>> +../arch/arm/lib/spl.c:63:3: warning: cast to pointer from integer of
>>> different size [-Wint-to-pointer-cast]
>>> +../common/spl/spl_fat.c: In function ?spl_load_image_fat?:
>>> +../common/spl/spl_fat.c:91:33: warning: cast to pointer from integer
>>> of different size [-Wint-to-pointer-cast]
>>>
>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>> ---
>>>
>>>  arch/arm/lib/spl.c   | 2 +-
>>>  common/spl/spl_fat.c | 3 ++-
>>>  2 files changed, 3 insertions(+), 2 deletions(-)
>>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> You could use map_sysmem() / unmap_sysmem() to convert a ulong address
>> into a pointer.
>
> Isn't this used more for remapping with non zero length?
> I see in the code that people are using it just for conversion but the
> question is if this is right usage.

You are supposed to unmap afterwards. Is that not possible?

Regards,
Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] spl: Fix compilation warnings for arm64
  2016-07-22  3:21     ` Simon Glass
@ 2016-07-22  7:23       ` Michal Simek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2016-07-22  7:23 UTC (permalink / raw)
  To: u-boot

On 22.7.2016 05:21, Simon Glass wrote:
> Hi Michael,
> 
> On 18 July 2016 at 01:07, Michal Simek <michal.simek@xilinx.com> wrote:
>> Hi Simon,
>>
>> On 17.7.2016 16:12, Simon Glass wrote:
>>> Hi Michal,
>>>
>>> On 15 July 2016 at 00:48, Michal Simek <michal.simek@xilinx.com> wrote:
>>>> Make code 64bit aware.
>>>>
>>>> Warnings:
>>>> +../arch/arm/lib/spl.c: In function ?jump_to_image_linux?:
>>>> +../arch/arm/lib/spl.c:63:3: warning: cast to pointer from integer of
>>>> different size [-Wint-to-pointer-cast]
>>>> +../common/spl/spl_fat.c: In function ?spl_load_image_fat?:
>>>> +../common/spl/spl_fat.c:91:33: warning: cast to pointer from integer
>>>> of different size [-Wint-to-pointer-cast]
>>>>
>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>> ---
>>>>
>>>>  arch/arm/lib/spl.c   | 2 +-
>>>>  common/spl/spl_fat.c | 3 ++-
>>>>  2 files changed, 3 insertions(+), 2 deletions(-)
>>>
>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>
>>> You could use map_sysmem() / unmap_sysmem() to convert a ulong address
>>> into a pointer.
>>
>> Isn't this used more for remapping with non zero length?
>> I see in the code that people are using it just for conversion but the
>> question is if this is right usage.
> 
> You are supposed to unmap afterwards. Is that not possible?

The first one is __noreturn function. It means I can't see a way where
to call unmap.

The second one is different. You want to only map that image and
probably at the end you will jump to it. For error case I see that unmap
should be called.
I will use the first version and moving to map_sysmem can be done later.

Thanks,
Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-22  7:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-15  6:48 [U-Boot] [PATCH] spl: Fix compilation warnings for arm64 Michal Simek
2016-07-17 14:12 ` Simon Glass
2016-07-18  7:07   ` Michal Simek
2016-07-22  3:21     ` Simon Glass
2016-07-22  7:23       ` Michal Simek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.