summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2017-08-25 10:45:47 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-08-31 05:35:54 -0400
commit766cbb31893108850f898fa3616d57c59b584354 (patch)
tree1086168f0ad3e31522d5d6a5712163967c3b8478 /drivers/media
parent800846c4d92f538c6640f83d9f9c0f44dac8ada7 (diff)
media: rc: gpio-ir-tx: use ktime accessor functions
Prefer using accessor functions so we are not dependent on the ktime_t type. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/rc/gpio-ir-tx.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/media/rc/gpio-ir-tx.c b/drivers/media/rc/gpio-ir-tx.c
index 0b83408a2e18..cd476cab9782 100644
--- a/drivers/media/rc/gpio-ir-tx.c
+++ b/drivers/media/rc/gpio-ir-tx.c
@@ -98,15 +98,17 @@ static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
// pulse
ktime_t last = ktime_add_us(edge, txbuf[i]);
- while (ktime_get() < last) {
+ while (ktime_before(ktime_get(), last)) {
gpiod_set_value(gpio_ir->gpio, 1);
- edge += pulse;
- delta = edge - ktime_get();
+ edge = ktime_add_ns(edge, pulse);
+ delta = ktime_to_ns(ktime_sub(edge,
+ ktime_get()));
if (delta > 0)
ndelay(delta);
gpiod_set_value(gpio_ir->gpio, 0);
- edge += space;
- delta = edge - ktime_get();
+ edge = ktime_add_ns(edge, space);
+ delta = ktime_to_ns(ktime_sub(edge,
+ ktime_get()));
if (delta > 0)
ndelay(delta);
}