Commit 766cbb31 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

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: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 800846c4
...@@ -98,15 +98,17 @@ static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf, ...@@ -98,15 +98,17 @@ static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
// pulse // pulse
ktime_t last = ktime_add_us(edge, txbuf[i]); 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); gpiod_set_value(gpio_ir->gpio, 1);
edge += pulse; edge = ktime_add_ns(edge, pulse);
delta = edge - ktime_get(); delta = ktime_to_ns(ktime_sub(edge,
ktime_get()));
if (delta > 0) if (delta > 0)
ndelay(delta); ndelay(delta);
gpiod_set_value(gpio_ir->gpio, 0); gpiod_set_value(gpio_ir->gpio, 0);
edge += space; edge = ktime_add_ns(edge, space);
delta = edge - ktime_get(); delta = ktime_to_ns(ktime_sub(edge,
ktime_get()));
if (delta > 0) if (delta > 0)
ndelay(delta); ndelay(delta);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment