Przeglądaj źródła

[media] imon: fix initial panel key repeat suppression

As pointed out on the lirc list by Andreas Dick, initial panel key
repeat suppression wasn't working, as we had no timevals accumulated
until after the first repeat. Also add a missing locking call.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jarod Wilson 14 lat temu
rodzic
commit
94215ccd99
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      drivers/media/rc/imon.c

+ 4 - 2
drivers/media/rc/imon.c

@@ -1590,16 +1590,16 @@ static void imon_incoming_packet(struct imon_context *ictx,
 	/* Only panel type events left to process now */
 	/* Only panel type events left to process now */
 	spin_lock_irqsave(&ictx->kc_lock, flags);
 	spin_lock_irqsave(&ictx->kc_lock, flags);
 
 
+	do_gettimeofday(&t);
 	/* KEY_MUTE repeats from knob need to be suppressed */
 	/* KEY_MUTE repeats from knob need to be suppressed */
 	if (ictx->kc == KEY_MUTE && ictx->kc == ictx->last_keycode) {
 	if (ictx->kc == KEY_MUTE && ictx->kc == ictx->last_keycode) {
-		do_gettimeofday(&t);
 		msec = tv2int(&t, &prev_time);
 		msec = tv2int(&t, &prev_time);
-		prev_time = t;
 		if (msec < ictx->idev->rep[REP_DELAY]) {
 		if (msec < ictx->idev->rep[REP_DELAY]) {
 			spin_unlock_irqrestore(&ictx->kc_lock, flags);
 			spin_unlock_irqrestore(&ictx->kc_lock, flags);
 			return;
 			return;
 		}
 		}
 	}
 	}
+	prev_time = t;
 	kc = ictx->kc;
 	kc = ictx->kc;
 
 
 	spin_unlock_irqrestore(&ictx->kc_lock, flags);
 	spin_unlock_irqrestore(&ictx->kc_lock, flags);
@@ -1611,7 +1611,9 @@ static void imon_incoming_packet(struct imon_context *ictx,
 	input_report_key(ictx->idev, kc, 0);
 	input_report_key(ictx->idev, kc, 0);
 	input_sync(ictx->idev);
 	input_sync(ictx->idev);
 
 
+	spin_lock_irqsave(&ictx->kc_lock, flags);
 	ictx->last_keycode = kc;
 	ictx->last_keycode = kc;
+	spin_unlock_irqrestore(&ictx->kc_lock, flags);
 
 
 	return;
 	return;