mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Joe Lawrence <joe.lawrence@stratus.com>
Cc: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>,
	<DL-MPTFusionLinux@lsi.com>, <linux-scsi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers: message: fusion: Simplify rounding
Date: Wed, 06 Aug 2014 11:11:30 +0200	[thread overview]
Message-ID: <87y4v29e4d.fsf@rasmusvillemoes.dk> (raw)
In-Reply-To: <alpine.DEB.2.02.1407031300280.9641@jlaw-desktop.mno.stratus.com> (Joe Lawrence's message of "Thu, 3 Jul 2014 13:49:29 -0400")

Joe Lawrence <joe.lawrence@stratus.com> writes:

> On Tue, 1 Jul 2014, Rasmus Villemoes wrote:
>
>> Rounding up to a multiple of 4 should be done using the ALIGN
>> macro. As a bonus, this also makes the generated code smaller.
>> 
>> In GetIocFacts(), sz is assigned to a few lines below without being
>> read in the meantime, so it is ok that it doesn't end up with the same
>> value as facts->FWImageSize.
>> 
>> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>> ---
>>  drivers/message/fusion/mptbase.c | 7 +------
>>  drivers/message/fusion/mptctl.c  | 7 +------
>>  2 files changed, 2 insertions(+), 12 deletions(-)
>> 
>> diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
>> index ebc0af7..10b16a1 100644
>> --- a/drivers/message/fusion/mptbase.c
>> +++ b/drivers/message/fusion/mptbase.c
>> @@ -3175,12 +3175,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
>>  			facts->FWImageSize = le32_to_cpu(facts->FWImageSize);
>>  		}
>>  
>> -		sz = facts->FWImageSize;
>> -		if ( sz & 0x01 )
>> -			sz += 1;
>> -		if ( sz & 0x02 )
>> -			sz += 2;
>> -		facts->FWImageSize = sz;
>> +		facts->FWImageSize = ALIGN(facts->FWImageSize, 4);
>>  
>>  		if (!facts->RequestFrameSize) {
>>  			/*  Something is wrong!  */
>> diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
>> index 8a050e8..1004392 100644
>> --- a/drivers/message/fusion/mptctl.c
>> +++ b/drivers/message/fusion/mptctl.c
>> @@ -1749,12 +1749,7 @@ mptctl_replace_fw (unsigned long arg)
>>  
>>  	/* Allocate memory for the new FW image
>>  	 */
>> -	newFwSize = karg.newImageSize;
>> -
>> -	if (newFwSize & 0x01)
>> -		newFwSize += 1;
>> -	if (newFwSize & 0x02)
>> -		newFwSize += 2;
>> +	newFwSize = ALIGN(karg.newImageSize, 4);
>>  
>>  	mpt_alloc_fw_memory(ioc, newFwSize);
>>  	if (ioc->cached_fw == NULL)
>
> ALIGN is certainly more readable to me.
>
> Reviewed-by: Joe Lawrence <joe.lawrence@stratus.com>
>
> -- Joe

Did anyone pick this up?

Thanks,
Rasmus

  reply	other threads:[~2014-08-06  9:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-01 12:56 Rasmus Villemoes
2014-07-03 17:49 ` Joe Lawrence
2014-08-06  9:11   ` Rasmus Villemoes [this message]
2014-08-19 17:12 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y4v29e4d.fsf@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=DL-MPTFusionLinux@lsi.com \
    --cc=Sreekanth.Reddy@lsi.com \
    --cc=joe.lawrence@stratus.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®