aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
diff options
context:
space:
mode:
authorMatthew Garrett <mjg59@srcf.ucam.org>2008-01-17 03:39:36 +0000
committerLen Brown <len.brown@intel.com>2008-02-02 02:15:52 -0500
commit0119509c4fbc9adcef1472817fda295334612976 (patch)
tree8fa90b61fd27eb31ac5a2725fa17b7c77a06ab84 /drivers/acpi/video.c
parentaa6299926950c8dfe2fea638276cad6def092bc9 (diff)
downloadkernel_samsung_aries-0119509c4fbc9adcef1472817fda295334612976.zip
kernel_samsung_aries-0119509c4fbc9adcef1472817fda295334612976.tar.gz
kernel_samsung_aries-0119509c4fbc9adcef1472817fda295334612976.tar.bz2
ACPI: video: Ignore devices that aren't present in hardware
Vendors often ship machines with a choice of integrated or discrete graphics, and use the same DSDT for both. As a result, the ACPI video module will locate devices that may not exist on this specific platform. Attempt to determine whether the device exists or not, and abort the device creation if it doesn't. http://bugzilla.kernel.org/show_bug.cgi?id=9614 Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org> Acked-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r--drivers/acpi/video.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index bd77e81..2270144 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1256,8 +1256,37 @@ acpi_video_bus_write_DOS(struct file *file,
static int acpi_video_bus_add_fs(struct acpi_device *device)
{
+ long device_id;
+ int status;
struct proc_dir_entry *entry = NULL;
struct acpi_video_bus *video;
+ struct device *dev;
+
+ status =
+ acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
+
+ if (!ACPI_SUCCESS(status))
+ return -ENODEV;
+
+ /* We need to attempt to determine whether the _ADR refers to a
+ PCI device or not. There's no terribly good way to do this,
+ so the best we can hope for is to assume that there'll never
+ be a video device in the host bridge */
+ if (device_id >= 0x10000) {
+ /* It looks like a PCI device. Does it exist? */
+ dev = acpi_get_physical_device(device->handle);
+ } else {
+ /* It doesn't look like a PCI device. Does its parent
+ exist? */
+ acpi_handle phandle;
+ if (acpi_get_parent(device->handle, &phandle))
+ return -ENODEV;
+ dev = acpi_get_physical_device(phandle);
+ }
+ if (!dev)
+ return -ENODEV;
+ put_device(dev);
+
video = acpi_driver_data(device);