From: Arnd Bergmann <arnd@arndb.de>
To: Jens Axboe <axboe@fb.com>
Cc: Matias Bjorling <m@bjorling.me>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH] null_blk: use sector_div instead of do_div
Date: Fri, 27 Nov 2015 14:49:49 +0100 [thread overview]
Message-ID: <3768541.ja0r6f0Odi@wuerfel> (raw)
Dividing a sector_t number should be done using sector_div rather
than do_div to optimize the 32-bit sector_t case, and with
the latest do_div optimizations, we now get a compile-time
warning for this:
arch/arm/include/asm/div64.h:32:95: note: expected 'uint64_t * {aka long long unsigned int *}' but argument is of type 'sector_t * {aka long unsigned int *}'
drivers/block/null_blk.c:521:81: warning: comparison of distinct pointer types lacks a cast
This changes the newly added code to use sector_div.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: b2b7e00148a2 ("null_blk: register as a LightNVM device")
---
Found on ARM randconfig builds with today's linux-next
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index 5c8ba5484d86..d0eeecd294de 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -510,17 +510,17 @@ static int null_lnvm_id(struct request_queue *q, struct nvm_id *id)
id->ppaf.ch_offset = 56;
id->ppaf.ch_len = 8;
- do_div(size, bs); /* convert size to pages */
- do_div(size, 256); /* concert size to pgs pr blk */
+ sector_div(size, bs); /* convert size to pages */
+ sector_div(size, 256); /* concert size to pgs pr blk */
grp = &id->groups[0];
grp->mtype = 0;
grp->fmtype = 0;
grp->num_ch = 1;
grp->num_pg = 256;
blksize = size;
- do_div(size, (1 << 16));
+ sector_div(size, (1 << 16));
grp->num_lun = size + 1;
- do_div(blksize, grp->num_lun);
+ sector_div(blksize, grp->num_lun);
grp->num_blk = blksize;
grp->num_pln = 1;
next reply other threads:[~2015-11-27 13:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 13:49 Arnd Bergmann [this message]
2015-11-27 18:07 ` [PATCH] null_blk: use sector_div instead of do_div Linus Torvalds
2015-11-27 21:31 ` Arnd Bergmann
2015-11-28 8:05 ` Matias Bjørling
2015-12-18 16:13 ` Arnd Bergmann
2016-01-13 21:46 ` Arnd Bergmann
2015-11-30 21:49 ` Jens Axboe
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=3768541.ja0r6f0Odi@wuerfel \
--to=arnd@arndb.de \
--cc=axboe@fb.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m@bjorling.me \
/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