Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wil6210: fix for 64-bit integer division

On some platforms, cycles_t is 64-bit, and gcc generates call to
__udivdi3 for straight division of cycles_t/cycles_t. This leads
to compilation failure, as this function is not exist in the kernel
runtime. do_div() to rescue

Original report:

tree: git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git master
head: 2e91606f5e1ec7329557dfc0e298c4c021acbb80
commit: 7c0acf868d2e470c9d6a40091acf8d6444c01b57 [81/103] wil6210: Tx performance monitoring
config: i386-randconfig-ha3-0620 (attached as .config)

All error/warnings:

drivers/built-in.o: In function `wil_vring_debugfs_show':
>> debugfs.c:(.text+0x39b9be): undefined reference to `__udivdi3'

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Vladimir Kondratiev and committed by
John W. Linville
e48b1790 6451acdc

+3 -2
+3 -2
drivers/net/wireless/ath/wil6210/debugfs.c
··· 83 83 char name[10]; 84 84 /* performance monitoring */ 85 85 cycles_t now = get_cycles(); 86 - cycles_t idle = txdata->idle; 86 + cycles_t idle = txdata->idle * 100; 87 87 cycles_t total = now - txdata->begin; 88 88 89 + do_div(idle, total); 89 90 txdata->begin = now; 90 91 txdata->idle = 0ULL; 91 92 ··· 94 93 95 94 seq_printf(s, "\n%pM CID %d TID %d [%3d|%3d] idle %3d%%\n", 96 95 wil->sta[cid].addr, cid, tid, used, avail, 97 - (int)((idle*100)/total)); 96 + (int)idle); 98 97 99 98 wil_print_vring(s, wil, name, vring, '_', 'H'); 100 99 }