public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: do not match devices that have scan handler
       [not found] <51AC9389.3050603@intel.com>
@ 2013-06-04  5:23 ` Aaron Lu
  2013-06-06  2:54   ` [PATCH v2] ACPI / scan: do not match drivers against objects having scan handlers Aaron Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Lu @ 2013-06-04  5:23 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: ACPI Devel Mailing List, Len Brown, Aaron Lu, Zhang Rui

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 --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);
 }
-- 
1.8.3.3.gfada522


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

* [PATCH v2] ACPI / scan: do not match drivers against objects having scan handlers
  2013-06-04  5:23 ` [PATCH] ACPI: do not match devices that have scan handler Aaron Lu
@ 2013-06-06  2:54   ` Aaron Lu
  2013-06-06 10:56     ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Lu @ 2013-06-06  2:54 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: ACPI Devel Mailing List, Len Brown, Zhang Rui, Jason Cassell,
	Dmitry S. Demin, Lan Tianyu

With the introduction of ACPI scan handlers, an ACPI device object
with an ACPI scan handler attached to it must not be bound to an ACPI
driver any more.  Therefore it doesn't make sense to match those
ACPI device objects against a newly registered ACPI driver in
acpi_bus_match(), so make that function return 0 if the device
object passed to it has an ACPI scan handler attached.

This also addresses a regression related to a broken ACPI table in
the BIOS, where it has defined a _ROM method under the PCI root
bridge object.  This causes the video module to treat that object
as a display controller device (since only display devices are
supposed to have a _ROM method defined according to the ACPI spec).
As a result, the ACPI video driver binds to the PCI root bridge
object and overwrites the previously assigned driver_data field of
it, causing subsequent calls to acpi_get_pci_dev() to fail.

[rjw: Subject and changelog]
References: https://bugzilla.kernel.org/show_bug.cgi?id=58091
Reported-and-tested-by: Jason Cassell <bluesloth600@gmail.com>
Reported-bisected-and-tested-by: Dmitry S. Demin <dmitryy.demin@gmail.com>
Cc: 3.9+ <stable@kernel.org>
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
---
v2:
Remove WARN_ON as it would cause unnecessary warnings for devices that
already have drivers bound.

drivers/acpi/scan.c | 6 ++++++
 1 file changed, 6 insertions(+)

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,10 @@ 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);
 
+	/* Skip ACPI device objects with scan handlers attached. */
+	if (acpi_dev->handler)
+		return 0;
+
 	return acpi_dev->flags.match_driver
 		&& !acpi_match_device_ids(acpi_dev, acpi_drv->ids);
 }

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

* Re: [PATCH v2] ACPI / scan: do not match drivers against objects having scan handlers
  2013-06-06  2:54   ` [PATCH v2] ACPI / scan: do not match drivers against objects having scan handlers Aaron Lu
@ 2013-06-06 10:56     ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2013-06-06 10:56 UTC (permalink / raw)
  To: Aaron Lu
  Cc: ACPI Devel Mailing List, Len Brown, Zhang Rui, Jason Cassell,
	Dmitry S. Demin, Lan Tianyu

On Thursday, June 06, 2013 10:54:52 AM Aaron Lu wrote:
> With the introduction of ACPI scan handlers, an ACPI device object
> with an ACPI scan handler attached to it must not be bound to an ACPI
> driver any more.  Therefore it doesn't make sense to match those
> ACPI device objects against a newly registered ACPI driver in
> acpi_bus_match(), so make that function return 0 if the device
> object passed to it has an ACPI scan handler attached.
> 
> This also addresses a regression related to a broken ACPI table in
> the BIOS, where it has defined a _ROM method under the PCI root
> bridge object.  This causes the video module to treat that object
> as a display controller device (since only display devices are
> supposed to have a _ROM method defined according to the ACPI spec).
> As a result, the ACPI video driver binds to the PCI root bridge
> object and overwrites the previously assigned driver_data field of
> it, causing subsequent calls to acpi_get_pci_dev() to fail.
> 
> [rjw: Subject and changelog]
> References: https://bugzilla.kernel.org/show_bug.cgi?id=58091
> Reported-and-tested-by: Jason Cassell <bluesloth600@gmail.com>
> Reported-bisected-and-tested-by: Dmitry S. Demin <dmitryy.demin@gmail.com>
> Cc: 3.9+ <stable@kernel.org>
> Signed-off-by: Aaron Lu <aaron.lu@intel.com>

I've applied this one already.

Thanks,
Rafael


> ---
> v2:
> Remove WARN_ON as it would cause unnecessary warnings for devices that
> already have drivers bound.
> 
> drivers/acpi/scan.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> 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,10 @@ 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);
>  
> +	/* Skip ACPI device objects with scan handlers attached. */
> +	if (acpi_dev->handler)
> +		return 0;
> +
>  	return acpi_dev->flags.match_driver
>  		&& !acpi_match_device_ids(acpi_dev, acpi_drv->ids);
>  }
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

end of thread, other threads:[~2013-06-06 10:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <51AC9389.3050603@intel.com>
2013-06-04  5:23 ` [PATCH] ACPI: do not match devices that have scan handler Aaron Lu
2013-06-06  2:54   ` [PATCH v2] ACPI / scan: do not match drivers against objects having scan handlers Aaron Lu
2013-06-06 10:56     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox