On Sunday 01 November 2015 19:21:58 Amitoj Kaur Chawla wrote:
-#define BFA_TRC_TS(_trcm) \
({ \
struct timeval tv; \
\
do_gettimeofday(&tv); \
(tv.tv_sec*1000000+tv.tv_usec); \
})
+#define BFA_TRC_TS(_trcm) (ktime_get_real_ns() / NSEC_PER_USEC)
This change is broken on 32-bit architectures, as you are doing a 64-bit integer division that we don't allow in the kernel. If you try to build the entire kernel for 32-bit, you will get a link error here.
Also, you probably don't want to do the expensive division in a function that is called as often as this one. This probably needs some help from the driver maintainer, to answer how the timestamp is used, but using the original algorithm would at least make it no less efficient than it is today. Alternatively, using
#define BFA_TRC_TS(_trcm) (ktime_get_ns() >> 10)
could give an approximation by doing a bit shift (division by 1024) instead of the division by 1000.
Arnd