Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4381103ybf; Wed, 4 Mar 2020 02:53:20 -0800 (PST) X-Google-Smtp-Source: ADFU+vu5ixBIsmCPtXZviG+hBNWIk2cY/CiIE1D+qHgVQZIT2lU0ADuuv4jOrCmD4GpUj50i8OWr X-Received: by 2002:a9d:1d2:: with SMTP id e76mr1713575ote.223.1583319200263; Wed, 04 Mar 2020 02:53:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583319200; cv=none; d=google.com; s=arc-20160816; b=z0ZTGBiNPr3svQYc978mMKHb1UP2rdvRI1etkeKQaacvMcR8yZaNQDA+dw4ksNNNjq fykM1Rsgnvb16bR2Q1zexQFrcbSh3qm3T3+jfZp0l5Qhoel8gwFuWw4IATkVWB9+v6X5 i3X6bBcoLeGPkbuOB6MOT1nNkIFs8iHglvtVD1pC4oIWhs+dM90DECefsu5sXFBJLuRG 4T9LdB526fbTfz68Hjck9+GOkWN7yzFyagYeJ/PzIk0m5JnRQZvMQ3iRgj4BAB/R7kFq EpG8593RCnoZCTJop+l0GVR+hI1/xrUgPexDy5YGOPalWpVcsEsH8V4E1n4arTmmZ7Js 4e5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=03Pn1322ZmHxko06iVoLaS9ak/dMpVjSFbBkPb2ZDg4=; b=NdgFSgYud7sGSNPKSB1ZPhVj4XBnBhJFHF+H9j0Ho0DFy7IOEHekf5VRouzyS38pRo 0HkBVxlduBJYWGfFYrlEalV7Tv7fKBnWh/0QbCJKLJ+jj2/MfEqjRvw0cotzgmonCDDL BFlMU+heupnuiE7LQL6ONvxXzsIzSqrM4bJ7tyyCUzlB9dXdADW+ljOIH73G1znQ4WtR gUvXcesmRjVqcegHj7pl/DLci0TZKSpuXTxvWXAaE1lZE/q99lgY+CVaKC+YYHMKuC2c s+p/C/xZbgyJwCtA7XmVrFhdepAur27tsU9Q0ZKfcoyQRKiN6wmvjVHtIgav9iDfIGRz gY2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si852938otm.256.2020.03.04.02.53.08; Wed, 04 Mar 2020 02:53:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387921AbgCDKw6 (ORCPT + 99 others); Wed, 4 Mar 2020 05:52:58 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:64488 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387888AbgCDKw5 (ORCPT ); Wed, 4 Mar 2020 05:52:57 -0500 Received: from 79.184.237.41.ipv4.supernova.orange.pl (79.184.237.41) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.341) id 208bb65062888295; Wed, 4 Mar 2020 11:52:55 +0100 From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , "Rafael J. Wysocki" , Daniel Drake , Jian-Hong Pan Subject: [PATCH v2 2/6] ACPI: EC: Avoid passing redundant argument to functions Date: Wed, 04 Mar 2020 11:45:41 +0100 Message-ID: <2707424.uHLvDKgFoG@kreacher> In-Reply-To: <2411774.6kdisLRoUK@kreacher> References: <2094703.CetWLLyMuz@kreacher> <2411774.6kdisLRoUK@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Rafael J. Wysocki" After commit 406857f773b0 ("ACPI: EC: add support for hardware-reduced systems") the handle_events argument passed to ec_install_handlers() and acpi_ec_setup() is redundant, because it is always 'false' when the device argument passed to them in NULL and it is always 'true' otherwise, so the device argument can be tested against NULL instead of testing the handle_events one. Accordingly, modify ec_install_handlers() and acpi_ec_setup() to take two arguments and reduce the number of checks in the former. Signed-off-by: Rafael J. Wysocki --- -> v2: No changes. --- drivers/acpi/ec.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 2dc7cf2aeb21..3153e7684053 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -1476,8 +1476,7 @@ static int install_gpio_irq_event_handler(struct acpi_ec *ec, * handler is not installed, which means "not able to handle * transactions". */ -static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device, - bool handle_events) +static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device) { acpi_status status; @@ -1507,7 +1506,7 @@ static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device, set_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags); } - if (!handle_events) + if (!device) return 0; if (!test_bit(EC_FLAGS_QUERY_METHODS_INSTALLED, &ec->flags)) { @@ -1520,13 +1519,10 @@ static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device, if (!test_bit(EC_FLAGS_EVENT_HANDLER_INSTALLED, &ec->flags)) { if (ec->gpe >= 0) { install_gpe_event_handler(ec); - } else if (device) { + } else { int ret = install_gpio_irq_event_handler(ec, device); - if (ret) return ret; - } else { /* No GPE and no GpioInt? */ - return -ENODEV; } } /* EC is fully operational, allow queries */ @@ -1574,12 +1570,11 @@ static void ec_remove_handlers(struct acpi_ec *ec) } } -static int acpi_ec_setup(struct acpi_ec *ec, struct acpi_device *device, - bool handle_events) +static int acpi_ec_setup(struct acpi_ec *ec, struct acpi_device *device) { int ret; - ret = ec_install_handlers(ec, device, handle_events); + ret = ec_install_handlers(ec, device); if (ret) return ret; @@ -1660,7 +1655,7 @@ static int acpi_ec_add(struct acpi_device *device) } } - ret = acpi_ec_setup(ec, device, true); + ret = acpi_ec_setup(ec, device); if (ret) goto err_query; @@ -1780,7 +1775,7 @@ void __init acpi_ec_dsdt_probe(void) * At this point, the GPE is not fully initialized, so do not to * handle the events. */ - ret = acpi_ec_setup(ec, NULL, false); + ret = acpi_ec_setup(ec, NULL); if (ret) { acpi_ec_free(ec); return; @@ -1967,7 +1962,7 @@ void __init acpi_ec_ecdt_probe(void) * At this point, the namespace is not initialized, so do not find * the namespace objects, or handle the events. */ - ret = acpi_ec_setup(ec, NULL, false); + ret = acpi_ec_setup(ec, NULL); if (ret) { acpi_ec_free(ec); return; -- 2.16.4