Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1604510 > unrolled thread

[PATCH] crypto: zip - add a cast for printing atomic64_t values

Started byArnd Bergmann <arnd@arndb.de>
First post2017-03-20 13:50 +0100
Last post2017-03-24 15:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] crypto: zip - add a cast for printing atomic64_t values Arnd Bergmann <arnd@arndb.de> - 2017-03-20 13:50 +0100
    Re: [PATCH] crypto: zip - add a cast for printing atomic64_t values Herbert Xu <herbert@gondor.apana.org.au> - 2017-03-24 15:20 +0100

#1604510 — [PATCH] crypto: zip - add a cast for printing atomic64_t values

FromArnd Bergmann <arnd@arndb.de>
Date2017-03-20 13:50 +0100
Subject[PATCH] crypto: zip - add a cast for printing atomic64_t values
Message-ID<tn4V4-4Nu-39@gated-at.bofh.it>
kernelci.org reports a build-time regression on linux-next, with a harmless
warning in x86 allmodconfig:

drivers/crypto/cavium/zip/zip_main.c:489:18: warning: format '%ld' expects argument of type 'long int', but argument 7 has type 'long long int' [-Wformat=]
drivers/crypto/cavium/zip/zip_main.c:489:18: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'long long int' [-Wformat=]
drivers/crypto/cavium/zip/zip_main.c:489:18: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'long long int' [-Wformat=]

The return type for atomic64_read() unfortunately differs between
architectures, with some defining it as atomic_long_read() and others
returning a 64-bit type explicitly. Fixing this in general would be nice,
but also require changing other users of these functions, so the simpler
workaround is to add a cast here that avoids the warnings on the default
build.

Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/crypto/cavium/zip/zip_main.c | 40 ++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
index 0951e20b395b..49f50c0e0308 100644
--- a/drivers/crypto/cavium/zip/zip_main.c
+++ b/drivers/crypto/cavium/zip/zip_main.c
@@ -488,32 +488,32 @@ static int zip_show_stats(struct seq_file *s, void *unused)
 				  atomic64_read(&st->comp_out_bytes));
 			seq_printf(s, "        ZIP Device %d Stats\n"
 				      "-----------------------------------\n"
-				      "Comp Req Submitted        : \t%ld\n"
-				      "Comp Req Completed        : \t%ld\n"
-				      "Compress In Bytes         : \t%ld\n"
-				      "Compressed Out Bytes      : \t%ld\n"
+				      "Comp Req Submitted        : \t%lld\n"
+				      "Comp Req Completed        : \t%lld\n"
+				      "Compress In Bytes         : \t%lld\n"
+				      "Compressed Out Bytes      : \t%lld\n"
 				      "Average Chunk size        : \t%llu\n"
 				      "Average Compression ratio : \t%llu\n"
-				      "Decomp Req Submitted      : \t%ld\n"
-				      "Decomp Req Completed      : \t%ld\n"
-				      "Decompress In Bytes       : \t%ld\n"
-				      "Decompressed Out Bytes    : \t%ld\n"
-				      "Decompress Bad requests   : \t%ld\n"
-				      "Pending Req               : \t%ld\n"
+				      "Decomp Req Submitted      : \t%lld\n"
+				      "Decomp Req Completed      : \t%lld\n"
+				      "Decompress In Bytes       : \t%lld\n"
+				      "Decompressed Out Bytes    : \t%lld\n"
+				      "Decompress Bad requests   : \t%lld\n"
+				      "Pending Req               : \t%lld\n"
 					"---------------------------------\n",
 				       index,
-				       atomic64_read(&st->comp_req_submit),
-				       atomic64_read(&st->comp_req_complete),
-				       atomic64_read(&st->comp_in_bytes),
-				       atomic64_read(&st->comp_out_bytes),
+				       (u64)atomic64_read(&st->comp_req_submit),
+				       (u64)atomic64_read(&st->comp_req_complete),
+				       (u64)atomic64_read(&st->comp_in_bytes),
+				       (u64)atomic64_read(&st->comp_out_bytes),
 				       avg_chunk,
 				       avg_cr,
-				       atomic64_read(&st->decomp_req_submit),
-				       atomic64_read(&st->decomp_req_complete),
-				       atomic64_read(&st->decomp_in_bytes),
-				       atomic64_read(&st->decomp_out_bytes),
-				       atomic64_read(&st->decomp_bad_reqs),
-				       atomic64_read(&st->pending_req));
+				       (u64)atomic64_read(&st->decomp_req_submit),
+				       (u64)atomic64_read(&st->decomp_req_complete),
+				       (u64)atomic64_read(&st->decomp_in_bytes),
+				       (u64)atomic64_read(&st->decomp_out_bytes),
+				       (u64)atomic64_read(&st->decomp_bad_reqs),
+				       (u64)atomic64_read(&st->pending_req));
 
 			/* Reset pending requests  count */
 			atomic64_set(&st->pending_req, 0);
-- 
2.9.0

[toc] | [next] | [standalone]


#1608435

FromHerbert Xu <herbert@gondor.apana.org.au>
Date2017-03-24 15:20 +0100
Message-ID<toyem-2LK-19@gated-at.bofh.it>
In reply to#1604510
On Mon, Mar 20, 2017 at 01:39:16PM +0100, Arnd Bergmann wrote:
> kernelci.org reports a build-time regression on linux-next, with a harmless
> warning in x86 allmodconfig:
> 
> drivers/crypto/cavium/zip/zip_main.c:489:18: warning: format '%ld' expects argument of type 'long int', but argument 7 has type 'long long int' [-Wformat=]
> drivers/crypto/cavium/zip/zip_main.c:489:18: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'long long int' [-Wformat=]
> drivers/crypto/cavium/zip/zip_main.c:489:18: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'long long int' [-Wformat=]
> 
> The return type for atomic64_read() unfortunately differs between
> architectures, with some defining it as atomic_long_read() and others
> returning a 64-bit type explicitly. Fixing this in general would be nice,
> but also require changing other users of these functions, so the simpler
> workaround is to add a cast here that avoids the warnings on the default
> build.
> 
> Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web