[4/7] rc-core: sanyo - leave the internals of rc_dev alone
diff mbox

Message ID 149365501201.13489.12300860491124752633.stgit@zeus.hardeman.nu
State New
Headers show

Commit Message

David Härdeman May 1, 2017, 4:10 p.m. UTC
Leave repeat handling to rc-core.

Signed-off-by: David Härdeman <david@hardeman.nu>
---
 drivers/media/rc/ir-sanyo-decoder.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Sean Young May 22, 2017, 8:46 p.m. UTC | #1
On Mon, May 01, 2017 at 06:10:12PM +0200, David Härdeman wrote:
> Leave repeat handling to rc-core.
> 
> Signed-off-by: David Härdeman <david@hardeman.nu>
> ---
>  drivers/media/rc/ir-sanyo-decoder.c |   10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/rc/ir-sanyo-decoder.c b/drivers/media/rc/ir-sanyo-decoder.c
> index 520bb77dcb62..e6a906a34f90 100644
> --- a/drivers/media/rc/ir-sanyo-decoder.c
> +++ b/drivers/media/rc/ir-sanyo-decoder.c
> @@ -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;

Same as the nec decoder: the original code checks whether there has been
a key up event already, so you don't get old scancodes repeated for no
reason.

>  			return 0;
>  		}
>

Patch
diff mbox

diff --git a/drivers/media/rc/ir-sanyo-decoder.c b/drivers/media/rc/ir-sanyo-decoder.c
index 520bb77dcb62..e6a906a34f90 100644
--- a/drivers/media/rc/ir-sanyo-decoder.c
+++ b/drivers/media/rc/ir-sanyo-decoder.c
@@ -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;
 		}