mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Luck, Tony" <tony.luck@intel.com>,
	Toshi Kani <toshi.kani@hp.com>, Aaron Lu <aaron.lu@intel.com>
Subject: [PATCH 1/5] ACPI / scan: Do not bind ACPI drivers to objects with scan handlers
Date: Thu, 13 Jun 2013 01:23:48 +0200	[thread overview]
Message-ID: <2446620.VEz51x3fQo@vostro.rjw.lan> (raw)
In-Reply-To: <1417592.vuSG0cUIGo@vostro.rjw.lan>

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

ACPI drivers generally should not be bound to device objects having
scan handlers attatched to them.

However, there is one exception which is the container scan handler.
Namely, it turns out that some BIOSes (on ia64 HP rx2600 in
particular) put container device IDs into the same objects along with
some other more specific ones which makes those device objects match
the container scan handler as well as some other scan handlers or
ACPI drivers.  Fortunately, though, the container scan handler is
only needed for hotplug to work and it doesn't actually do anything
to the device objects in question, so it is really OK to have both
the container scan handler and something else attached to the same
device object at the same time.

Following that, make acpi_device_probe() fail with -EINVAL if the
device object being probed has an ACPI scan handler that is not the
container scan handler attached to it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/container.c |    5 +++--
 drivers/acpi/internal.h  |   10 ++++++++++
 drivers/acpi/scan.c      |    4 ++++
 drivers/acpi/video.c     |    3 ---
 4 files changed, 17 insertions(+), 5 deletions(-)

Index: linux-pm/drivers/acpi/container.c
===================================================================
--- linux-pm.orig/drivers/acpi/container.c
+++ linux-pm/drivers/acpi/container.c
@@ -51,7 +51,7 @@ static int container_device_attach(struc
 	return 1;
 }
 
-static struct acpi_scan_handler container_handler = {
+struct acpi_scan_handler container_scan_handler = {
 	.ids = container_device_ids,
 	.attach = container_device_attach,
 	.hotplug = {
@@ -62,5 +62,6 @@ static struct acpi_scan_handler containe
 
 void __init acpi_container_init(void)
 {
-	acpi_scan_add_handler_with_hotplug(&container_handler, "container");
+	acpi_scan_add_handler_with_hotplug(&container_scan_handler,
+					   "container");
 }
Index: linux-pm/drivers/acpi/internal.h
===================================================================
--- linux-pm.orig/drivers/acpi/internal.h
+++ linux-pm/drivers/acpi/internal.h
@@ -37,8 +37,18 @@ void acpi_processor_init(void);
 void acpi_platform_init(void);
 int acpi_sysfs_init(void);
 #ifdef CONFIG_ACPI_CONTAINER
+extern struct acpi_scan_handler container_scan_handler;
+
+static inline struct acpi_scan_handler *acpi_container_scan_handler(void)
+{
+	return &container_scan_handler;
+}
 void acpi_container_init(void);
 #else
+static inline struct acpi_scan_handler *acpi_container_scan_handler(void)
+{
+	return NULL;
+}
 static inline void acpi_container_init(void) {}
 #endif
 #ifdef CONFIG_ACPI_HOTPLUG_MEMORY
Index: linux-pm/drivers/acpi/scan.c
===================================================================
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -939,6 +939,10 @@ static int acpi_device_probe(struct devi
 	struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver);
 	int ret;
 
+	if (acpi_dev->handler
+	    && acpi_dev->handler != acpi_container_scan_handler())
+		return -EINVAL;
+
 	if (!acpi_drv->ops.add)
 		return -ENOSYS;
 
Index: linux-pm/drivers/acpi/video.c
===================================================================
--- linux-pm.orig/drivers/acpi/video.c
+++ linux-pm/drivers/acpi/video.c
@@ -1722,9 +1722,6 @@ static int acpi_video_bus_add(struct acp
 	int error;
 	acpi_status status;
 
-	if (device->handler)
-		return -EINVAL;
-
 	status = acpi_walk_namespace(ACPI_TYPE_DEVICE,
 				device->parent->handle, 1,
 				acpi_video_bus_match, NULL,


  reply	other threads:[~2013-06-12 23:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-12 23:23 [PATCH 0/5] ACPI / scan: Make it possible to use the container hotplug with other " Rafael J. Wysocki
2013-06-12 23:23 ` Rafael J. Wysocki [this message]
2013-06-12 23:24 ` [PATCH 2/5] ACPI / scan: Separate hotplug profiles from " Rafael J. Wysocki
2013-06-12 23:25 ` [PATCH 3/5] ACPI / scan: Add hotplug profile pointer to struct acpi_device Rafael J. Wysocki
2013-06-12 23:26 ` [PATCH 4/5] ACPI / scan: Use container hotplug profile for matching device objects Rafael J. Wysocki
2013-06-12 23:26 ` [PATCH 5/5] ACPI / ia64 / sba_iommu: Use ACPI scan handler for discovery Rafael J. Wysocki
2013-06-13 21:28 ` [PATCH 0/5] ACPI / scan: Make it possible to use the container hotplug with other scan handlers Toshi Kani
2013-06-13 22:13   ` Rafael J. Wysocki
2013-06-13 22:23     ` Toshi Kani
2013-06-14 18:01       ` Luck, Tony
2013-06-14 22:23         ` Rafael J. Wysocki
2013-06-14 22:32           ` Tony Luck
2013-06-14 23:20             ` Rafael J. Wysocki
2013-06-19 17:37               ` Tony Luck
2013-06-19 22:24                 ` Rafael J. Wysocki
2013-06-19 22:40                   ` Tony Luck
2013-06-19 22:51                     ` Rafael J. Wysocki
2013-06-19 23:22                   ` Toshi Kani
2013-06-19 23:35                     ` 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=2446620.VEz51x3fQo@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=aaron.lu@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=toshi.kani@hp.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

all inboxes | Powered by JetHome®