]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
media: rc-core: consistent use of rc_repeat()
authorDavid Härdeman <david@hardeman.nu>
Thu, 22 Jun 2017 19:23:54 +0000 (15:23 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sun, 20 Aug 2017 13:34:39 +0000 (09:34 -0400)
The NEC decoder and the Sanyo decoders check if dev->keypressed is true
before calling rc_repeat (without holding dev->keylock).

Meanwhile, the XMP and JVC decoders do no such checks.

This patch makes sure all users of rc_repeat() do so consistently by
removing extra checks in NEC/Sanyo and modifying the check a bit in
rc_repeat() so that no input event is generated if the key isn't pressed.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/rc/ir-nec-decoder.c
drivers/media/rc/ir-sanyo-decoder.c
drivers/media/rc/rc-main.c

index 3ce850314dcadb54c1829649244763bcdc06d864..75b9137f6faf976aa9df6091fbd054419b6de033 100644 (file)
@@ -88,13 +88,9 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
                        data->state = STATE_BIT_PULSE;
                        return 0;
                } else if (eq_margin(ev.duration, NEC_REPEAT_SPACE, NEC_UNIT / 2)) {
-                       if (!dev->keypressed) {
-                               IR_dprintk(1, "Discarding last key repeat: event after key up\n");
-                       } else {
-                               rc_repeat(dev);
-                               IR_dprintk(1, "Repeat last key\n");
-                               data->state = STATE_TRAILER_PULSE;
-                       }
+                       rc_repeat(dev);
+                       IR_dprintk(1, "Repeat last key\n");
+                       data->state = STATE_TRAILER_PULSE;
                        return 0;
                }
 
index 520bb77dcb62b31ba2915fc4b673365d69113c70..e6a906a34f9059bfbd919a88e50489203fcadf4c 100644 (file)
@@ -110,13 +110,9 @@ static int ir_sanyo_decode(struct rc_dev *dev, struct ir_raw_event ev)
                        break;
 
                if (!data->count && geq_margin(ev.duration, SANYO_REPEAT_SPACE, SANYO_UNIT / 2)) {
-                       if (!dev->keypressed) {
-                               IR_dprintk(1, "SANYO discarding last key repeat: event after key up\n");
-                       } else {
-                               rc_repeat(dev);
-                               IR_dprintk(1, "SANYO repeat last key\n");
-                               data->state = STATE_INACTIVE;
-                       }
+                       rc_repeat(dev);
+                       IR_dprintk(1, "SANYO repeat last key\n");
+                       data->state = STATE_INACTIVE;
                        return 0;
                }
 
index a9eba00135255d8cd1aeb84aaf5ddfb3ab3a8e59..7387bd4d75b0c9aa6b2607ecc4217b2d5d827816 100644 (file)
@@ -616,12 +616,12 @@ void rc_repeat(struct rc_dev *dev)
 
        spin_lock_irqsave(&dev->keylock, flags);
 
-       input_event(dev->input_dev, EV_MSC, MSC_SCAN, dev->last_scancode);
-       input_sync(dev->input_dev);
-
        if (!dev->keypressed)
                goto out;
 
+       input_event(dev->input_dev, EV_MSC, MSC_SCAN, dev->last_scancode);
+       input_sync(dev->input_dev);
+
        dev->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT);
        mod_timer(&dev->timer_keyup, dev->keyup_jiffies);