From patchwork Mon Aug 6 20:38:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 10557947 X-Patchwork-Delegate: andy.shevchenko@gmail.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BC9A139A for ; Mon, 6 Aug 2018 20:38:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8937528DA9 for ; Mon, 6 Aug 2018 20:38:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D61F2913D; Mon, 6 Aug 2018 20:38:35 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 21BEE28DA9 for ; Mon, 6 Aug 2018 20:38:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730220AbeHFWtT (ORCPT ); Mon, 6 Aug 2018 18:49:19 -0400 Received: from gateway22.websitewelcome.com ([192.185.47.168]:12702 "EHLO gateway22.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729818AbeHFWtT (ORCPT ); Mon, 6 Aug 2018 18:49:19 -0400 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 6EFB224887 for ; Mon, 6 Aug 2018 15:38:33 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id mmGvf7MSFBcCXmmGvfhgJm; Mon, 06 Aug 2018 15:38:33 -0500 X-Authority-Reason: nr=8 Received: from [189.250.50.82] (port=35826 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1fmmGu-001Duo-ST; Mon, 06 Aug 2018 15:38:32 -0500 Date: Mon, 6 Aug 2018 15:38:32 -0500 From: "Gustavo A. R. Silva" To: "Lee, Chun-Yi" , Darren Hart , Andy Shevchenko , Joe Perches , David Laight Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH v2] platform/x86: acer-wmi: refactor function has_cap Message-ID: <20180806203832.GA11751@embeddedor.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.250.50.82 X-Source-L: No X-Exim-ID: 1fmmGu-001Duo-ST X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.250.50.82]:35826 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 21 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Refactor function has_cap in order to avoid returning integer values, when instead it should return booleans. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva Reviewed-by: "Lee, Chun-Yi" --- Changes in v2: Remove parentheses and unnecessary code. Thank you all for the feedback! drivers/platform/x86/acer-wmi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 8952173..3294bb2 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -672,10 +672,7 @@ static void __init find_quirks(void) static bool has_cap(u32 cap) { - if ((interface->capability & cap) != 0) - return 1; - - return 0; + return interface->capability & cap; } /*