Received: by 10.223.164.221 with SMTP id h29csp2753832wrb; Thu, 2 Nov 2017 17:18:27 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QIVo9aP1HEJCIxn9fHXgz9lleL4DaaRrcpQYov+kXfttLxG8ZfSb4+aQjmbckyhnisVHS/ X-Received: by 10.98.34.131 with SMTP id p3mr5723288pfj.1.1509668306940; Thu, 02 Nov 2017 17:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509668306; cv=none; d=google.com; s=arc-20160816; b=bYKxtciqxoy9hbryXlkHxrxhIjzObNMqjzuYtoNwXy3ZIDhSe3hXiXnoEUPComsAzx wuiEV52p81nppZ3PpYoz9VUB7R9Fr0DCDk565FVkUv9wgLTrLZWFaGUPIvEYDzG5X8ab ApPtxCTXq19X9/YH7Y58N0LRBTKz9GZGa9+Zp+chXO8fU7/BS5JtwOAmlZQPVi7ge/65 ozIsspJtFUQmSGIJobc2hLrCLVBRsUdmME7Jbxg4ApD6ua2d4PEf4Ytf6QhRxpoS7fTf fVbBHQ+9jkSyVRCph8KlVsRN/LBd5dkktINEk6fjv86vqcc6Af3NrdUGSclnHQ7elsaM aK7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=ZwXTw/+V57G+bfLbIlWrr1VqjPAkqsM3YLbQ+w/v88A=; b=q1yxnL+FBHUTppHcpt67DR4/wP0A7AOKCTaZ62w/gP+r2fbph/BMAPm65pnONhH/6V OEnxbbKsfje4bYw3kI4BdkUHmDa6yaXbx8cd319vJqRTtVU3fb4qdu3Rf01wB/Ry2BSU HmrXGPCXwocKCXhq+okTZay+RGnJjb0crGkr66R3iXfK42UjBUWbrVy0zfSZyAtFXMue cCcw+sclPG1dENekUO/sa0jbgjX0mYExH4sO8fZ+yfL+ATDXPj62Q7cuS0aLY0GhRIuv bB1okAV2lXulHzvrAERdHm//AKpx3HPcE+L/rzC2IBI7D7CZljNViS3Dyi8XzzmcKUsn SN9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a23si4622238pgd.261.2017.11.02.17.18.04; Thu, 02 Nov 2017 17:18:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934681AbdKCARG (ORCPT + 96 others); Thu, 2 Nov 2017 20:17:06 -0400 Received: from osg.samsung.com ([64.30.133.232]:58876 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934600AbdKCARF (ORCPT ); Thu, 2 Nov 2017 20:17:05 -0400 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id CD1E817C0A; Thu, 2 Nov 2017 17:17:04 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id z0uNU7Sev-Sv; Thu, 2 Nov 2017 17:17:03 -0700 (PDT) Received: from vento.lan (177.17.242.137.dynamic.adsl.gvt.net.br [177.17.242.137]) by osg.samsung.com (Postfix) with ESMTPSA id 964DE17C02; Thu, 2 Nov 2017 17:17:01 -0700 (PDT) Date: Thu, 2 Nov 2017 22:16:58 -0200 From: Mauro Carvalho Chehab To: Dmitry Torokhov Cc: Kees Cook , Mauro Carvalho Chehab , Sean Young , Hans Verkuil , linux-media@vger.kernel.org, LKML , Thomas Gleixner Subject: Re: [PATCH v2] media: ttpci: remove autorepeat handling and use timer_setup Message-ID: <20171102221658.6d41bfcf@vento.lan> In-Reply-To: <20171102235037.4gndwq5223uyv5kw@dtor-ws> References: <20171025004005.hyb43h3yvovp4is2@dtor-ws> <20171031172758.ugfo6br344iso4ni@gofer.mess.org> <20171031174558.vsdpdudcwjneq2nu@gofer.mess.org> <20171031182236.cxrasbayon7h52mm@dtor-ws> <20171031200758.avdowtmcem5fnlb5@gofer.mess.org> <20171031201143.ziwohlwpdvc4barr@gofer.mess.org> <20171102235037.4gndwq5223uyv5kw@dtor-ws> Organization: Samsung X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, 2 Nov 2017 16:50:37 -0700 Dmitry Torokhov escreveu: > On Thu, Nov 02, 2017 at 04:24:27PM -0700, Kees Cook wrote: > > On Tue, Oct 31, 2017 at 1:11 PM, Sean Young wrote: > > > Leave the autorepeat handling up to the input layer, and move > > > to the new timer API. > > > > > > Compile tested only. > > > > > > Signed-off-by: Sean Young > > > > Hi! Just checking up on this... the input timer conversion is blocked > > by getting this sorted out, so I'd love to have something either > > media, input, or timer tree can carry. :) > > Acked-by: Dmitry Torokhov > > From my POV the patch is good. Mauro, do you want me to take it through > my tree, or maybe you could create an immutable branch off 4.14-rc5 (or > 6) with this commit and I will pull it in and then can apply Kees input > core conversion patch? Feel free to apply it into your tree with my ack: Acked-by: Mauro Carvalho Chehab Regards, Mauro > > Thanks! > > > > > Thanks! > > > > -Kees > > > > > --- > > > v2: > > > - fixes and improvements from Dmitry Torokhov > > > > > > drivers/media/pci/ttpci/av7110.h | 2 +- > > > drivers/media/pci/ttpci/av7110_ir.c | 56 +++++++++++++------------------------ > > > 2 files changed, 21 insertions(+), 37 deletions(-) > > > > > > diff --git a/drivers/media/pci/ttpci/av7110.h b/drivers/media/pci/ttpci/av7110.h > > > index 347827925c14..bcb72ecbedc0 100644 > > > --- a/drivers/media/pci/ttpci/av7110.h > > > +++ b/drivers/media/pci/ttpci/av7110.h > > > @@ -93,7 +93,7 @@ struct infrared { > > > u8 inversion; > > > u16 last_key; > > > u16 last_toggle; > > > - u8 delay_timer_finished; > > > + bool keypressed; > > > }; > > > > > > > > > diff --git a/drivers/media/pci/ttpci/av7110_ir.c b/drivers/media/pci/ttpci/av7110_ir.c > > > index ca05198de2c2..ee414803e6b5 100644 > > > --- a/drivers/media/pci/ttpci/av7110_ir.c > > > +++ b/drivers/media/pci/ttpci/av7110_ir.c > > > @@ -84,15 +84,16 @@ static u16 default_key_map [256] = { > > > > > > > > > /* key-up timer */ > > > -static void av7110_emit_keyup(unsigned long parm) > > > +static void av7110_emit_keyup(struct timer_list *t) > > > { > > > - struct infrared *ir = (struct infrared *) parm; > > > + struct infrared *ir = from_timer(ir, t, keyup_timer); > > > > > > - if (!ir || !test_bit(ir->last_key, ir->input_dev->key)) > > > + if (!ir || !ir->keypressed) > > > return; > > > > > > input_report_key(ir->input_dev, ir->last_key, 0); > > > input_sync(ir->input_dev); > > > + ir->keypressed = false; > > > } > > > > > > > > > @@ -152,29 +153,18 @@ static void av7110_emit_key(unsigned long parm) > > > return; > > > } > > > > > > - if (timer_pending(&ir->keyup_timer)) { > > > - del_timer(&ir->keyup_timer); > > > - if (ir->last_key != keycode || toggle != ir->last_toggle) { > > > - ir->delay_timer_finished = 0; > > > - input_event(ir->input_dev, EV_KEY, ir->last_key, 0); > > > - input_event(ir->input_dev, EV_KEY, keycode, 1); > > > - input_sync(ir->input_dev); > > > - } else if (ir->delay_timer_finished) { > > > - input_event(ir->input_dev, EV_KEY, keycode, 2); > > > - input_sync(ir->input_dev); > > > - } > > > - } else { > > > - ir->delay_timer_finished = 0; > > > - input_event(ir->input_dev, EV_KEY, keycode, 1); > > > - input_sync(ir->input_dev); > > > - } > > > + if (ir->keypressed && > > > + (ir->last_key != keycode || toggle != ir->last_toggle)) > > > + input_event(ir->input_dev, EV_KEY, ir->last_key, 0); > > > > > > + input_event(ir->input_dev, EV_KEY, keycode, 1); > > > + input_sync(ir->input_dev); > > > + > > > + ir->keypressed = true; > > > ir->last_key = keycode; > > > ir->last_toggle = toggle; > > > > > > - ir->keyup_timer.expires = jiffies + UP_TIMEOUT; > > > - add_timer(&ir->keyup_timer); > > > - > > > + mod_timer(&ir->keyup_timer, jiffies + UP_TIMEOUT); > > > } > > > > > > > > > @@ -204,16 +194,6 @@ static void input_register_keys(struct infrared *ir) > > > ir->input_dev->keycodemax = ARRAY_SIZE(ir->key_map); > > > } > > > > > > - > > > -/* called by the input driver after rep[REP_DELAY] ms */ > > > -static void input_repeat_key(unsigned long parm) > > > -{ > > > - struct infrared *ir = (struct infrared *) parm; > > > - > > > - ir->delay_timer_finished = 1; > > > -} > > > - > > > - > > > /* check for configuration changes */ > > > int av7110_check_ir_config(struct av7110 *av7110, int force) > > > { > > > @@ -333,8 +313,7 @@ int av7110_ir_init(struct av7110 *av7110) > > > av_list[av_cnt++] = av7110; > > > av7110_check_ir_config(av7110, true); > > > > > > - setup_timer(&av7110->ir.keyup_timer, av7110_emit_keyup, > > > - (unsigned long)&av7110->ir); > > > + timer_setup(&av7110->ir.keyup_timer, av7110_emit_keyup, 0); > > > > > > input_dev = input_allocate_device(); > > > if (!input_dev) > > > @@ -365,8 +344,13 @@ int av7110_ir_init(struct av7110 *av7110) > > > input_free_device(input_dev); > > > return err; > > > } > > > - input_dev->timer.function = input_repeat_key; > > > - input_dev->timer.data = (unsigned long) &av7110->ir; > > > + > > > + /* > > > + * Input core's default autorepeat is 33 cps with 250 msec > > > + * delay, let's adjust to numbers more suitable for remote > > > + * control. > > > + */ > > > + input_enable_softrepeat(input_dev, 250, 125); > > > > > > if (av_cnt == 1) { > > > e = proc_create("av7110_ir", S_IWUSR, NULL, &av7110_ir_proc_fops); > > > -- > > > 2.13.6 > > > > > > > > > > > -- > > Kees Cook > > Pixel Security > Thanks, Mauro From 1583000260222484067@xxx Thu Nov 02 23:51:31 +0000 2017 X-GM-THRID: 1582796172494793211 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread