All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI / scan: Allow ACPI drivers to bind to PNP device objects
@ 2014-08-21  4:04 Rafael J. Wysocki
  2014-08-21 12:08 ` Zhang Rui
  2014-08-24  7:06 ` Zhang Rui
  0 siblings, 2 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2014-08-21  4:04 UTC (permalink / raw)
  To: ACPI Devel Maling List
  Cc: Linux Kernel Mailing List, Zhang Rui, Gabriele Mazzotta,
	Dirk Griesbach, Matthew Garrett

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

We generally don't allow ACPI drivers to bind to ACPI device objects
that companion "physical" device objects are created for to avoid
situations in which two different drivers may attempt to handle one
device at the same time.  Recent ACPI device enumeration rework
extended that approach to ACPI PNP devices by starting to use a scan
handler for enumerating them.  However, we previously allowed ACPI
drivers to bind to ACPI device objects with existing PNP device
companions and changing that led to functional regressions on some
systems.

For this reason, add a special check for PNP devices in
acpi_device_probe() so that ACPI drivers can bind to ACPI device
objects having existing PNP device companions as before.

Fixes: eec15edbb0e1 (ACPI / PNP: use device ID list for PNPACPI device enumeration)
Link: https://bugzilla.kernel.org/show_bug.cgi?id=81511
Link: https://bugzilla.kernel.org/show_bug.cgi?id=81971
Reported-and-tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Reported-and-tested-by: Dirk Griesbach <spamthis@freenet.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/acpi_pnp.c |    5 +++++
 drivers/acpi/internal.h |    1 +
 drivers/acpi/scan.c     |    2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

Index: linux-pm/drivers/acpi/acpi_pnp.c
===================================================================
--- linux-pm.orig/drivers/acpi/acpi_pnp.c
+++ linux-pm/drivers/acpi/acpi_pnp.c
@@ -396,3 +396,8 @@ void __init acpi_pnp_init(void)
 {
 	acpi_scan_add_handler(&acpi_pnp_handler);
 }
+
+bool is_acpi_pnp_device(struct acpi_device *adev)
+{
+	return adev->handler == &acpi_pnp_handler;
+}
Index: linux-pm/drivers/acpi/internal.h
===================================================================
--- linux-pm.orig/drivers/acpi/internal.h
+++ linux-pm/drivers/acpi/internal.h
@@ -86,6 +86,7 @@ void acpi_device_add_finalize(struct acp
 void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
 bool acpi_device_is_present(struct acpi_device *adev);
 bool acpi_device_is_battery(struct acpi_device *adev);
+bool is_acpi_pnp_device(struct acpi_device *adev);
 
 /* --------------------------------------------------------------------------
                                   Power Resource
Index: linux-pm/drivers/acpi/scan.c
===================================================================
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -975,7 +975,7 @@ static int acpi_device_probe(struct devi
 	struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver);
 	int ret;
 
-	if (acpi_dev->handler)
+	if (acpi_dev->handler && !is_acpi_pnp_device(acpi_dev))
 		return -EINVAL;
 
 	if (!acpi_drv->ops.add)

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-09-08 22:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-21  4:04 [PATCH] ACPI / scan: Allow ACPI drivers to bind to PNP device objects Rafael J. Wysocki
2014-08-21 12:08 ` Zhang Rui
2014-08-21 16:36   ` Rafael J. Wysocki
2014-08-21 17:10   ` Rafael J. Wysocki
2014-08-22  2:00     ` Zhang Rui
2014-08-22 17:53       ` Rafael J. Wysocki
2014-08-23 15:21         ` Zhang Rui
2014-09-08 22:14           ` Rafael J. Wysocki
2014-09-08 22:32             ` Darren Hart
2014-08-24  7:06 ` Zhang Rui
2014-08-25 22:25   ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.