From: Arnd Bergmann <arnd@arndb.de>
To: Yury Norov <ynorov@caviumnetworks.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Andrew Morton <akpm@linux-foundation.org>,
Clement Courbet <courbet@google.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] lib: use correct format string for find-bit tests
Date: Mon, 13 Nov 2017 14:55:45 +0100 [thread overview]
Message-ID: <20171113135605.3166307-1-arnd@arndb.de> (raw)
The cycles_t definition is architecture specific, which causes
a link error on all architectures that use a 'long long' or 'int'
type for it:
lib/test_find_bit.c: In function 'test_find_last_bit':
include/linux/kern_levels.h:5:18: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'cycles_t {aka long long unsigned int}' [-Werror=format=]
This adds an explicit cast to 'u64' for it, which lets us use
'%llu' everywhere.
Fixes: 09588b1f1d58 ("lib: test module for find_*_bit() functions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
lib/test_find_bit.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/test_find_bit.c b/lib/test_find_bit.c
index f3b4d34e11dd..f4394a36f9aa 100644
--- a/lib/test_find_bit.c
+++ b/lib/test_find_bit.c
@@ -51,7 +51,8 @@ static int __init test_find_first_bit(void *bitmap, unsigned long len)
__clear_bit(i, bitmap);
}
cycles = get_cycles() - cycles;
- pr_err("find_first_bit:\t\t%ld cycles,\t%ld iterations\n", cycles, cnt);
+ pr_err("find_first_bit:\t\t%llu cycles,\t%ld iterations\n",
+ (u64)cycles, cnt);
return 0;
}
@@ -65,7 +66,8 @@ static int __init test_find_next_bit(const void *bitmap, unsigned long len)
for (cnt = i = 0; i < BITMAP_LEN; cnt++)
i = find_next_bit(bitmap, BITMAP_LEN, i) + 1;
cycles = get_cycles() - cycles;
- pr_err("find_next_bit:\t\t%ld cycles,\t%ld iterations\n", cycles, cnt);
+ pr_err("find_next_bit:\t\t%llu cycles,\t%ld iterations\n",
+ (u64)cycles, cnt);
return 0;
}
@@ -79,8 +81,8 @@ static int __init test_find_next_zero_bit(const void *bitmap, unsigned long len)
for (cnt = i = 0; i < BITMAP_LEN; cnt++)
i = find_next_zero_bit(bitmap, len, i) + 1;
cycles = get_cycles() - cycles;
- pr_err("find_next_zero_bit:\t%ld cycles,\t%ld iterations\n",
- cycles, cnt);
+ pr_err("find_next_zero_bit:\t%llu cycles,\t%ld iterations\n",
+ (u64)cycles, cnt);
return 0;
}
@@ -99,7 +101,8 @@ static int __init test_find_last_bit(const void *bitmap, unsigned long len)
len = l;
} while (len);
cycles = get_cycles() - cycles;
- pr_err("find_last_bit:\t\t%ld cycles,\t%ld iterations\n", cycles, cnt);
+ pr_err("find_last_bit:\t\t%llu cycles,\t%ld iterations\n",
+ (u64)cycles, cnt);
return 0;
}
--
2.9.0
next reply other threads:[~2017-11-13 13:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-13 13:55 Arnd Bergmann [this message]
2017-11-14 9:45 ` [PATCH] lib: use correct format string for find-bit tests Yury Norov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171113135605.3166307-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=courbet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
--cc=ynorov@caviumnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).