linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "zhichang.yuan" <yuanzhichang@hisilicon.com>
To: <catalin.marinas@arm.com>, <will.deacon@arm.com>,
	<robh+dt@kernel.org>, <frowand.list@gmail.com>,
	<bhelgaas@google.com>, <rafael@kernel.org>,
	<mark.rutland@arm.com>, <rjw@rjwysocki.net>, <arnd@arndb.de>,
	<linux-arm-kernel@lists.infradead.org>
Cc: <linux-acpi@vger.kernel.org>, <lorenzo.pieralisi@arm.com>,
	<benh@kernel.crashing.org>, <linux-kernel@vger.kernel.org>,
	<linuxarm@huawei.com>, <devicetree@vger.kernel.org>,
	<linux-pci@vger.kernel.org>, <linux-serial@vger.kernel.org>,
	<minyard@acm.org>, <liviu.dudau@arm.com>, <zourongrong@gmail.com>,
	<john.garry@huawei.com>, <gabriele.paoloni@huawei.com>,
	<zhichang.yuan02@gmail.com>, <kantyzc@163.com>,
	<xuwei5@hisilicon.com>,
	"zhichang.yuan" <yuanzhichang@hisilicon.com>
Subject: [PATCH V7 5/7] ACPI: Delay the enumeration on the devices whose  dependency has not met
Date: Mon, 13 Mar 2017 10:42:41 +0800	[thread overview]
Message-ID: <1489372963-9000-6-git-send-email-yuanzhichang@hisilicon.com> (raw)
In-Reply-To: <1489372963-9000-1-git-send-email-yuanzhichang@hisilicon.com>

In commit 40e7fcb1929(ACPI: Add _DEP support to fix battery issue on Asus
T100TA), the '_DEP' was supported to solve the dependency of Asus battery. But
this patch is specific to Asus battery device.
In the real world, there are other devices which need the dependency to play the
role on the enumeration order. For example, all the Hip06 LPC
periperals(IPMI-BT, uart, etc) must be scanned after the LPC host driver
finished the probing. So, it makes sense to add a checking whether the ACPI
device meet all the dependencies during its enumeration slot, if not, the
enumeration will be delayed till all dependency master finish their work.

This patch adds the dependency checking in ACPI enumeration, also the
corresponding handling to retrigger the Hip06 LPC peripherals' scanning.

Signed-off-by: zhichang.yuan <yuanzhichang@hisilicon.com>
---
 drivers/acpi/battery.c |  3 ---
 drivers/acpi/scan.c    |  3 +++
 drivers/bus/hisi_lpc.c | 12 +++++++++++-
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 4ef1e46..e8d1af1 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -1210,9 +1210,6 @@ static int acpi_battery_add(struct acpi_device *device)
 	if (!device)
 		return -EINVAL;
 
-	if (device->dep_unmet)
-		return -EPROBE_DEFER;
-
 	battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL);
 	if (!battery)
 		return -ENOMEM;
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 1926918..97721b1 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1843,6 +1843,9 @@ static void acpi_bus_attach(struct acpi_device *device)
 	if (device->handler)
 		goto ok;
 
+	if (device->dep_unmet)
+		return;
+
 	if (!device->flags.initialized) {
 		device->flags.power_manageable =
 			device->power.states[ACPI_STATE_D0].flags.valid;
diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c
index 03cf19a..345ea12 100644
--- a/drivers/bus/hisi_lpc.c
+++ b/drivers/bus/hisi_lpc.c
@@ -516,8 +516,18 @@ static int hisilpc_probe(struct platform_device *pdev)
 
 	/*
 	 * It is time to start the children scannings....
+	 * For ACPI children, the corresponding devices will be created after
+	 * retriggering the ACPI scanning by removing the dependency blocking.
 	 */
-	if (!has_acpi_companion(dev)) {
+	if (has_acpi_companion(dev)) {
+		struct acpi_device *adev;
+
+		adev = to_acpi_device_node(dev->fwnode);
+		if (!adev)
+			ret = -ENODEV;
+		else
+			acpi_walk_dep_device_list(adev->handle);
+	} else {
 		ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
 		if (ret)
 			dev_err(dev, "OF: enumerate LPC bus fail(%d)\n", ret);
-- 
1.9.1

  parent reply	other threads:[~2017-03-13  2:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13  2:42 [PATCH V7 0/7] LPC: legacy ISA I/O support zhichang.yuan
2017-03-13  2:42 ` [PATCH V7 1/7] LIBIO: Introduce a generic PIO mapping method zhichang.yuan
2017-03-13  2:42 ` [PATCH V7 2/7] PCI: Apply the new generic I/O management on PCI IO hosts zhichang.yuan
2017-03-27 19:46   ` dann frazier
2017-03-13  2:42 ` [PATCH V7 3/7] OF: Add missing I/O range exception for indirect-IO devices zhichang.yuan
2017-03-13  2:42 ` [PATCH V7 4/7] LPC: Support the device-tree LPC host on Hip06/Hip07 zhichang.yuan
2017-03-13  2:42 ` zhichang.yuan [this message]
2017-03-13 21:24   ` [PATCH V7 5/7] ACPI: Delay the enumeration on the devices whose dependency has not met Rafael J. Wysocki
2017-03-14  8:14     ` Gabriele Paoloni
2017-03-16  2:21     ` zhichang.yuan
2017-03-16 10:13       ` Arnd Bergmann
2017-03-16 14:56         ` zhichang.yuan
2017-03-16 16:13         ` Gabriele Paoloni
2017-03-24  0:23           ` Gabriele Paoloni
2017-03-14  5:11   ` kbuild test robot
2017-03-14  6:10   ` kbuild test robot
2017-03-13  2:42 ` [PATCH V7 6/7] LIBIO: Support the dynamically logical PIO registration of ACPI host I/O zhichang.yuan
2017-03-14  4:27   ` kbuild test robot
2017-03-14  5:10   ` kbuild test robot
2017-03-13  2:42 ` [PATCH V7 7/7] LPC: Add the ACPI LPC support zhichang.yuan
2017-03-14  5:25   ` kbuild test robot
2017-03-14  8:39 ` [PATCH V7 0/7] LPC: legacy ISA I/O support Arnd Bergmann
2017-03-15  4:05   ` zhichang.yuan
2017-03-15 13:23     ` Arnd Bergmann

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=1489372963-9000-6-git-send-email-yuanzhichang@hisilicon.com \
    --to=yuanzhichang@hisilicon.com \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=gabriele.paoloni@huawei.com \
    --cc=john.garry@huawei.com \
    --cc=kantyzc@163.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liviu.dudau@arm.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=minyard@acm.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=robh+dt@kernel.org \
    --cc=will.deacon@arm.com \
    --cc=xuwei5@hisilicon.com \
    --cc=zhichang.yuan02@gmail.com \
    --cc=zourongrong@gmail.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).