@@ -173,6 +173,9 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf,
if (towait > 0) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(usecs_to_jiffies(towait));
+ } else {
+ printk("JDB: ir_lirc_transmit_ir: towait is non-pos: %lld (start: %lld duration: %lld)\n",
+ towait, ktime_to_us(start), duration);
}
out:
@@ -171,14 +171,43 @@ extern u64 ktime_divns(const ktime_t kt, s64 div);
# define ktime_divns(kt, div) (u64)((kt).tv64 / (div))
#endif
+
+static inline s64 _old_ktime_to_us(const ktime_t kt)
+{
+ struct timeval tv = ktime_to_timeval(kt);
+
+ return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
+}
+
+static inline s64 _old_ktime_to_ms(const ktime_t kt)
+{
+ struct timeval tv = ktime_to_timeval(kt);
+
+ return (s64) tv.tv_sec * MSEC_PER_SEC + tv.tv_usec / USEC_PER_MSEC;
+}
+
+
static inline s64 ktime_to_us(const ktime_t kt)
{
- return ktime_divns(kt, NSEC_PER_USEC);
+ s64 ret = ktime_divns(kt, NSEC_PER_USEC);
+
+ if (ret != _old_ktime_to_us(kt)) {
+ printk("JDB: ktime_to_us: %lld -> divns %lld != old method: %lld\n",
+ ktime_to_ns(kt), ret, _old_ktime_to_us(kt));
+ }
+
+ return ret;
}
static inline s64 ktime_to_ms(const ktime_t kt)
{
- return ktime_divns(kt, NSEC_PER_MSEC);
+ s64 ret = ktime_divns(kt, NSEC_PER_MSEC);
+
+ if (ret != _old_ktime_to_ms(kt)) {
+ printk("JDB: ktime_to_ms: %lld -> divns %lld != old method: %lld\n",
+ ktime_to_ns(kt), ret, _old_ktime_to_ms(kt));
+ }
+ return ret;
}
static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
Debug patch to try to sort out ktime_to_us/ms regressions Mind running with this patch to see what it spits out, and send me the resulting dmesg output? Signed-off-by: John Stultz <john.stultz@linaro.org> --- drivers/media/rc/ir-lirc-codec.c | 3 +++ include/linux/ktime.h | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-)