From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Arushi Singhal <arushisinghal19971997@gmail.com>
Cc: dwmw2@infradead.org,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Richard Weinberger <richard@nod.at>,
linux-kernel@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,
linux-mtd@lists.infradead.org,
Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
Brian Norris <computersforpeace@gmail.com>
Subject: Re: [PATCH] mtd: Use DIV_ROUND_UP()
Date: Thu, 29 Mar 2018 22:25:17 +0200 [thread overview]
Message-ID: <20180329222517.44e560d9@bbrezillon> (raw)
In-Reply-To: <20180325153743.GA16063@seema-Inspiron-15-3567>
On Sun, 25 Mar 2018 21:07:43 +0530
Arushi Singhal <arushisinghal19971997@gmail.com> wrote:
> 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>
Applied.
Thanks,
Boris
> ---
> drivers/mtd/ftl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
> index a048429..61d5cf8 100644
> --- a/drivers/mtd/ftl.c
> +++ b/drivers/mtd/ftl.c
> @@ -425,8 +425,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);
--
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
prev parent reply other threads:[~2018-03-29 20:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-25 15:37 [PATCH] mtd: Use DIV_ROUND_UP() Arushi Singhal
2018-03-29 20:25 ` Boris Brezillon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180329222517.44e560d9@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=arushisinghal19971997@gmail.com \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox