linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Jan-Hendrik Zab <jan@jhz.name>, Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: torvalds@linux-foundation.org, linux-input@vger.kernel.org
Subject: Re: Add Sony Vaio VPCZ1 series to the nopnp table
Date: Wed, 21 Apr 2010 01:10:48 -0700	[thread overview]
Message-ID: <20100421081048.GA22357@core.coreip.homeip.net> (raw)
In-Reply-To: <20100421070158.GM4364@core.coreip.homeip.net>

On Wed, Apr 21, 2010 at 12:01:58AM -0700, Dmitry Torokhov wrote:
> On Mon, Apr 19, 2010 at 11:46:14AM +0200, Jan-Hendrik Zab wrote:
> > On 14/04/10 16:34 -0700, Dmitry Torokhov wrote:
> > > Sorry for the delay. I wonder if we simply do not recognize PNP ID for
> > > the touchpad. Coudl you give me output of:
> > > 
> > > for i in /sys/bus/pnp/devices/*; do echo $i; cat $i/id; done
> > > 
> > > and also your dsdt.
> > 
> > Hey,
> > I attached the DSDT and uploaded it to [0] for everyone on the
> > mailing list.
> > 
> 
> *sigh*
> 
> 
>                 Device (PS2M)
>                 {
>                     Name (_HID, "SNYSYN0003")
>                     Name (_CID, EisaId ("PNP0F13"))
>                     Name (_CRS, ResourceTemplate ()
> 
> PNP ID should be 7 characters...
> 
> Bjorn, do you think we could substitute CID for HID in case HID is
> invalid PNP device ID but CID is valid?
> 

Does something like below help in any way?

-- 
Dmitry


PNPACPI: cope with invalid device IDs

If primary ID (HID) is invalid try locating first valid ID on compatible
ID list before giving up.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/pnp/pnpacpi/core.c      |   27 +++++++++++++++++++++++----
 include/linux/mod_devicetable.h |    1 +
 2 files changed, 24 insertions(+), 4 deletions(-)


diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index f7ff628..1bf1677 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -28,7 +28,7 @@
 #include "../base.h"
 #include "pnpacpi.h"
 
-static int num = 0;
+static int num;
 
 /* We need only to blacklist devices that have already an acpi driver that
  * can't use pnp layer. We don't need to blacklist device that are directly
@@ -157,11 +157,24 @@ struct pnp_protocol pnpacpi_protocol = {
 };
 EXPORT_SYMBOL(pnpacpi_protocol);
 
+static char *pnpacpi_get_id(struct acpi_device *device)
+{
+	struct acpi_hardware_id *id;
+
+	list_for_each_entry(id, &device->pnp.ids, list) {
+		if (ispnpidacpi(id->id))
+			return id->id;
+	}
+
+	return NULL;
+}
+
 static int __init pnpacpi_add_device(struct acpi_device *device)
 {
 	acpi_handle temp = NULL;
 	acpi_status status;
 	struct pnp_dev *dev;
+	char *pnpid;
 	struct acpi_hardware_id *id;
 
 	/*
@@ -169,11 +182,17 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
 	 * driver should not be loaded.
 	 */
 	status = acpi_get_handle(device->handle, "_CRS", &temp);
-	if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) ||
-	    is_exclusive_device(device) || (!device->status.present))
+	if (ACPI_FAILURE(status))
+		return 0;
+
+	pnpid = pnpacpi_get_id(device);
+	if (!pnpid)
+		return 0;
+
+	if (!is_exclusive_device(device) || !device->status.present)
 		return 0;
 
-	dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device));
+	dev = pnp_alloc_dev(&pnpacpi_protocol, num, pnpid);
 	if (!dev)
 		return -ENOMEM;
 

  reply	other threads:[~2010-04-21  8:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-29 23:32 [PATCH] Add Sony Vaio VPCZ1 series to the nopnp table Jan-Hendrik Zab
2010-03-29 23:39 ` Dmitry Torokhov
2010-03-30 20:39   ` Jan-Hendrik Zab
2010-04-14 23:34     ` Dmitry Torokhov
2010-04-19  9:46       ` Jan-Hendrik Zab
2010-04-21  7:01         ` Dmitry Torokhov
2010-04-21  8:10           ` Dmitry Torokhov [this message]
2010-04-21 16:35             ` Bjorn Helgaas
2010-04-21 17:07               ` Dmitry Torokhov
2010-04-22  9:09                 ` Jan-Hendrik Zab
2010-05-05 23:03           ` Bjorn Helgaas

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=20100421081048.GA22357@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=bjorn.helgaas@hp.com \
    --cc=jan@jhz.name \
    --cc=linux-input@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).