* [PATCH 2/3] media: rc: gpio-ir-tx: use ktime accessor functions
@ 2017-08-26 8:31 Sean Young
0 siblings, 0 replies; only message in thread
From: Sean Young @ 2017-08-26 8:31 UTC (permalink / raw)
To: linux-media
Prefer using accessor functions so we are not dependent on the ktime_t
type.
Signed-off-by: Sean Young <sean@mess.org>
---
drivers/media/rc/gpio-ir-tx.c | 12 +++++++-----
1 file 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);
}
--
2.13.5
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-08-26 8:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-26 8:31 [PATCH 2/3] media: rc: gpio-ir-tx: use ktime accessor functions Sean Young
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).