public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zram: Use atomic_long_read() to read atomic_long_t
@ 2023-02-25 12:15 Geert Uytterhoeven
  2023-02-26  3:38 ` Sergey Senozhatsky
  2023-02-26  4:30 ` Andrew Morton
  0 siblings, 2 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2023-02-25 12:15 UTC (permalink / raw)
  To: Minchan Kim, Sergey Senozhatsky, Jens Axboe, Andrew Morton
  Cc: linux-block, linux-kernel

On 32-bit:

    drivers/block/zram/zram_drv.c: In function ‘mm_stat_show’:
    drivers/block/zram/zram_drv.c:1234:23: error: passing argument 1 of ‘atomic64_read’ from incompatible pointer type [-Werror=incompatible-pointer-types]
     1234 |    (u64)atomic64_read(&pool_stats.objs_moved));
	  |                       ^~~~~~~~~~~~~~~~~~~~~~
	  |                       |
	  |                       atomic_long_t * {aka struct <anonymous> *}
    In file included from ./include/linux/atomic.h:82,
		     from ./include/linux/mm_types_task.h:13,
		     from ./include/linux/mm_types.h:5,
		     from ./include/linux/buildid.h:5,
		     from ./include/linux/module.h:14,
		     from drivers/block/zram/zram_drv.c:18:
    ./include/linux/atomic/atomic-instrumented.h:644:33: note: expected ‘const atomic64_t *’ {aka ‘const struct <anonymous> *’} but argument is of type ‘atomic_long_t *’ {aka ‘struct <anonymous> *’}
      644 | atomic64_read(const atomic64_t *v)
	  |               ~~~~~~~~~~~~~~~~~~^

Fix this by using atomic_long_read() instead.

Reported-by; noreply@ellerman.id.au
Fixes: b7d89654a988a2a4 ("zram: show zsmalloc objs_moved stat in mm_stat")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/block/zram/zram_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 3194e9254c6f3a04..8fff358c9cbace17 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1221,7 +1221,7 @@ static ssize_t mm_stat_show(struct device *dev,
 	max_used = atomic_long_read(&zram->stats.max_used_pages);
 
 	ret = scnprintf(buf, PAGE_SIZE,
-			"%8llu %8llu %8llu %8lu %8ld %8llu %8lu %8llu %8llu %8llu\n",
+			"%8llu %8llu %8llu %8lu %8ld %8llu %8lu %8llu %8llu %8lu\n",
 			orig_size << PAGE_SHIFT,
 			(u64)atomic64_read(&zram->stats.compr_data_size),
 			mem_used << PAGE_SHIFT,
@@ -1231,7 +1231,7 @@ static ssize_t mm_stat_show(struct device *dev,
 			atomic_long_read(&pool_stats.pages_compacted),
 			(u64)atomic64_read(&zram->stats.huge_pages),
 			(u64)atomic64_read(&zram->stats.huge_pages_since),
-			(u64)atomic64_read(&pool_stats.objs_moved));
+			atomic_long_read(&pool_stats.objs_moved));
 	up_read(&zram->init_lock);
 
 	return ret;
-- 
2.34.1


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

end of thread, other threads:[~2023-02-26  9:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-25 12:15 [PATCH] zram: Use atomic_long_read() to read atomic_long_t Geert Uytterhoeven
2023-02-26  3:38 ` Sergey Senozhatsky
2023-02-26  4:30 ` Andrew Morton
2023-02-26  4:57   ` Andrew Morton
2023-02-26  9:45     ` Geert Uytterhoeven

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