diff options
author | Matthew Garrett <mjg59@srcf.ucam.org> | 2008-02-06 20:44:06 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-02-07 03:22:57 -0500 |
commit | 3fa2cdcc45a0176de15cac9dbf4ed2834ebf8932 (patch) | |
tree | d5243b920481bd8345c759d3c432160ae76463b5 /drivers/acpi/video.c | |
parent | 863c1490e512db40dab61e44b694a493a9e68b3f (diff) |
ACPI: video: Ignore ACPI video 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 do not exist.
Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index b5e35cd559ea..970c01a7f8f4 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -730,11 +730,40 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | |||
730 | static int acpi_video_bus_check(struct acpi_video_bus *video) | 730 | static int acpi_video_bus_check(struct acpi_video_bus *video) |
731 | { | 731 | { |
732 | acpi_status status = -ENOENT; | 732 | acpi_status status = -ENOENT; |
733 | 733 | long device_id; | |
734 | struct device *dev; | ||
735 | struct acpi_device *device; | ||
734 | 736 | ||
735 | if (!video) | 737 | if (!video) |
736 | return -EINVAL; | 738 | return -EINVAL; |
737 | 739 | ||
740 | device = video->device; | ||
741 | |||
742 | status = | ||
743 | acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); | ||
744 | |||
745 | if (!ACPI_SUCCESS(status)) | ||
746 | return -ENODEV; | ||
747 | |||
748 | /* We need to attempt to determine whether the _ADR refers to a | ||
749 | PCI device or not. There's no terribly good way to do this, | ||
750 | so the best we can hope for is to assume that there'll never | ||
751 | be a video device in the host bridge */ | ||
752 | if (device_id >= 0x10000) { | ||
753 | /* It looks like a PCI device. Does it exist? */ | ||
754 | dev = acpi_get_physical_device(device->handle); | ||
755 | } else { | ||
756 | /* It doesn't look like a PCI device. Does its parent | ||
757 | exist? */ | ||
758 | acpi_handle phandle; | ||
759 | if (acpi_get_parent(device->handle, &phandle)) | ||
760 | return -ENODEV; | ||
761 | dev = acpi_get_physical_device(phandle); | ||
762 | } | ||
763 | if (!dev) | ||
764 | return -ENODEV; | ||
765 | put_device(dev); | ||
766 | |||
738 | /* Since there is no HID, CID and so on for VGA driver, we have | 767 | /* Since there is no HID, CID and so on for VGA driver, we have |
739 | * to check well known required nodes. | 768 | * to check well known required nodes. |
740 | */ | 769 | */ |