[WCNCR00166482] misc: Fix compilation error caused by 64-bit integer division
[Description]
Fix compilation error caused by 64-bit integer division
Call div_u64() to do unsigned 64-bit integer division for
both 64-bit and 32-bit Linux system compatibility.
Or the error will show in 32-bit Linux while inserting module:
wlan_mt6632_usb: Unknown symbol __udivdi3 (err 0)
Change-Id: I4b9c15cc8e41156727a7169ce02f88bad3cb8952
Signed-off-by: Awk Jiang <awk.jiang@mediatek.com>
CR-Id: WCNCR00166482
Feature: misc
Reviewed-on: http://gerrit.mediatek.inc:8080/1267430
CheckPatch: Check Patch <srv_checkpatch@mediatek.com>
Reviewed-by: George Kuo <george.kuo@mediatek.com>
Reviewed-by: Deren Wu <deren.wu@mediatek.com>
Build: srv_neptune_adm <srv_neptune_adm@mediatek.com>
diff --git a/nic/nic_cmd_event.c b/nic/nic_cmd_event.c
index 6e746c9..ca16987 100644
--- a/nic/nic_cmd_event.c
+++ b/nic/nic_cmd_event.c
@@ -3456,7 +3456,7 @@
prAdapter->rCsiData.bIsCck = prCsiData->bIsCck;
prAdapter->rCsiData.cRssi = prCsiData->cRssi;
prAdapter->rCsiData.ucSNR = prCsiData->ucSNR;
- prAdapter->rCsiData.u8TimeStamp = kalGetBootTime() / USEC_PER_MSEC;
+ prAdapter->rCsiData.u8TimeStamp = kalDivU64(kalGetBootTime(), USEC_PER_MSEC);
kalMemZero(prAdapter->rCsiData.ac2IData, sizeof(prAdapter->rCsiData.ac2IData));
kalMemZero(prAdapter->rCsiData.ac2QData, sizeof(prAdapter->rCsiData.ac2QData));
kalMemCopy(prAdapter->rCsiData.ac2IData,
diff --git a/os/linux/include/gl_kal.h b/os/linux/include/gl_kal.h
index 640b1e6..ae5b008 100644
--- a/os/linux/include/gl_kal.h
+++ b/os/linux/include/gl_kal.h
@@ -1258,4 +1258,9 @@
}
#endif
+static inline UINT_64 kalDivU64(UINT_64 dividend, UINT_32 divisor)
+{
+ return div_u64(dividend, divisor);
+}
+
#endif /* _GL_KAL_H */
diff --git a/os/linux/include/gl_os.h b/os/linux/include/gl_os.h
index f5aaea1..81ffe31 100644
--- a/os/linux/include/gl_os.h
+++ b/os/linux/include/gl_os.h
@@ -186,6 +186,8 @@
#include <net/iw_handler.h>
#endif
+#include <linux/math64.h>
+
#ifdef CFG_CFG80211_VERSION
#define CFG80211_VERSION_CODE CFG_CFG80211_VERSION
#else