提交 f6e495a2 编写于 作者: R Rasmus Villemoes 提交者: Christoph Hellwig

mptfusion: simplify rounding

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: NRasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: NJoe Lawrence <joe.lawrence@stratus.com>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
上级 84e32a06
...@@ -3172,12 +3172,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason) ...@@ -3172,12 +3172,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
facts->FWImageSize = le32_to_cpu(facts->FWImageSize); facts->FWImageSize = le32_to_cpu(facts->FWImageSize);
} }
sz = facts->FWImageSize; facts->FWImageSize = ALIGN(facts->FWImageSize, 4);
if ( sz & 0x01 )
sz += 1;
if ( sz & 0x02 )
sz += 2;
facts->FWImageSize = sz;
if (!facts->RequestFrameSize) { if (!facts->RequestFrameSize) {
/* Something is wrong! */ /* Something is wrong! */
......
...@@ -1741,12 +1741,7 @@ mptctl_replace_fw (unsigned long arg) ...@@ -1741,12 +1741,7 @@ mptctl_replace_fw (unsigned long arg)
/* Allocate memory for the new FW image /* Allocate memory for the new FW image
*/ */
newFwSize = karg.newImageSize; newFwSize = ALIGN(karg.newImageSize, 4);
if (newFwSize & 0x01)
newFwSize += 1;
if (newFwSize & 0x02)
newFwSize += 2;
mpt_alloc_fw_memory(ioc, newFwSize); mpt_alloc_fw_memory(ioc, newFwSize);
if (ioc->cached_fw == NULL) if (ioc->cached_fw == NULL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册