diff mbox

ACPI: do not match devices that have scan handler

Message ID 51AD79B6.6060902@intel.com (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Aaron Lu June 4, 2013, 5:23 a.m. UTC
With the introduction of acpi scan handler, an acpi device that has acpi
scan handler does not need an acpi driver any more. For those devices,
there is no meaning to match them against a newly registered acpi driver
in acpi_bus_match.

This can also solve a regression caused by a broken BIOS table, where it
has defined a _ROM method under PCI root. The video module would think
devices that have _ROM defined under it is a display controller device
since only display devices would have _ROM method defined according to
the ACPI SPEC. As a resule, this method under PCI root would make video
module tries to drive PCI root acpi device and the pre-assigned
driver_data by PCI root's scan handler will be emptied, making subsequent
call to acpi_get_pci_dev fail.

Buglink:https://bugzilla.kernel.org/show_bug.cgi?id=58091
Reported-by: Jason Cassell <bluesloth600@gmail.com>
Reported-and-bisected-by: Dmitry S. Demin <dmitryy.demin@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
---
 drivers/acpi/scan.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 5e7e991..67ce501 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -553,6 +553,12 @@  static int acpi_bus_match(struct device *dev, struct device_driver *drv)
 	struct acpi_device *acpi_dev = to_acpi_device(dev);
 	struct acpi_driver *acpi_drv = to_acpi_driver(drv);
 
+	/* No need to bind driver for devices that have scan handler */
+	if (acpi_dev->handler)
+		return 0;
+
+	WARN_ON(acpi_dev->driver_data);
+
 	return acpi_dev->flags.match_driver
 		&& !acpi_match_device_ids(acpi_dev, acpi_drv->ids);
 }