diff mbox

[PULL,50/52] pc-bios/s390-ccw: Use DIV_ROUND_UP

Message ID ac8eb9b954f267b8d9145cb8833a2f0b346f5913.1465112552.git.mjt@msgid.tls.msk.ru (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Tokarev June 5, 2016, 7:43 a.m. UTC
From: Laurent Vivier <lvivier@redhat.com>

Replace (((n) + (d) - 1) /(d)) by DIV_ROUND_UP(n,d).

This patch is the result of coccinelle script
scripts/coccinelle/round.cocci

CC: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 pc-bios/s390-ccw/bootmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Vivier June 6, 2016, 1:17 p.m. UTC | #1
On 05/06/2016 09:43, Michael Tokarev wrote:
> From: Laurent Vivier <lvivier@redhat.com>
> 
> Replace (((n) + (d) - 1) /(d)) by DIV_ROUND_UP(n,d).
> 
> This patch is the result of coccinelle script
> scripts/coccinelle/round.cocci
> 
> CC: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>  pc-bios/s390-ccw/bootmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
> index 611102e..ecdc52d 100644
> --- a/pc-bios/s390-ccw/bootmap.c
> +++ b/pc-bios/s390-ccw/bootmap.c
> @@ -599,7 +599,7 @@ static void load_iso_bc_entry(IsoBcSection *load)
>  
>      if (real_size) {
>          /* Round up blocks to load */
> -        blks_to_load = (real_size + ISO_SECTOR_SIZE - 1) / ISO_SECTOR_SIZE;
> +        blks_to_load = DIV_ROUND_UP(real_size, ISO_SECTOR_SIZE);
>          sclp_print("ISO boot image size verified\n");
>      } else {
>          sclp_print("ISO boot image size could not be verified\n");
> 

I think this one must be dropped from the pull request as s390-ccw files
have no access to the definition of DIV_ROUND_UP.

I missed that because it is not built by default and can only be built
on a s390 system (or with some tricks with a cross-compiler).

Thanks,
Laurent
Michael Tokarev June 7, 2016, 3:07 p.m. UTC | #2
06.06.2016 16:17, Laurent Vivier wrote:
> On 05/06/2016 09:43, Michael Tokarev wrote:
>> From: Laurent Vivier <lvivier@redhat.com>
>>
>> Replace (((n) + (d) - 1) /(d)) by DIV_ROUND_UP(n,d).
>>
>> This patch is the result of coccinelle script
>> scripts/coccinelle/round.cocci
>>
>> CC: Cornelia Huck <cornelia.huck@de.ibm.com>
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
>> ---
>>  pc-bios/s390-ccw/bootmap.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
>> index 611102e..ecdc52d 100644
>> --- a/pc-bios/s390-ccw/bootmap.c
>> +++ b/pc-bios/s390-ccw/bootmap.c
>> @@ -599,7 +599,7 @@ static void load_iso_bc_entry(IsoBcSection *load)
>>  
>>      if (real_size) {
>>          /* Round up blocks to load */
>> -        blks_to_load = (real_size + ISO_SECTOR_SIZE - 1) / ISO_SECTOR_SIZE;
>> +        blks_to_load = DIV_ROUND_UP(real_size, ISO_SECTOR_SIZE);
>>          sclp_print("ISO boot image size verified\n");
>>      } else {
>>          sclp_print("ISO boot image size could not be verified\n");
>>
> 
> I think this one must be dropped from the pull request as s390-ccw files
> have no access to the definition of DIV_ROUND_UP.

Dropped it now, thank you!

/mjt

> I missed that because it is not built by default and can only be built
> on a s390 system (or with some tricks with a cross-compiler).
> 
> Thanks,
> Laurent
>
diff mbox

Patch

diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
index 611102e..ecdc52d 100644
--- a/pc-bios/s390-ccw/bootmap.c
+++ b/pc-bios/s390-ccw/bootmap.c
@@ -599,7 +599,7 @@  static void load_iso_bc_entry(IsoBcSection *load)
 
     if (real_size) {
         /* Round up blocks to load */
-        blks_to_load = (real_size + ISO_SECTOR_SIZE - 1) / ISO_SECTOR_SIZE;
+        blks_to_load = DIV_ROUND_UP(real_size, ISO_SECTOR_SIZE);
         sclp_print("ISO boot image size verified\n");
     } else {
         sclp_print("ISO boot image size could not be verified\n");