linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: Erik Schmauss <erik.schmauss@intel.com>,
	Zhang Rui <rui.zhang@intel.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH v2 4/5] ACPI: EC: Eliminate acpi_config_boot_ec()
Date: Fri, 01 Feb 2019 11:01:19 +0100	[thread overview]
Message-ID: <2942976.lheXMQXGOb@aspire.rjw.lan> (raw)
In-Reply-To: <2804781.zocuRj5ZkX@aspire.rjw.lan>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Notice that acpi_ec_add() calls acpi_config_boot_ec() when it finds
that the device object passed to it represents a "boot" EC, but in
that case the ec pointer passed to acpi_config_boot_ec() is guaranteed
to be equal to boot_ec and ec->handle is passed as the handle
argument to it, so acpi_config_boot_ec() really only calls
acpi_ec_setup() and prints a message.

Avoid the pointless checks in acpi_config_boot_ec() by calling
acpi_ec_setup() directly and print the message separately.

With the above changes in place, there are no users of
acpi_config_boot_ec(), so drop it.

No intentional functional impact except for a changed message.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/ec.c |   54 ++++++++----------------------------------------------
 1 file changed, 8 insertions(+), 46 deletions(-)

Index: linux-pm/drivers/acpi/ec.c
===================================================================
--- linux-pm.orig/drivers/acpi/ec.c
+++ linux-pm/drivers/acpi/ec.c
@@ -1541,49 +1541,6 @@ static int acpi_ec_setup(struct acpi_ec
 	return ret;
 }
 
-static int acpi_config_boot_ec(struct acpi_ec *ec, acpi_handle handle,
-			       bool handle_events, bool is_ecdt)
-{
-	int ret;
-
-	/*
-	 * Changing the ACPI handle results in a re-configuration of the
-	 * boot EC. And if it happens after the namespace initialization,
-	 * it causes _REG evaluations.
-	 */
-	if (boot_ec && boot_ec->handle != handle)
-		ec_remove_handlers(boot_ec);
-
-	/* Unset old boot EC */
-	if (boot_ec != ec)
-		acpi_ec_free(boot_ec);
-
-	/*
-	 * ECDT device creation is split into acpi_ec_ecdt_probe() and
-	 * acpi_ec_ecdt_start(). This function takes care of completing the
-	 * ECDT parsing logic as the handle update should be performed
-	 * between the installation/uninstallation of the handlers.
-	 */
-	if (ec->handle != handle)
-		ec->handle = handle;
-
-	ret = acpi_ec_setup(ec, handle_events);
-	if (ret)
-		return ret;
-
-	/* Set new boot EC */
-	if (!boot_ec) {
-		boot_ec = ec;
-		boot_ec_is_ecdt = is_ecdt;
-	}
-
-	acpi_handle_info(boot_ec->handle,
-			 "Used as boot %s EC to handle transactions%s\n",
-			 is_ecdt ? "ECDT" : "DSDT",
-			 handle_events ? " and events" : "");
-	return ret;
-}
-
 static bool acpi_ec_ecdt_get_handle(acpi_handle *phandle)
 {
 	struct acpi_table_ecdt *ecdt_ptr;
@@ -1651,12 +1608,17 @@ static int acpi_ec_add(struct acpi_devic
 			acpi_ec_free(ec);
 			ec = boot_ec;
 		}
-		ret = acpi_config_boot_ec(ec, ec->handle, true, is_ecdt);
-	} else
-		ret = acpi_ec_setup(ec, true);
+	}
+
+	ret = acpi_ec_setup(ec, true);
 	if (ret)
 		goto err_query;
 
+	if (boot_ec)
+		acpi_handle_info(boot_ec->handle,
+				 "Boot %s EC used to handle transactions and events\n",
+				 is_ecdt ? "ECDT" : "DSDT");
+
 	device->driver_data = ec;
 
 	ret = !!request_region(ec->data_addr, 1, "EC data");


  parent reply	other threads:[~2019-02-01 10:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 11:55 [PATCH 0/2] ACPI: EC: Simplify boot EC setup Rafael J. Wysocki
2019-01-22 11:56 ` [PATCH 1/2] ACPI: EC: Untangle " Rafael J. Wysocki
2019-01-22 11:57 ` [PATCH 1/2] ACPI: EC: Simplify boot EC checks in acpi_ec_add() Rafael J. Wysocki
2019-01-22 12:03   ` Rafael J. Wysocki
2019-02-01  9:56 ` [PATCH v2 0/5] ACPI: EC: Simplify boot EC setup Rafael J. Wysocki
2019-02-01  9:57   ` [PATCH v2 1/5] ACPI: EC: Declare boot_ec as static Rafael J. Wysocki
2019-02-01  9:58   ` [PATCH v2 2/5] ACPI: EC: Make acpi_ec_ecdt_probe() more straightforward Rafael J. Wysocki
2019-02-01  9:59   ` [PATCH v2 3/5] ACPI: EC: Make acpi_ec_dsdt_probe() " Rafael J. Wysocki
2019-02-01 10:01   ` Rafael J. Wysocki [this message]
2019-02-01 11:47     ` [PATCH v3 4/5] ACPI: EC: Eliminate acpi_config_boot_ec() Rafael J. Wysocki
2019-02-01 10:03   ` [PATCH v2 5/5] ACPI: EC: Simplify boot EC checks in acpi_ec_add() Rafael J. Wysocki
2019-02-01 11:50     ` [PATCH v3 " Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2942976.lheXMQXGOb@aspire.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=erik.schmauss@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).