From 7d519fb37b003a2d42ec180e31dfd6ccff96d206 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Mon, 12 Feb 2018 09:00:28 -0500 Subject: [PATCH] UPSTREAM: media: rc: get start time just before calling driver tx The current code gets the start time before copying the IR from userspace (could cause page faults) and encoding IR. This means that the gap calculation could be off. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab (cherry picked from commit 29422737017b866d4a51014cc7522fa3a99e8852) Signed-off-by: Ziyuan Xu --- drivers/media/rc/lirc_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 582197457b34..518b364ea90e 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -253,8 +253,6 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf, goto out_unlock; } - start = ktime_get(); - if (!dev->tx_ir) { ret = -EINVAL; goto out_unlock; @@ -347,6 +345,8 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf, duration += txbuf[i]; } + start = ktime_get(); + ret = dev->tx_ir(dev, txbuf, count); if (ret < 0) goto out_kfree;