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


Groups > linux.kernel > #1533359 > unrolled thread

Re: [PATCH] powerpc: cputime: fix a compile warning

Started byScott Wood <oss@buserror.net>
First post2016-11-30 15:50 +0100
Last post2016-12-01 06:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] powerpc: cputime: fix a compile warning Scott Wood <oss@buserror.net> - 2016-11-30 15:50 +0100
    Re: [PATCH] powerpc: cputime: fix a compile warning yjin <yanjiang.jin@windriver.com> - 2016-12-01 06:10 +0100

#1533359 — Re: [PATCH] powerpc: cputime: fix a compile warning

FromScott Wood <oss@buserror.net>
Date2016-11-30 15:50 +0100
SubjectRe: [PATCH] powerpc: cputime: fix a compile warning
Message-ID<sJemS-7mo-27@gated-at.bofh.it>
On Mon, 2016-11-21 at 12:56 +0800, yanjiang.jin@windriver.com wrote:
> From: Yanjiang Jin <yanjiang.jin@windriver.com>
> 
> This patch is to avoid the below warning:
> 
> kernel/sched/cpuacct.c:298:25: warning:
> format '%lld' expects argument of type 'long long int',
> but argument 4 has type 'long unsigned int' [-Wformat=]
> 
> Signed-off-by: Yanjiang Jin <yanjiang.jin@windriver.com>
> ---
>  arch/powerpc/include/asm/cputime.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/include/asm/cputime.h
> b/arch/powerpc/include/asm/cputime.h
> index 4f60db0..4423e97 100644
> --- a/arch/powerpc/include/asm/cputime.h
> +++ b/arch/powerpc/include/asm/cputime.h
> @@ -228,7 +228,8 @@ static inline cputime_t clock_t_to_cputime(const
> unsigned long clk)
>  	return (__force cputime_t) ct;
>  }
>  
> -#define cputime64_to_clock_t(ct)	cputime_to_clock_t((cputime_t)(ct))
> +#define cputime64_to_clock_t(ct)	\
> +	(__force u64)(cputime_to_clock_t((cputime_t)(ct)))

Why is __force needed?

-Scott

[toc] | [next] | [standalone]


#1533807

Fromyjin <yanjiang.jin@windriver.com>
Date2016-12-01 06:10 +0100
Message-ID<sJrN7-7LO-1@gated-at.bofh.it>
In reply to#1533359

[Multipart message — attachments visible in raw view] — view raw

Hi Scott,

Thanks for your reminder!
I rephrased it as below:

-#define cputime64_to_clock_t(ct) cputime_to_clock_t((cputime_t)(ct))
+#define cputime64_to_clock_t(ct)       \
+       (u64)(cputime_to_clock_t((cputime_t)(ct)))


and rebuilt the kernel, no warnings found.
New patch is attached, could you also help me to review it?

Regards!
Yanjiang

On 2016年11月30日 22:40, Scott Wood wrote:
> On Mon, 2016-11-21 at 12:56 +0800, yanjiang.jin@windriver.com wrote:
>> From: Yanjiang Jin <yanjiang.jin@windriver.com>
>>
>> This patch is to avoid the below warning:
>>
>> kernel/sched/cpuacct.c:298:25: warning:
>> format '%lld' expects argument of type 'long long int',
>> but argument 4 has type 'long unsigned int' [-Wformat=]
>>
>> Signed-off-by: Yanjiang Jin <yanjiang.jin@windriver.com>
>> ---
>>   arch/powerpc/include/asm/cputime.h | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/include/asm/cputime.h
>> b/arch/powerpc/include/asm/cputime.h
>> index 4f60db0..4423e97 100644
>> --- a/arch/powerpc/include/asm/cputime.h
>> +++ b/arch/powerpc/include/asm/cputime.h
>> @@ -228,7 +228,8 @@ static inline cputime_t clock_t_to_cputime(const
>> unsigned long clk)
>>   	return (__force cputime_t) ct;
>>   }
>>   
>> -#define cputime64_to_clock_t(ct)	cputime_to_clock_t((cputime_t)(ct))
>> +#define cputime64_to_clock_t(ct)	\
>> +	(__force u64)(cputime_to_clock_t((cputime_t)(ct)))
> Why is __force needed?
>
> -Scott
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web