From patchwork Fri Oct 9 21:10:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Gynther X-Patchwork-Id: 7363901 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 03A819F32B for ; Fri, 9 Oct 2015 21:10:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 194F520414 for ; Fri, 9 Oct 2015 21:10:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E28D2040F for ; Fri, 9 Oct 2015 21:10:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751423AbbJIVKt (ORCPT ); Fri, 9 Oct 2015 17:10:49 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:35842 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751393AbbJIVKs (ORCPT ); Fri, 9 Oct 2015 17:10:48 -0400 Received: by pablk4 with SMTP id lk4so96563327pab.3 for ; Fri, 09 Oct 2015 14:10:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=CSb0Ji0TAO2tUfiu9K4xWstDuF3xCFTjjDG6UK51CUo=; b=lva6RUdxrRM7BsfBN69ZI+3ctpHPnd5+ZepUStzyy374FwkMztKpJKpLdH2ikh86Zq bc8dYJ79A4dov9ILGpIBmYgPpMrU8JmojZVJSgtn3YuaCJ1KUna6lQumNse5fGtD/UVv oCBcrF7QWUeA7z5+JLh1qr5Ke4tE9UE4/JgTDcNnI6LEHfWk5FxnU62SIsHEIx0+Vv1/ lptN/gvVOkwfSpZxCoSrBI1JDP1oJOUhHKrcOnUZZN3bkAGpkw0r+tJrEK/SpqHZLKkD FgS+GpHl4FXR70dXdceTJt5GRTwqXBWuH8O5hGwYJ5yBuqITASBTH2rjvXe3nwVKH7D0 INbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CSb0Ji0TAO2tUfiu9K4xWstDuF3xCFTjjDG6UK51CUo=; b=cJMt9BbYcKXiiYrdhDOGw1LZKf+QbVFa0dX/bDbMoD/BT6cC37i019DtdjPSEZNx1y zLah9FZbi75rzrAYJ5jnyRZAE92JNldr2XCF2EsmDkr+5TmKA5tGdICXzlMOaLjVskZy 5wX5q6pFlmfBhkZs6pFQFIIVJbbEFPGa9RgzB0n4AostQ6oi2UBGJbB7clKbXRwL6crj afjxvDQHESB8frmm36OS0R0R29J8kB5w0yfjCl0VDJNn1b7p68fg543nBLHltLllnkDm z9t3f8NdAxJvyVqLt9QU326nLiFnKsyTcSQUJd55Iw2lPq6MMclxFTConz820YtrLLuS JlGw== X-Gm-Message-State: ALoCoQk1ktEHu3FWRkz9Zc6ytqt6cvIHTXXgs7f7nq55G/N79AS89Yo8kPTLjT3NtV864L/UtxMz X-Received: by 10.68.129.231 with SMTP id nz7mr17616535pbb.53.1444425047798; Fri, 09 Oct 2015 14:10:47 -0700 (PDT) Received: from pgynther-desktop.mtv.corp.google.com ([172.27.88.51]) by smtp.gmail.com with ESMTPSA id ol3sm4206790pbb.49.2015.10.09.14.10.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Oct 2015 14:10:46 -0700 (PDT) From: Petri Gynther To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Petri Gynther Subject: [PATCH] Input: improve autorepeat initialization Date: Fri, 9 Oct 2015 14:10:01 -0700 Message-Id: <1444425001-141384-1-git-send-email-pgynther@google.com> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Allow driver to initialize only input_dev->rep[REP_DELAY] and input_dev->rep[REP_PERIOD], but then use the input timer and repeat function from input.c. For example, a HID driver could do: static void xyz_input_configured(struct hid_device *hid, struct hid_input *hidinput) { hidinput->input->rep[REP_DELAY] = 400; hidinput->input->rep[REP_PERIOD] = 100; } static struct hid_driver xyz_driver = { .input_configured = xyz_input_configured, } Signed-off-by: Petri Gynther --- drivers/input/input.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/input/input.c b/drivers/input/input.c index 5391abd..1984ba5 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -2115,6 +2115,15 @@ int input_register_device(struct input_dev *dev) dev->rep[REP_PERIOD] = 33; } + /* + * If the driver didn't initialize the timer data and function, then + * handle the autorepeating here in input.c. + */ + if (!dev->timer.data && !dev->timer.function) { + dev->timer.data = (unsigned long) dev; + dev->timer.function = input_repeat_key; + } + if (!dev->getkeycode) dev->getkeycode = input_default_getkeycode;