Re: [PATCH] fixup! commands: add new bthread test command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 16, 2021 at 09:20:34AM +0100, Ahmad Fatoum wrote:
> 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@xxxxxx>
> ---
>  commands/bthread.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Applied, thanks

Sascha

> 
> 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@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux