Skip to content

Commit 8324bb7

Browse files
johnpgarryaxboe
authored andcommitted
block: Fix blk_validate_atomic_write_limits() build for arm32
For arm32, we get the following build warning: In file included from /tmp/next/build/include/linux/printk.h:10, from /tmp/next/build/include/linux/kernel.h:31, from /tmp/next/build/block/blk-settings.c:5: /tmp/next/build/block/blk-settings.c: In function 'blk_validate_atomic_write_limits': /tmp/next/build/include/asm-generic/div64.h:222:35: warning: comparison of distinct pointer types lacks a cast 222 | (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ | ^~ The divident for do_div() should be 64b, which it is not. Since we want to check 2x unsigned ints, just use % operator. This allows us to drop the chunk_sectors variable. Fixes: 9da3d1e ("block: Add core atomic write support") Reported-by: Mark Brown <[email protected]> Closes: https://lore.kernel.org/linux-next/[email protected]/T/#mbf067b1edd89c7f9d7dac6e258c516199953a108 Signed-off-by: John Garry <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent caaf710 commit 8324bb7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

block/blk-settings.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ static void blk_atomic_writes_update_limits(struct queue_limits *lim)
175175

176176
static void blk_validate_atomic_write_limits(struct queue_limits *lim)
177177
{
178-
unsigned int chunk_sectors = lim->chunk_sectors;
179178
unsigned int boundary_sectors;
180179

181180
if (!lim->atomic_write_hw_max)
@@ -197,7 +196,7 @@ static void blk_validate_atomic_write_limits(struct queue_limits *lim)
197196
* Devices which do not conform to these rules can be dealt
198197
* with if and when they show up.
199198
*/
200-
if (WARN_ON_ONCE(do_div(chunk_sectors, boundary_sectors)))
199+
if (WARN_ON_ONCE(lim->chunk_sectors % boundary_sectors))
201200
goto unsupported;
202201

203202
/*

0 commit comments

Comments
 (0)