mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Len Brown <lenb@kernel.org>,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	Matthew Garrett <mjg59@srcf.ucam.org>
Subject: Re: [PATCH 1/2] PNPACPI: cope with invalid device IDs
Date: Fri, 17 Sep 2010 16:37:31 -0600	[thread overview]
Message-ID: <201009171637.32127.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <20100605022404.25768.77841.stgit@localhost.localdomain>

On Friday, June 04, 2010 08:24:04 pm Dmitry Torokhov wrote:
> If primary ID (HID) is invalid try locating first valid ID on compatible
> ID list before giving up.
> 
> This helps, for example, to recognize i8042 AUX port on Sony Vaio VPCZ1
> which uses SNYSYN0003 as HID. Without the patch users are forced to
> boot with i8042.nopnp to make use of their touchpads.

Sorry, we seem to have dropped the ball on this.  Looking at it again,
I have another question below:

>  drivers/pnp/pnpacpi/core.c |   29 ++++++++++++++++++++++++-----
>  1 files changed, 24 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
> index f7ff628..2029cb5 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;

Doesn't this change the sense of the is_exclusive_device() test?

Looks good to me otherwise.

Bjorn

> -	dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device));
> +	dev = pnp_alloc_dev(&pnpacpi_protocol, num, pnpid);
>  	if (!dev)
>  		return -ENOMEM;
>  
> @@ -204,7 +223,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
>  		pnpacpi_parse_resource_option_data(dev);
>  
>  	list_for_each_entry(id, &device->pnp.ids, list) {
> -		if (!strcmp(id->id, acpi_device_hid(device)))
> +		if (!strcmp(id->id, pnpid))
>  			continue;
>  		if (!ispnpidacpi(id->id))
>  			continue;
> 
> 

  reply	other threads:[~2010-09-17 22:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-05  2:23 [PATCH 0/2] " Dmitry Torokhov
2010-06-05  2:24 ` [PATCH 1/2] " Dmitry Torokhov
2010-09-17 22:37   ` Bjorn Helgaas [this message]
2010-09-17 22:49     ` Dmitry Torokhov
2010-09-17 22:56       ` Bjorn Helgaas
2010-09-18 17:11         ` Dmitry Torokhov
2010-10-01  6:09           ` Len Brown
2010-06-05  2:24 ` [PATCH 2/2] PNPACPI: check return value of pnp_add_device() Dmitry Torokhov

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=201009171637.32127.bjorn.helgaas@hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®