mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <ahmad@a3f.at>
Subject: [PATCH] fixup! commands: add new bthread test command
Date: Tue, 16 Mar 2021 09:20:34 +0100	[thread overview]
Message-ID: <20210316082034.1740511-1-ahmad@a3f.at> (raw)

GCC whines about casting int to pointer, which aren't always the same
size in barebox. Use long instead to avoid the warning.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 commands/bthread.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/commands/bthread.c b/commands/bthread.c
index 05dfa68cc597..964a1044c58b 100644
--- a/commands/bthread.c
+++ b/commands/bthread.c
@@ -66,15 +66,15 @@ static int bthread_isolated_time(void)
 static int bthread_printer(void *arg)
 {
 	volatile u64 start;
-	volatile int i = 0;
+	volatile unsigned long i = 0;
 	start = get_time_ns();
 
 	while (!bthread_should_stop()) {
 		if (!is_timeout_non_interruptible(start, 225 * MSECOND))
 			continue;
 
-		if ((long)arg == i++)
-			printf("%s yield #%d\n", bthread_name(current), i);
+		if ((unsigned long)arg == i++)
+			printf("%s yield #%lu\n", bthread_name(current), i);
 		start = get_time_ns();
 	}
 
@@ -87,14 +87,14 @@ static int bthread_spawner(void *arg)
 {
 	struct bthread *bthread[4];
 	volatile u64 start;
-	volatile int i = 0;
+	volatile unsigned long i = 0;
 	int ret = 0;
 	int ecode;
 
 	start = get_time_ns();
 
 	for (i = 0; i < ARRAY_SIZE(bthread); i++) {
-		bthread[i] = bthread_run(bthread_printer, (void *)i,
+		bthread[i] = bthread_run(bthread_printer, (void *)(long)i,
 					 "%s-bthread%u", bthread_name(current), i+1);
 		if (!bthread[i]) {
 			ret = -ENOMEM;
-- 
2.30.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


             reply	other threads:[~2021-03-16  8:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16  8:20 Ahmad Fatoum [this message]
2021-03-17  8:34 ` Sascha Hauer

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=20210316082034.1740511-1-ahmad@a3f.at \
    --to=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    /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