提交 b756816d 编写于 作者: A Arushi Singhal 提交者: Boris Brezillon

mtd: ftl: Use DIV_ROUND_UP()

The kernel.h macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) / (d)) but is perhaps more readable.
Signed-off-by: NArushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com>
上级 c77a9312
...@@ -393,8 +393,8 @@ static int prepare_xfer(partition_t *part, int i) ...@@ -393,8 +393,8 @@ static int prepare_xfer(partition_t *part, int i)
} }
/* Write the BAM stub */ /* Write the BAM stub */
nbam = (part->BlocksPerUnit * sizeof(uint32_t) + nbam = DIV_ROUND_UP(part->BlocksPerUnit * sizeof(uint32_t) +
le32_to_cpu(part->header.BAMOffset) + SECTOR_SIZE - 1) / SECTOR_SIZE; le32_to_cpu(part->header.BAMOffset), SECTOR_SIZE);
offset = xfer->Offset + le32_to_cpu(part->header.BAMOffset); offset = xfer->Offset + le32_to_cpu(part->header.BAMOffset);
ctl = cpu_to_le32(BLOCK_CONTROL); ctl = cpu_to_le32(BLOCK_CONTROL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册