From patchwork Mon Jan 18 17:41:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 8056771 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 38306BEEE5 for ; Mon, 18 Jan 2016 17:44:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 685982045E for ; Mon, 18 Jan 2016 17:43:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C6192045A for ; Mon, 18 Jan 2016 17:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756161AbcARRmG (ORCPT ); Mon, 18 Jan 2016 12:42:06 -0500 Received: from mail-pa0-f49.google.com ([209.85.220.49]:36108 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756070AbcARRlr (ORCPT ); Mon, 18 Jan 2016 12:41:47 -0500 Received: by mail-pa0-f49.google.com with SMTP id yy13so344381470pab.3; Mon, 18 Jan 2016 09:41:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=km9ZnQhOcCdodmV44Hcs5fGN32r42jCKV2ME+ACWrhw=; b=rRiwMaUfJa386AU+d+C1+hAJCGbr/e52amu2bwy0Dz6DqQuI6Ah/qYuBcoTzIAz7uy kLcgjK2/fwr31FXrMlKBbX0JP0dfbABsK6AsXwbZlzvqKk/MZWXxxjzwI6MFBnvZRtT2 n+zY1VVvwbkw41fad7DwzpUluISl03xrjUiRhq17z53Tbgt55VGXqQQ4uhCiVtCP2Yat eVdWzRWk+zBUrFkDVhIsW6nkfVFs8+we+ZLbhLDNuujIyyIQbtPfmAAMDlFFzlHxs7nn 2b98onou+K8ziHH0PBK5jdRuZ40sdcaVgSTu6jlJKEtbn8GmokjAPYgE2wZ/SZIU3tU3 0U9g== 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:in-reply-to :references; bh=km9ZnQhOcCdodmV44Hcs5fGN32r42jCKV2ME+ACWrhw=; b=XBBaBJyGwsGco59Yt/XO/LSntP4sPRpkxIPWKoUKykaZdG56S/90e0kPomLlXnyCBd 2rWaMzk37/7cCoiHAa7NPM+ODi6pSOoLJFFfvgTROfvpFod8bSYL8DhaImUDVj99xNhx D+C7VlOsffetahBPsG4hFvqDjz6BlAOQOkNkrqs+bNy5MGPilspWQhSqp/JU6VZlvRgn ApnpBkooWDGvlX9lqDLrLXXHKEPEGEENNbxkzM8dBdEwcq8nY4USdZy6glMfcOyNY+uf KYaAP/tH4Kp7BjfgmN29XBbGaeQlIBuuYmX+Gg6OhLgLTwTa5cXPs2f1OhH80kCoWck0 LH4g== X-Gm-Message-State: ALoCoQl/IlsEBuqYObR4qZKw9UGgYSr/A+lyMjQEGQBeegSnaL9vjxmE/NJMj/cQ2BUVStF6MnrdodSHPyj4ZPE7wDhWj+ZY0g== X-Received: by 10.67.1.102 with SMTP id bf6mr38324014pad.103.1453138907169; Mon, 18 Jan 2016 09:41:47 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([172.22.64.149]) by smtp.gmail.com with ESMTPSA id o75sm35479881pfi.17.2016.01.18.09.41.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jan 2016 09:41:46 -0800 (PST) From: Dmitry Torokhov To: linux-input@vger.kernel.org, =?UTF-8?q?Timo=20Ter=C3=A4s?= , Daniel Mack Cc: Haojian Zhuang , Robert Jarzmik , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] Input: rotary_encoder - use input_set_capability() Date: Mon, 18 Jan 2016 09:41:41 -0800 Message-Id: <1453138902-11657-4-git-send-email-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 In-Reply-To: <1453138902-11657-1-git-send-email-dmitry.torokhov@gmail.com> References: <1453138902-11657-1-git-send-email-dmitry.torokhov@gmail.com> 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, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Instead of manipulating capability bits directly let's use appropriate helpers. Also there is no need to explicitly set EV_ABS when calling input_set_abs_params(). Signed-off-by: Dmitry Torokhov --- drivers/input/misc/rotary_encoder.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index e913bfb64..1882e65 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c @@ -318,14 +318,10 @@ static int rotary_encoder_probe(struct platform_device *pdev) input->id.bustype = BUS_HOST; input->dev.parent = dev; - if (pdata->relative_axis) { - input->evbit[0] = BIT_MASK(EV_REL); - input->relbit[0] = BIT_MASK(pdata->axis); - } else { - input->evbit[0] = BIT_MASK(EV_ABS); - input_set_abs_params(encoder->input, - pdata->axis, 0, pdata->steps, 0, 1); - } + if (pdata->relative_axis) + input_set_capability(input, EV_REL, pdata->axis); + else + input_set_abs_params(input, pdata->axis, 0, pdata->steps, 0, 1); switch (pdata->steps_per_period) { case 4: