From patchwork Sat Mar 31 11:21:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Folkesson X-Patchwork-Id: 10318921 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 1005060212 for ; Sat, 31 Mar 2018 11:22:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAE0B29568 for ; Sat, 31 Mar 2018 11:22:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF75E29502; Sat, 31 Mar 2018 11:22:15 +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 6715A29502 for ; Sat, 31 Mar 2018 11:22:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751725AbeCaLWL (ORCPT ); Sat, 31 Mar 2018 07:22:11 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:38599 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751580AbeCaLWK (ORCPT ); Sat, 31 Mar 2018 07:22:10 -0400 Received: by mail-lf0-f66.google.com with SMTP id u3-v6so15248525lff.5; Sat, 31 Mar 2018 04:22:09 -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; bh=eIBZrrBu5Ji4SliqYML3H5FzTmRdAMudwKUwGNeTXdg=; b=YL7AvnNmxRurusDtzgEUVVsXXWhElLXju8VTLYi/4LqEElIy6q7ex80V08vpco1OcE CAbQ2+kVI/+U/gUSKt95rciAY3/c21ANZ8loWPalYSZrLW2Bp5kv/R/pUsX+yKjS8z7p 5s1gJ+ICTUiBAQm1CUNKqYg13xZn9+1H407AuYvtwoPz2QLiEvzxMX8RR01cKHE/yqf7 yURtZSgkyI/vBHZGsIQxoFPRk1+/v0L6vFK/LJjClBRn5sjx9CAQ5YiFXi4FBChwRNEX WijflrfVw9UZbfpjk9DwKFVKV33jKdCxYv+D182ocqOSc8pRhYe852kUVsS8osY4Z7Tk oDhQ== 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; bh=eIBZrrBu5Ji4SliqYML3H5FzTmRdAMudwKUwGNeTXdg=; b=mys8f0EytqvjQLn76cUaN44ELV3eI8mgS+Q7IfFBtdy+O2d2CLhDGjk3C1bY3rMpF8 DAPqDVqjmkVH9MHIUj5Lyo01bHHgafIj7pyX0Q5d/ub10Jnd17DCWmO9Hs2pEZjWtpxW Medr+5BMdO6Ak9eTpKxDS2Srpuc5ghFWSeSQ84oElm6hvwZG0YRdeKZJbJrI0bqXRNub Cfpajm8qH7jt7sCQ5s+Qet0j8cEWozUD6cZ2U5UvSUylTSuJo9wkLFTgDHyWIzwTW6Od kPcNAmBErlaKbbMr+M0hepbJ4ggD3wO35SPex4C98qB1Ao/+BLrwcJMeQrnIuXeSSFIn 33Jw== X-Gm-Message-State: AElRT7Hdl8I1qJq/C5vxF8Q1xesiDpIGa0Ye0iN1QXhmF+oW1NVVtddn OGMsJyJaeVPZuvH1g+Cu/rdRVw== X-Google-Smtp-Source: AIpwx48NkP5a93LB3eSl9DqkdXoBolUAsjco7WWWmiIce31KAB7Pe544tIbJluVm2oZjNNDTt6et1A== X-Received: by 10.46.155.1 with SMTP id u1mr1536543lji.130.1522495328899; Sat, 31 Mar 2018 04:22:08 -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.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Mar 2018 04:22:07 -0700 (PDT) From: Marcus Folkesson To: Dmitry Torokhov Cc: Marcus Folkesson , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] input: xpad: avoid using __set_bit() for capabilities Date: Sat, 31 Mar 2018 13:21:40 +0200 Message-Id: <20180331112143.18768-1-marcus.folkesson@gmail.com> X-Mailer: git-send-email 2.16.2 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/xpad.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 9d2688f3f961..cbf54082281d 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -1568,7 +1568,6 @@ static void xpad_close(struct input_dev *dev) static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) { struct usb_xpad *xpad = input_get_drvdata(input_dev); - set_bit(abs, input_dev->absbit); switch (abs) { case ABS_X: @@ -1628,10 +1627,7 @@ static int xpad_init_input(struct usb_xpad *xpad) input_dev->close = xpad_close; } - __set_bit(EV_KEY, input_dev->evbit); - if (!(xpad->mapping & MAP_STICKS_TO_NULL)) { - __set_bit(EV_ABS, input_dev->evbit); /* set up axes */ for (i = 0; xpad_abs[i] >= 0; i++) xpad_set_up_abs(input_dev, xpad_abs[i]); @@ -1639,21 +1635,21 @@ static int xpad_init_input(struct usb_xpad *xpad) /* set up standard buttons */ for (i = 0; xpad_common_btn[i] >= 0; i++) - __set_bit(xpad_common_btn[i], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, xpad_common_btn[i]); /* set up model-specific ones */ if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W || xpad->xtype == XTYPE_XBOXONE) { for (i = 0; xpad360_btn[i] >= 0; i++) - __set_bit(xpad360_btn[i], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, xpad360_btn[i]); } else { for (i = 0; xpad_btn[i] >= 0; i++) - __set_bit(xpad_btn[i], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, xpad_btn[i]); } if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { for (i = 0; xpad_btn_pad[i] >= 0; i++) - __set_bit(xpad_btn_pad[i], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, xpad_btn_pad[i]); } /* @@ -1670,7 +1666,8 @@ static int xpad_init_input(struct usb_xpad *xpad) if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { for (i = 0; xpad_btn_triggers[i] >= 0; i++) - __set_bit(xpad_btn_triggers[i], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, + xpad_btn_triggers[i]); } else { for (i = 0; xpad_abs_triggers[i] >= 0; i++) xpad_set_up_abs(input_dev, xpad_abs_triggers[i]);