All of lore.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>,
	Len Brown <lenb@kernel.org>, Andrew Morton <akpm@osdl.org>
Subject: [PATCH] Recent Lenovo ThinkPads define a dummy grahpics device, find it and ignore it
Date: Fri, 07 Dec 2007 13:55:13 +0100	[thread overview]
Message-ID: <1197032113.28990.155.camel@queen.suse.de> (raw)

Hi Matthew,

I posted this one already and you had some concerns about it:
http://www.mail-archive.com/linux-acpi@vger.kernel.org/msg09510.html

IMO, this one should still be added to -mm, because:
  - The patch itself is correct, it is the function that is called
    that must make sure to return the corresponding pci device

  - There currently is a bug: Lenovos will register a device for which
    no physical device exists.
    
  - That means on these machines HW is addressed/poked
    which does not exist -> danger.

  - There is no other way to fix up acpi_get_physical_device, than to
    just do this change (at least I don't see it). People have to
    complain that their device is not found (the message they see in
    dmesg is obvious).
    Then we can make acpi_get_physical_device more robust, which will
    come out as a benefit for other functionality too sooner or later to
    be able to rely on getting struct pci in the video (and possibly
    other) driver(s).

What do you think?

---------------


Recent Lenovo ThinkPads define a dummy grahpics device, find it and ignore it

Signed-off-by: Thomas Renninger <trenn@suse.de>

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

Index: linux-2.6/drivers/acpi/video.c
===================================================================
--- linux-2.6.orig/drivers/acpi/video.c
+++ linux-2.6/drivers/acpi/video.c
@@ -35,6 +35,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>
@@ -1896,6 +1897,21 @@ static int acpi_video_bus_add(struct acp
 	struct acpi_video_bus *video;
 	struct input_dev *input;
 	int error;
+	struct device *dev;
+
+
+	/*
+	 *	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;
+	}
+	put_device(dev);
 
 	video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
 	if (!video)



             reply	other threads:[~2007-12-07 12:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-07 12:55 Thomas Renninger [this message]
2007-12-07 15:27 ` [PATCH] Recent Lenovo ThinkPads define a dummy grahpics device, find it and ignore it Thomas Renninger
2007-12-07 22:50 ` Matthew Garrett
2007-12-10 12:48   ` Thomas Renninger
2008-01-17  3:11     ` Matthew Garrett
2008-01-17  3:39       ` [PATCH] Ignore ACPI video devices that aren't present in hardware Matthew Garrett
2008-01-17 10:57         ` Thomas Renninger
2008-01-17 12:02           ` Matthew Garrett
2008-01-22  8:52             ` Zhang Rui
2008-01-22 12:11               ` Julian Sikorski
2008-01-24 22:21         ` Len Brown
2008-01-27  2:09           ` Matthew Garrett
2008-02-02  7:12             ` Len Brown
2008-02-03  0:03               ` Matthew Garrett
2008-02-07  1:44                 ` Matthew Garrett
2008-02-07  7:03                   ` Len Brown

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=1197032113.28990.155.camel@queen.suse.de \
    --to=trenn@suse.de \
    --cc=akpm@osdl.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.