Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1608017ybf; Thu, 27 Feb 2020 14:25:49 -0800 (PST) X-Google-Smtp-Source: APXvYqw/yANudUprbI63xaDXosAgj12RncEu8G5wWOrbVtU0hWmTqQ6H8YpXls2WqsYVUws+7CvO X-Received: by 2002:aca:5303:: with SMTP id h3mr907821oib.109.1582842349521; Thu, 27 Feb 2020 14:25:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582842349; cv=none; d=google.com; s=arc-20160816; b=oNbfWFHNXWvvlIvQFceCU9bNbeBkFAedSVmENb7VXK4K6/EwYw4yMNMMOu0YkGWcka Wu5Qj7haI9s/CF1Hd7HYAyvmli6VqaC0dLireIMrNOa31JfxtBmtS5xCxLzeB0l1Gnt+ 37/yvlDJjQe4QironlbdDxh/1JxxCml1AjZ5FKLzvFRajmd7HJFJ6AKyWZ5oX3/jCtA2 1/+/k07PXca7GE59UxeCBqVCS3tHPaZYJmAFvewTjt4S4AKe1iPSivpPF7eOstzxVx88 LGr3XCgV1FCtce3rzkSssLG8I7bRASNxlxsyHw0j0xhidvDGdYO9XosEuBeDvyFsl+o5 jLnA== 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=5IdqTExQLbDFIZQpUkIQQJHtFCaq13zh1+Tt6E2uCvE=; b=A2oKuRiOGLWbjPmoyH+d/2XTSIn2NRr/YRffecpF7JosqmtOyu9Xy4bsd2WMTz2YTy p+GtV/6HqOZvst64ONpfo8P9bV+3qoIdTMz93TApDbMB1pQ+OZryEkMBM9+XII+w1qM/ PsonInLR+4xNXTGrbR8Ju297EguD116woKEmLLQIPXUPZC8T/bZq9WDA1rXjuGcK8BKE PF9YUyLklFUIq/90sGPclXdmboG093mdLkB08+hTPJFqlS50eZF6eh4qxrXE8h3S8mD3 rBAgEnmojsSpRzGYnYXHb9MKhTOw4zSZZidtJR2PC5T7ECKu0aY2jQF8pE3CK0r5X9gD 4u5A== 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 j5si343714otk.75.2020.02.27.14.25.37; Thu, 27 Feb 2020 14:25:49 -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 S1730230AbgB0WZX (ORCPT + 99 others); Thu, 27 Feb 2020 17:25:23 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:48801 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730149AbgB0WZV (ORCPT ); Thu, 27 Feb 2020 17:25:21 -0500 Received: from 79.184.237.30.ipv4.supernova.orange.pl (79.184.237.30) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.341) id 9b9385bd0b22e106; Thu, 27 Feb 2020 23:25:19 +0100 From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , "Rafael J. Wysocki" , Daniel Drake Subject: [PATCH 2/6] ACPI: EC: Avoid passing redundant argument to functions Date: Thu, 27 Feb 2020 23:21:54 +0100 Message-ID: <5654004.QtEQyb3NJZ@kreacher> In-Reply-To: <2094703.CetWLLyMuz@kreacher> References: <2094703.CetWLLyMuz@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 --- 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