diff mbox

[11/29] s390x/sclp: use QEMU_IS_ALIGNED macro

Message ID 20170718061005.29518-12-f4bug@amsat.org
State New
Headers show

Commit Message

Philippe Mathieu-Daudé July 18, 2017, 6:09 a.m. UTC
Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/s390x/sclp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Cornelia Huck July 18, 2017, 9:58 a.m. UTC | #1
On Tue, 18 Jul 2017 03:09:47 -0300
Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:

> Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/s390x/sclp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
> index 9253dbbc64..0a207c7345 100644
> --- a/hw/s390x/sclp.c
> +++ b/hw/s390x/sclp.c
> @@ -237,7 +237,7 @@ static void assign_storage(SCLPDevice *sclp, SCCB *sccb)
>      }
>      assign_addr = (assign_info->rn - 1) * mhd->rzm;
>  
> -    if ((assign_addr % MEM_SECTION_SIZE == 0) &&
> +    if (QEMU_IS_ALIGNED(assign_addr, MEM_SECTION_SIZE) &&
>          (assign_addr >= mhd->padded_ram_size)) {
>          /* Re-use existing memory region if found */
>          mr = memory_region_find(sysmem, assign_addr, 1).mr;
> @@ -297,7 +297,7 @@ static void unassign_storage(SCLPDevice *sclp, SCCB *sccb)
>      unassign_addr = (assign_info->rn - 1) * mhd->rzm;
>  
>      /* if the addr is a multiple of 256 MB */
> -    if ((unassign_addr % MEM_SECTION_SIZE == 0) &&
> +    if (QEMU_IS_ALIGNED(unassign_addr, MEM_SECTION_SIZE) &&
>          (unassign_addr >= mhd->padded_ram_size)) {
>          mhd->standby_state_map[(unassign_addr -
>                             mhd->padded_ram_size) / MEM_SECTION_SIZE] = 0;

Acked-by: Cornelia Huck <cohuck@redhat.com>
Cornelia Huck July 18, 2017, 10:03 a.m. UTC | #2
On Tue, 18 Jul 2017 11:58:40 +0200
Cornelia Huck <cohuck@redhat.com> wrote:

> On Tue, 18 Jul 2017 03:09:47 -0300
> Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> 
> > Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci
> > 
> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> > ---
> >  hw/s390x/sclp.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
> > index 9253dbbc64..0a207c7345 100644
> > --- a/hw/s390x/sclp.c
> > +++ b/hw/s390x/sclp.c
> > @@ -237,7 +237,7 @@ static void assign_storage(SCLPDevice *sclp, SCCB *sccb)
> >      }
> >      assign_addr = (assign_info->rn - 1) * mhd->rzm;
> >  
> > -    if ((assign_addr % MEM_SECTION_SIZE == 0) &&
> > +    if (QEMU_IS_ALIGNED(assign_addr, MEM_SECTION_SIZE) &&
> >          (assign_addr >= mhd->padded_ram_size)) {
> >          /* Re-use existing memory region if found */
> >          mr = memory_region_find(sysmem, assign_addr, 1).mr;
> > @@ -297,7 +297,7 @@ static void unassign_storage(SCLPDevice *sclp, SCCB *sccb)
> >      unassign_addr = (assign_info->rn - 1) * mhd->rzm;
> >  
> >      /* if the addr is a multiple of 256 MB */
> > -    if ((unassign_addr % MEM_SECTION_SIZE == 0) &&
> > +    if (QEMU_IS_ALIGNED(unassign_addr, MEM_SECTION_SIZE) &&
> >          (unassign_addr >= mhd->padded_ram_size)) {
> >          mhd->standby_state_map[(unassign_addr -
> >                             mhd->padded_ram_size) / MEM_SECTION_SIZE] = 0;  
> 
> Acked-by: Cornelia Huck <cohuck@redhat.com>

Oh, and I assume this will go through trivial, right?
diff mbox

Patch

diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index 9253dbbc64..0a207c7345 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -237,7 +237,7 @@  static void assign_storage(SCLPDevice *sclp, SCCB *sccb)
     }
     assign_addr = (assign_info->rn - 1) * mhd->rzm;
 
-    if ((assign_addr % MEM_SECTION_SIZE == 0) &&
+    if (QEMU_IS_ALIGNED(assign_addr, MEM_SECTION_SIZE) &&
         (assign_addr >= mhd->padded_ram_size)) {
         /* Re-use existing memory region if found */
         mr = memory_region_find(sysmem, assign_addr, 1).mr;
@@ -297,7 +297,7 @@  static void unassign_storage(SCLPDevice *sclp, SCCB *sccb)
     unassign_addr = (assign_info->rn - 1) * mhd->rzm;
 
     /* if the addr is a multiple of 256 MB */
-    if ((unassign_addr % MEM_SECTION_SIZE == 0) &&
+    if (QEMU_IS_ALIGNED(unassign_addr, MEM_SECTION_SIZE) &&
         (unassign_addr >= mhd->padded_ram_size)) {
         mhd->standby_state_map[(unassign_addr -
                            mhd->padded_ram_size) / MEM_SECTION_SIZE] = 0;