On Mon, 2007-10-15 at 17:48 +0100, Matthew Garrett wrote:
> Why not just call acpi_get_pyhsical_device() on the appropriate handle 
> and look at the struct device you get back? Remember to put_device() it 
> once you're done.

Yep, works great. I should have asked earlier for such a thing...

Len can you apply this one, pls.

Thanks,

   Thomas

Recent Lenovo ThinkPads define a dummy grahpics device, ignore it.

Signed-off-by: Thomas Renninger <[EMAIL PROTECTED]>

---
 drivers/acpi/video.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

Index: lenb/drivers/acpi/video.c
===================================================================
--- lenb.orig/drivers/acpi/video.c
+++ lenb/drivers/acpi/video.c
@@ -34,6 +34,7 @@
 #include <linux/input.h>
 #include <linux/backlight.h>
 #include <linux/video_output.h>
+#include <linux/acpi.h>
 #include <asm/uaccess.h>
 
 #include <acpi/acpi_bus.h>
@@ -1901,11 +1902,24 @@ static int acpi_video_bus_add(struct acp
        acpi_status status = 0;
        struct acpi_video_bus *video = NULL;
        struct input_dev *input;
+       struct device *dev;
 
 
        if (!device)
                return -EINVAL;
 
+       /*
+        *      Check whether we have really  a graphics device physically
+        *      in the slot and registered at the system.
+        */
+       dev = acpi_get_physical_device(device->handle);
+       if (!dev) {
+               printk (KERN_DEBUG PREFIX "Video device %s.%s not physically"
+                       " connected, ignoring\n", acpi_device_bid(device),
+                       device->parent ? acpi_device_bid(device->parent) : "");
+               return -ENODEV;
+       }
+
        video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
        if (!video)
                return -ENOMEM;


-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to