media: rc: default to idle on at startup or after reset
authorSean Young <sean@mess.org>
Thu, 10 May 2018 20:41:15 +0000 (16:41 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 14 May 2018 11:14:51 +0000 (07:14 -0400)
Any spaces events received after a reset or startup should be discarded,
so ensure the rc device is in idle mode.

This also makes it much easier to detect incorrect raw events, as we will
do in a following commit.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/rc/rc-ir-raw.c
include/media/rc-core.h

index 2ab8a2b..2e50104 100644 (file)
@@ -611,6 +611,7 @@ int ir_raw_event_prepare(struct rc_dev *dev)
 
        dev->raw->dev = dev;
        dev->change_protocol = change_protocol;
+       dev->idle = true;
        spin_lock_init(&dev->raw->edge_spinlock);
        timer_setup(&dev->raw->edge_handle, ir_raw_edge_handle, 0);
        INIT_KFIFO(dev->raw->kfifo);
index 6742fd8..6157177 100644 (file)
@@ -347,6 +347,7 @@ static inline void ir_raw_event_reset(struct rc_dev *dev)
        struct ir_raw_event ev = { .reset = true };
 
        ir_raw_event_store(dev, &ev);
+       dev->idle = true;
        ir_raw_event_handle(dev);
 }