qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/sh4/sh_pci.c: Use ldl_le_p() and stl_le_p()
@ 2016-06-10 16:10 Peter Maydell
  2016-06-11 20:41 ` Eric Blake
  2016-06-13  6:55 ` Aurelien Jarno
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Maydell @ 2016-06-10 16:10 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: patches, Aurelien Jarno

Use ldl_le_p() and stl_le_p() instead of le32_to_cpup() and
cpu_to_le32w(); the former handle misaligned addresses and don't
need casts, and the latter are deprecated.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/sh4/sh_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/sh4/sh_pci.c b/hw/sh4/sh_pci.c
index e820a32..1747628 100644
--- a/hw/sh4/sh_pci.c
+++ b/hw/sh4/sh_pci.c
@@ -55,7 +55,7 @@ static void sh_pci_reg_write (void *p, hwaddr addr, uint64_t val,
 
     switch(addr) {
     case 0 ... 0xfc:
-        cpu_to_le32w((uint32_t*)(pcic->dev->config + addr), val);
+        stl_le_p(pcic->dev->config + addr, val);
         break;
     case 0x1c0:
         pcic->par = val;
@@ -85,7 +85,7 @@ static uint64_t sh_pci_reg_read (void *p, hwaddr addr,
 
     switch(addr) {
     case 0 ... 0xfc:
-        return le32_to_cpup((uint32_t*)(pcic->dev->config + addr));
+        return ldl_le_p(pcic->dev->config + addr);
     case 0x1c0:
         return pcic->par;
     case 0x1c4:
-- 
1.9.1

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

* Re: [Qemu-devel] [PATCH] hw/sh4/sh_pci.c: Use ldl_le_p() and stl_le_p()
  2016-06-10 16:10 [Qemu-devel] [PATCH] hw/sh4/sh_pci.c: Use ldl_le_p() and stl_le_p() Peter Maydell
@ 2016-06-11 20:41 ` Eric Blake
  2016-06-13  6:55 ` Aurelien Jarno
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Blake @ 2016-06-11 20:41 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel, qemu-trivial; +Cc: Aurelien Jarno, patches

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

On 06/10/2016 10:10 AM, Peter Maydell wrote:
> Use ldl_le_p() and stl_le_p() instead of le32_to_cpup() and
> cpu_to_le32w(); the former handle misaligned addresses and don't
> need casts, and the latter are deprecated.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/sh4/sh_pci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

* Re: [Qemu-devel] [PATCH] hw/sh4/sh_pci.c: Use ldl_le_p() and stl_le_p()
  2016-06-10 16:10 [Qemu-devel] [PATCH] hw/sh4/sh_pci.c: Use ldl_le_p() and stl_le_p() Peter Maydell
  2016-06-11 20:41 ` Eric Blake
@ 2016-06-13  6:55 ` Aurelien Jarno
  2016-06-28 14:38   ` Peter Maydell
  1 sibling, 1 reply; 4+ messages in thread
From: Aurelien Jarno @ 2016-06-13  6:55 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, qemu-trivial, patches

On 2016-06-10 17:10, Peter Maydell wrote:
> Use ldl_le_p() and stl_le_p() instead of le32_to_cpup() and
> cpu_to_le32w(); the former handle misaligned addresses and don't
> need casts, and the latter are deprecated.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/sh4/sh_pci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/sh4/sh_pci.c b/hw/sh4/sh_pci.c
> index e820a32..1747628 100644
> --- a/hw/sh4/sh_pci.c
> +++ b/hw/sh4/sh_pci.c
> @@ -55,7 +55,7 @@ static void sh_pci_reg_write (void *p, hwaddr addr, uint64_t val,
>  
>      switch(addr) {
>      case 0 ... 0xfc:
> -        cpu_to_le32w((uint32_t*)(pcic->dev->config + addr), val);
> +        stl_le_p(pcic->dev->config + addr, val);
>          break;
>      case 0x1c0:
>          pcic->par = val;
> @@ -85,7 +85,7 @@ static uint64_t sh_pci_reg_read (void *p, hwaddr addr,
>  
>      switch(addr) {
>      case 0 ... 0xfc:
> -        return le32_to_cpup((uint32_t*)(pcic->dev->config + addr));
> +        return ldl_le_p(pcic->dev->config + addr);
>      case 0x1c0:
>          return pcic->par;
>      case 0x1c4:

Thanks for the patch. I confirm it builds and works fine.

Acked-by: Aurelien Jarno <aurelien@aurel32.net>

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

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

* Re: [Qemu-devel] [PATCH] hw/sh4/sh_pci.c: Use ldl_le_p() and stl_le_p()
  2016-06-13  6:55 ` Aurelien Jarno
@ 2016-06-28 14:38   ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2016-06-28 14:38 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: QEMU Developers, QEMU Trivial, Patch Tracking

On 13 June 2016 at 07:55, Aurelien Jarno <aurelien@aurel32.net> wrote:
> On 2016-06-10 17:10, Peter Maydell wrote:
>> Use ldl_le_p() and stl_le_p() instead of le32_to_cpup() and
>> cpu_to_le32w(); the former handle misaligned addresses and don't
>> need casts, and the latter are deprecated.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>>  hw/sh4/sh_pci.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/sh4/sh_pci.c b/hw/sh4/sh_pci.c
>> index e820a32..1747628 100644
>> --- a/hw/sh4/sh_pci.c
>> +++ b/hw/sh4/sh_pci.c
>> @@ -55,7 +55,7 @@ static void sh_pci_reg_write (void *p, hwaddr addr, uint64_t val,
>>
>>      switch(addr) {
>>      case 0 ... 0xfc:
>> -        cpu_to_le32w((uint32_t*)(pcic->dev->config + addr), val);
>> +        stl_le_p(pcic->dev->config + addr, val);
>>          break;
>>      case 0x1c0:
>>          pcic->par = val;
>> @@ -85,7 +85,7 @@ static uint64_t sh_pci_reg_read (void *p, hwaddr addr,
>>
>>      switch(addr) {
>>      case 0 ... 0xfc:
>> -        return le32_to_cpup((uint32_t*)(pcic->dev->config + addr));
>> +        return ldl_le_p(pcic->dev->config + addr);
>>      case 0x1c0:
>>          return pcic->par;
>>      case 0x1c4:
>
> Thanks for the patch. I confirm it builds and works fine.
>
> Acked-by: Aurelien Jarno <aurelien@aurel32.net>

Applied to master, thanks.

-- PMM

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

end of thread, other threads:[~2016-06-28 14:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-10 16:10 [Qemu-devel] [PATCH] hw/sh4/sh_pci.c: Use ldl_le_p() and stl_le_p() Peter Maydell
2016-06-11 20:41 ` Eric Blake
2016-06-13  6:55 ` Aurelien Jarno
2016-06-28 14:38   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).