summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ftl.c
diff options
context:
space:
mode:
authorArushi Singhal2018-03-25 17:37:43 +0200
committerBoris Brezillon2018-03-29 09:36:01 +0200
commitb756816dad0aaca4f57c857a86a6a4a85a9f478b (patch)
tree24e5318b3e6675915b930d114b21365dd81524ab /drivers/mtd/ftl.c
parentmtd: Fix some function description mismatches in mtdcore.c (diff)
downloadkernel-qcow2-linux-b756816dad0aaca4f57c857a86a6a4a85a9f478b.tar.gz
kernel-qcow2-linux-b756816dad0aaca4f57c857a86a6a4a85a9f478b.tar.xz
kernel-qcow2-linux-b756816dad0aaca4f57c857a86a6a4a85a9f478b.zip
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: Arushi Singhal <arushisinghal19971997@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'drivers/mtd/ftl.c')
-rw-r--r--drivers/mtd/ftl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index 0a6adfaec7b5..ef6ad2551d57 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -393,8 +393,8 @@ static int prepare_xfer(partition_t *part, int i)
}
/* Write the BAM stub */
- nbam = (part->BlocksPerUnit * sizeof(uint32_t) +
- le32_to_cpu(part->header.BAMOffset) + SECTOR_SIZE - 1) / SECTOR_SIZE;
+ nbam = DIV_ROUND_UP(part->BlocksPerUnit * sizeof(uint32_t) +
+ le32_to_cpu(part->header.BAMOffset), SECTOR_SIZE);
offset = xfer->Offset + le32_to_cpu(part->header.BAMOffset);
ctl = cpu_to_le32(BLOCK_CONTROL);