We already have DIV_ROUND_UP() to simplify code so add ROUND_UP() as
well. This makes code in flash_write_buf() easier to follow.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
};
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+#define ROUND_UP(x, y) (DIV_ROUND_UP(x, y) * (y))
#define min(x, y) ({ \
typeof(x) _min1 = (x); \
* to the start of the data, then count bytes of data, and
* to the end of the block
*/
- write_total = ((block_seek + count + blocklen - 1) /
- blocklen) * blocklen;
+ write_total = ROUND_UP(block_seek + count, blocklen);
}
/*