mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fixup! commands: add new bthread test command
@ 2021-03-16  8:20 Ahmad Fatoum
  2021-03-17  8:34 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-03-16  8:20 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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


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

end of thread, other threads:[~2021-03-17  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16  8:20 [PATCH] fixup! commands: add new bthread test command Ahmad Fatoum
2021-03-17  8:34 ` Sascha Hauer

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