Skip to contentSkip to conversation

cputime: fix compiler warning caused by timeval_to_cputime()

PATCH In review Li Zhong 2 participants 2 messages Feb 17, 2013 – Feb 18, 2013

Subsystems (2)
lore
Share & tools
lore

Li Zhong

author
#0 lore raw

PATCH 1/1 cputime: fix compiler warning caused by timeval_to_cputime()

Saw the following compiler warning on next tree:

kernel/itimer.c: In function 'set_cpu_itimer':
kernel/itimer.c:152:2: warning: passing argument 1 of 'timeval_to_cputime' discards 'const' qualifier from pointer target type [enabled by default]
...

---
 include/asm-generic/cputime_nsecs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/cputime_nsecs.h +1 -1
index b6485ca..a8ece9a 100644
@@ -76,7 +76,7 @@ static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
 /*
  * Convert cputime <-> timeval (msec)
  */
-static inline cputime_t timeval_to_cputime(struct timeval *val)
+static inline cputime_t timeval_to_cputime(const struct timeval *val)
 {
 	u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_usec * NSEC_PER_USEC;
 	return (__force cputime_t) ret;
Signature · 1 line
1.8.1.2
#1 lore raw

2013/2/17 Li Zhong <[email protected]>:

Quoted 9 lines

Saw the following compiler warning on next tree:

kernel/itimer.c: In function 'set_cpu_itimer':
kernel/itimer.c:152:2: warning: passing argument 1 of 'timeval_to_cputime' discards 'const' qualifier from pointer target type [enabled by default]
...

Applied and will send to Ingo.

Thanks Li!