public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH] block: Fix blk_validate_atomic_write_limits() build for arm32
@ 2024-06-21 18:30 John Garry
  2024-06-21 18:32 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: John Garry @ 2024-06-21 18:30 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-next, broonie, John Garry

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: 9da3d1e912f3 ("block: Add core atomic write support")
Reported-by: Mark Brown <broonie@kernel•org>
Closes: https://lore.kernel.org/linux-next/b765d200-4e0f-48b1-a962-7dfa1c4aef9c@kernel.dk/T/#mbf067b1edd89c7f9d7dac6e258c516199953a108
Signed-off-by: John Garry <john.g.garry@oracle•com>

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 37fe4c8f6b6b..ec7dbe93d5c3 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -175,7 +175,6 @@ static void blk_atomic_writes_update_limits(struct queue_limits *lim)
 
 static void blk_validate_atomic_write_limits(struct queue_limits *lim)
 {
-	unsigned int chunk_sectors = lim->chunk_sectors;
 	unsigned int boundary_sectors;
 
 	if (!lim->atomic_write_hw_max)
@@ -197,7 +196,7 @@ static void blk_validate_atomic_write_limits(struct queue_limits *lim)
 		 * Devices which do not conform to these rules can be dealt
 		 * with if and when they show up.
 		 */
-		if (WARN_ON_ONCE(do_div(chunk_sectors, boundary_sectors)))
+		if (WARN_ON_ONCE(lim->chunk_sectors % boundary_sectors))
 			goto unsupported;
 
 		/*
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: Fix blk_validate_atomic_write_limits() build for arm32
  2024-06-21 18:30 [PATCH] block: Fix blk_validate_atomic_write_limits() build for arm32 John Garry
@ 2024-06-21 18:32 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2024-06-21 18:32 UTC (permalink / raw)
  To: John Garry; +Cc: linux-block, linux-next, broonie


On Fri, 21 Jun 2024 18:30:16 +0000, John Garry wrote:
> 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));  \
>        |                                   ^~
> 
> [...]

Applied, thanks!

[1/1] block: Fix blk_validate_atomic_write_limits() build for arm32
      commit: 8324bb755a80d463ff53379e5d64991656512069

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-21 18:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-21 18:30 [PATCH] block: Fix blk_validate_atomic_write_limits() build for arm32 John Garry
2024-06-21 18:32 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox