aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
diff options
context:
space:
mode:
authorMatthew Garrett <mjg59@srcf.ucam.org>2008-01-16 22:39:36 -0500
committerLen Brown <len.brown@intel.com>2008-02-02 02:15:52 -0500
commit0119509c4fbc9adcef1472817fda295334612976 (patch)
tree8fa90b61fd27eb31ac5a2725fa17b7c77a06ab84 /drivers/acpi/video.c
parentaa6299926950c8dfe2fea638276cad6def092bc9 (diff)
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 bd77e81e81c1..2270144d7286 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1256,8 +1256,37 @@ acpi_video_bus_write_DOS(struct file *file,
1256 1256
1257static int acpi_video_bus_add_fs(struct acpi_device *device) 1257static int acpi_video_bus_add_fs(struct acpi_device *device)
1258{ 1258{
1259 long device_id;
1260 int status;
1259 struct proc_dir_entry *entry = NULL; 1261 struct proc_dir_entry *entry = NULL;
1260 struct acpi_video_bus *video; 1262 struct acpi_video_bus *video;
1263 struct device *dev;
1264
1265 status =
1266 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
1267
1268 if (!ACPI_SUCCESS(status))
1269 return -ENODEV;
1270
1271 /* We need to attempt to determine whether the _ADR refers to a
1272 PCI device or not. There's no terribly good way to do this,
1273 so the best we can hope for is to assume that there'll never
1274 be a video device in the host bridge */
1275 if (device_id >= 0x10000) {
1276 /* It looks like a PCI device. Does it exist? */
1277 dev = acpi_get_physical_device(device->handle);
1278 } else {
1279 /* It doesn't look like a PCI device. Does its parent
1280 exist? */
1281 acpi_handle phandle;
1282 if (acpi_get_parent(device->handle, &phandle))
1283 return -ENODEV;
1284 dev = acpi_get_physical_device(phandle);
1285 }
1286 if (!dev)
1287 return -ENODEV;
1288 put_device(dev);
1289
1261 1290
1262 1291
1263 video = acpi_driver_data(device); 1292 video = acpi_driver_data(device);