]> git.baikalelectronics.ru Git - kernel.git/commit
null_blk: use sector_div instead of do_div
authorArnd Bergmann <arnd@arndb.de>
Wed, 13 Jan 2016 22:04:08 +0000 (23:04 +0100)
committerJens Axboe <axboe@fb.com>
Wed, 13 Jan 2016 22:10:34 +0000 (15:10 -0700)
commit476b12e6e7011b93e675086e76b03027ed9ab856
tree11f16543a9c469cf562bbd93fb7000c3fd548c93
parent07f15599e012c2c5a7a1875b7cde3314c239aaa7
null_blk: use sector_div instead of do_div

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. It is a simplified version
of the original patch, as Linus Torvalds pointed out that we should not be using
an expensive division function in the first place.

This version was suggested by Matias Bjorling.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Matias Bjorling <m@bjorling.me>
Fixes: f6f9505762b2 ("null_blk: register as a LightNVM device")
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/null_blk.c