public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: linux-acpi <linux-acpi@vger.kernel.org>,
	Christian Birchinger <joker@netswarm.net>,
	"Li, Shaohua" <shaohua.li@intel.com>, Len Brown <lenb@kernel.org>,
	ibm-acpi-devel <ibm-acpi-devel@lists.sourceforge.net>
Subject: Re: [PATCH 1/1] Recent Lenovo ThinkPads define a dummy grahpics device, find it and ignore it
Date: Tue, 16 Oct 2007 16:39:01 +0200	[thread overview]
Message-ID: <1192545541.9847.600.camel@queen.suse.de> (raw)
In-Reply-To: <20071015164816.GA5021@srcf.ucam.org>

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 <trenn@suse.de>

---
 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;



  parent reply	other threads:[~2007-10-16 14:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-15 16:33 [PATCH 1/2] Export a func to find the corresponding PCI bus:seg.func of an ACPI device Thomas Renninger
2007-10-15 16:48 ` Matthew Garrett
2007-10-16  1:12   ` Shaohua Li
2007-10-16 14:39   ` Thomas Renninger [this message]
2007-10-16 14:43     ` [PATCH 1/1] Recent Lenovo ThinkPads define a dummy grahpics device, find it and ignore it Thomas Renninger
2007-10-16 14:49     ` Matthew Garrett
     [not found]       ` <20071016144901.GB21749-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2007-10-16 15:11         ` Thomas Renninger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1192545541.9847.600.camel@queen.suse.de \
    --to=trenn@suse.de \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=joker@netswarm.net \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=shaohua.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox