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 1/2] ACPI: EC: Simplify boot EC checks in acpi_ec_add()
Date: Tue, 22 Jan 2019 12:57:28 +0100	[thread overview]
Message-ID: <6098592.dL5p0bd45o@aspire.rjw.lan> (raw)
In-Reply-To: <2897234.rJkq6cDEjt@aspire.rjw.lan>

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

Consolidate boot EC checks in acpi_ec_add(), put the acpi_is_boot_ec()
checks directly into it and drop the latter.

No intentional functional impact.

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

Index: linux-pm/drivers/acpi/ec.c
===================================================================
--- linux-pm.orig/drivers/acpi/ec.c
+++ linux-pm/drivers/acpi/ec.c
@@ -1558,16 +1558,6 @@ static bool acpi_ec_ecdt_get_handle(acpi
 	return true;
 }
 
-static bool acpi_is_boot_ec(struct acpi_ec *ec)
-{
-	if (!boot_ec)
-		return false;
-	if (ec->command_addr == boot_ec->command_addr &&
-	    ec->data_addr == boot_ec->data_addr)
-		return true;
-	return false;
-}
-
 static int acpi_ec_add(struct acpi_device *device)
 {
 	struct acpi_ec *ec = NULL;
@@ -1579,22 +1569,22 @@ static int acpi_ec_add(struct acpi_devic
 	strcpy(acpi_device_class(device), ACPI_EC_CLASS);
 
 	if (!strcmp(acpi_device_hid(device), ACPI_ECDT_HID)) {
-		is_ecdt = true;
 		ec = boot_ec;
+		boot_ec_is_ecdt = true;
+		is_ecdt = true;
 	} else {
 		ec = acpi_ec_alloc();
 		if (!ec)
 			return -ENOMEM;
+
 		status = ec_parse_device(device->handle, 0, ec, NULL);
 		if (status != AE_CTRL_TERMINATE) {
 			ret = -EINVAL;
 			goto err_alloc;
 		}
-	}
 
-	if (acpi_is_boot_ec(ec)) {
-		boot_ec_is_ecdt = is_ecdt;
-		if (!is_ecdt) {
+		if (boot_ec && ec->command_addr == boot_ec->command_addr &&
+		    ec->data_addr == boot_ec->data_addr) {
 			/*
 			 * Trust PNP0C09 namespace location rather than
 			 * ECDT ID. But trust ECDT GPE rather than _GPE


  parent reply	other threads:[~2019-01-22 12:00 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 ` Rafael J. Wysocki [this message]
2019-01-22 12:03   ` [PATCH 1/2] ACPI: EC: Simplify boot EC checks in acpi_ec_add() 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   ` [PATCH v2 4/5] ACPI: EC: Eliminate acpi_config_boot_ec() Rafael J. Wysocki
2019-02-01 11:47     ` [PATCH v3 " 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=6098592.dL5p0bd45o@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).