[PATCH next] drivers: net: wireless: ath: wil6210: debugfs: Use 'uint64_t' instead of 'cycles_t' to avoid warnings

From: Chen Gang
Date: Wed Dec 24 2014 - 09:47:18 EST


do_div() checks the type strictly. 'cycles_t' may be 32-bit under quite
a few architectures (parisc, arm, avr32 ...). So use 'uint64_t' instead
of, the related warning (with allmodconfig undr parisc):

CC [M] drivers/net/wireless/ath/wil6210/debugfs.o
In file included from arch/parisc/include/generated/asm/div64.h:1:0,
from include/linux/kernel.h:124,
from include/linux/list.h:8,
from include/linux/module.h:9,
from drivers/net/wireless/ath/wil6210/debugfs.c:17:
drivers/net/wireless/ath/wil6210/debugfs.c: In function
âwil_vring_debugfs_showâ:
include/asm-generic/div64.h:43:28: warning: comparison of distinct
pointer types lacks a cast
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
^
drivers/net/wireless/ath/wil6210/debugfs.c:107:4: note: in expansion
of macro âdo_divâ
do_div(idle, total);
^
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from ./include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from drivers/net/wireless/ath/wil6210/debugfs.c:17:
include/asm-generic/div64.h:44:18: warning: right shift count >= width
of type [-Wshift-count-overflow]
if (likely(((n) >> 32) == 0)) { \
^
include/linux/compiler.h:159:40: note: in definition of macro âlikelyâ
# define likely(x) __builtin_expect(!!(x), 1)
^
drivers/net/wireless/ath/wil6210/debugfs.c:107:4: note: in expansion
of macro âdo_divâ
do_div(idle, total);
^
In file included from arch/parisc/include/generated/asm/div64.h:1:0,
from include/linux/kernel.h:124,
from include/linux/list.h:8,
from include/linux/module.h:9,
from drivers/net/wireless/ath/wil6210/debugfs.c:17:
include/asm-generic/div64.h:48:22: warning: passing argument 1 of
â__div64_32â from incompatible pointer type [-Wincompatible-pointer-types]
__rem = __div64_32(&(n), __base); \
^
drivers/net/wireless/ath/wil6210/debugfs.c:107:4: note: in expansion
of macro âdo_divâ
do_div(idle, total);
^
include/asm-generic/div64.h:35:17: note: expected âuint64_t * {aka
long long unsigned int *}â but argument is of type âcycles_t * {aka long
unsigned int *}â
extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
^

Signed-off-by: Chen Gang <gang.chen.5i5j@xxxxxxxxx>
---
drivers/net/wireless/ath/wil6210/debugfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c
b/drivers/net/wireless/ath/wil6210/debugfs.c
index 4e6e145..cd991fa 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -101,8 +101,8 @@ static int wil_vring_debugfs_show(struct seq_file
*s, void *data)
char name[10];
/* performance monitoring */
cycles_t now = get_cycles();
- cycles_t idle = txdata->idle * 100;
- cycles_t total = now - txdata->begin;
+ uint64_t idle = txdata->idle * 100;
+ uint64_t total = now - txdata->begin;

do_div(idle, total);
txdata->begin = now;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/