From patchwork Sat Mar 31 11:21:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Folkesson X-Patchwork-Id: 10318925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E0338602A7 for ; Sat, 31 Mar 2018 11:22:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEEE029502 for ; Sat, 31 Mar 2018 11:22:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3400295F8; Sat, 31 Mar 2018 11:22:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6356929502 for ; Sat, 31 Mar 2018 11:22:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751766AbeCaLWR (ORCPT ); Sat, 31 Mar 2018 07:22:17 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:40370 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752268AbeCaLWN (ORCPT ); Sat, 31 Mar 2018 07:22:13 -0400 Received: by mail-lf0-f66.google.com with SMTP id e5-v6so15270217lfb.7; Sat, 31 Mar 2018 04:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=C6cFUNmYRKxQD6XL3FFk6qeHTjJbRa8YbNyIBNo9k4M=; b=X/wWyJttBxypMLg3++GOq1SUaa7J50TjJU53OQA5nn/SXqX9JQPgRPoyS/K87id5Dp lPGsrf4N7ycWn+qbLD06cgQBr3dHTduof07jWRA2gEdPOjfDadf8H7uo8TDCM1YI6d96 CJJWB6RtWKLBr20AGFB2kE/feUiXzNc1CUGY/YW4VFmzY6i59psEYB39rUpzfczRiPps e6lB1E1rXqunUmcZQNaHxBM90KC1qaXTHEwEh9+L+2lmwGF5VXYqnit70whd1ZrAxCVG ul3MID+Ok9gKxMlsZRBae5FHsiqYmxY8LtrrXW5YVL9DJ6zii88AF3aFONrBsNBZIjcN mFHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=C6cFUNmYRKxQD6XL3FFk6qeHTjJbRa8YbNyIBNo9k4M=; b=MJkhhzwUrt3sm4PU7hzm/mhtO4HMGvIUgY8Bo3bWMtBaGr3Wdy3x1mYbTEvxD5fQ47 rHnFTWUAy38tAARA9G4ook1aug/4wv3yuvdRJ4+Oi7Kl6HTSaoXXAtI44KwIGekHw7Vf d15JQ9PyAWg4FrvSKdDVDZKw8T7OyaR+3IJvmdUcc0SCVNKCqQ6qiSKcpIqV++gI8V0U kfQVIDbEYpD/02FTI8PvKvx5+U6IbeI8ReYwQnNWMSO/3i4bcJvlZeSojGgl0u8EfBUK 1r+LFBTguHt+BQZ1TMIPiQRQ6TI/9hxDKFLarXF9pGDRED7pg4C1KtpgoJ+EY8q3C0a8 qIuQ== X-Gm-Message-State: ALQs6tCgzY9C/P61rxGh/JAG+bYiV8q7chAvMZ/MOM/5BN2yh5+Gvz7x S4P2PzFGvrCc2vaXjhUmoZk= X-Google-Smtp-Source: AIpwx4+e/A0H/RJBmMhIUlhme/J8X0pOmSkjEAUPZiVQ8e7ZC7z5sKsENtpGusJwLdhtAARk/Aj6DQ== X-Received: by 10.46.128.16 with SMTP id j16mr1665342ljg.26.1522495331745; Sat, 31 Mar 2018 04:22:11 -0700 (PDT) Received: from localhost.localdomain (c-2ec2e1fc-74736162.cust.telenor.se. [46.194.225.252]) by smtp.gmail.com with ESMTPSA id e11sm1813218ljb.46.2018.03.31.04.22.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Mar 2018 04:22:11 -0700 (PDT) From: Marcus Folkesson To: Dmitry Torokhov Cc: Marcus Folkesson , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] input: gamecon: avoid using __set_bit() for capabilities Date: Sat, 31 Mar 2018 13:21:42 +0200 Message-Id: <20180331112143.18768-3-marcus.folkesson@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180331112143.18768-1-marcus.folkesson@gmail.com> References: <20180331112143.18768-1-marcus.folkesson@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP input_set_capability() and input_set_abs_param() will do it for you. Signed-off-by: Marcus Folkesson --- drivers/input/joystick/gamecon.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c index 2ffb2e8bdc3b..e3a9ef3d5f5a 100644 --- a/drivers/input/joystick/gamecon.c +++ b/drivers/input/joystick/gamecon.c @@ -862,7 +862,7 @@ static int gc_setup_pad(struct gc *gc, int idx, int pad_type) case GC_N64: for (i = 0; i < 10; i++) - __set_bit(gc_n64_btn[i], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, gc_n64_btn[i]); for (i = 0; i < 2; i++) { input_set_abs_params(input_dev, ABS_X + i, -127, 126, 0, 2); @@ -879,26 +879,27 @@ static int gc_setup_pad(struct gc *gc, int idx, int pad_type) break; case GC_SNESMOUSE: - __set_bit(BTN_LEFT, input_dev->keybit); - __set_bit(BTN_RIGHT, input_dev->keybit); - __set_bit(REL_X, input_dev->relbit); - __set_bit(REL_Y, input_dev->relbit); + input_set_capability(input_dev, EV_KEY, BTN_LEFT); + input_set_capability(input_dev, EV_KEY, BTN_RIGHT); + input_set_capability(input_dev, EV_REL, REL_X); + input_set_capability(input_dev, EV_REL, REL_Y); break; case GC_SNES: for (i = 4; i < 8; i++) - __set_bit(gc_snes_btn[i], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, gc_snes_btn[i]); /* fall through */ case GC_NES: for (i = 0; i < 4; i++) - __set_bit(gc_snes_btn[i], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, gc_snes_btn[i]); break; case GC_MULTI2: - __set_bit(BTN_THUMB, input_dev->keybit); + input_set_capability(input_dev, EV_KEY, BTN_THUMB); /* fall through */ case GC_MULTI: - __set_bit(BTN_TRIGGER, input_dev->keybit); + input_set_capability(input_dev, EV_KEY, BTN_TRIGGER); + /* fall through */ break; case GC_PSX: @@ -906,15 +907,16 @@ static int gc_setup_pad(struct gc *gc, int idx, int pad_type) input_set_abs_params(input_dev, gc_psx_abs[i], 4, 252, 0, 2); for (i = 0; i < 12; i++) - __set_bit(gc_psx_btn[i], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, gc_psx_btn[i]); + break; break; case GC_DDR: for (i = 0; i < 4; i++) - __set_bit(gc_psx_ddr_btn[i], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, gc_psx_ddr_btn[i]); for (i = 0; i < 12; i++) - __set_bit(gc_psx_btn[i], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, gc_psx_btn[i]); break; }