linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Lee, Chun-Yi" <joeyli.kernel@gmail.com>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Lee,
	Chun-Yi" <jlee@suse.com>, Michal Hocko <mhocko@suse.com>,
	Jiri Kosina <jkosina@suse.cz>
Subject: [PATCH] acpi: check the online state of all children in container
Date: Wed, 22 Mar 2017 09:01:48 +0800	[thread overview]
Message-ID: <20170322010148.32675-1-jlee@suse.com> (raw)

Just checking the state of container is not enough to confirm that
the whole container is offlined. Kernel should checks all children's
offline state as the logic in acpi_container_offline().

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
---
 drivers/acpi/scan.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 1926918..f08ca31 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -260,13 +260,15 @@ static int acpi_scan_try_to_offline(struct acpi_device *device)
 static int acpi_scan_hot_remove(struct acpi_device *device)
 {
 	acpi_handle handle = device->handle;
+	struct acpi_device *child;
 	unsigned long long sta;
 	acpi_status status;
 
 	if (device->handler && device->handler->hotplug.demand_offline
 	    && !acpi_force_hot_remove) {
-		if (!acpi_scan_is_offline(device, true))
-			return -EBUSY;
+		list_for_each_entry(child, &device->children, node)
+			if (!acpi_scan_is_offline(child, false))
+				return -EBUSY;
 	} else {
 		int error = acpi_scan_try_to_offline(device);
 		if (error)
-- 
2.10.2

             reply	other threads:[~2017-03-22  1:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22  1:01 Lee, Chun-Yi [this message]
2017-03-22  0:58 ` [PATCH] acpi: check the online state of all children in container Rafael J. Wysocki
2017-03-22  3:01   ` joeyli

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=20170322010148.32675-1-jlee@suse.com \
    --to=joeyli.kernel@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=jlee@suse.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=rjw@rjwysocki.net \
    /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).