]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mptfusion: simplify rounding
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Tue, 1 Jul 2014 12:56:20 +0000 (14:56 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 16 Sep 2014 16:09:43 +0000 (09:09 -0700)
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>
Reviewed-by: Joe Lawrence <joe.lawrence@stratus.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/message/fusion/mptbase.c
drivers/message/fusion/mptctl.c

index a896d948b79ee12b36f82c3d04c6c3ec34d9d1b0..68f57d3bcca1fc665cce2140a51ea5de81fa3874 100644 (file)
@@ -3172,12 +3172,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!  */
index b0a892a2bf1b535ac4b155c92dbca0bacaad990a..70bb7530b22ccb5ccc66e6abd7559e3f6f47944a 100644 (file)
@@ -1741,12 +1741,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)