* [PATCH 0/2] PNPACPI: cope with invalid device IDs
@ 2010-06-05 2:23 Dmitry Torokhov
2010-06-05 2:24 ` [PATCH 1/2] " Dmitry Torokhov
2010-06-05 2:24 ` [PATCH 2/2] PNPACPI: check return value of pnp_add_device() Dmitry Torokhov
0 siblings, 2 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2010-06-05 2:23 UTC (permalink / raw)
To: Bjorn Helgaas, Len Brown; +Cc: linux-kernel, linux-acpi
Bjorn, Len,
Here is the updated version of the patch that handles invalid _HIDs,
this time without adding duplicate entriess into the ID list. There
is also a second patch adding error handling into pnp_add_device().
Please consider applying.
Thank you,
--
Dmitry
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] PNPACPI: cope with invalid device IDs
2010-06-05 2:23 [PATCH 0/2] PNPACPI: cope with invalid device IDs Dmitry Torokhov
@ 2010-06-05 2:24 ` Dmitry Torokhov
2010-09-17 22:37 ` Bjorn Helgaas
2010-06-05 2:24 ` [PATCH 2/2] PNPACPI: check return value of pnp_add_device() Dmitry Torokhov
1 sibling, 1 reply; 8+ messages in thread
From: Dmitry Torokhov @ 2010-06-05 2:24 UTC (permalink / raw)
To: Bjorn Helgaas, Len Brown; +Cc: linux-kernel, linux-acpi
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.
Tested-by: Jan-Hendrik Zab <jan@jhz.name>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
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;
- 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;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] PNPACPI: check return value of pnp_add_device()
2010-06-05 2:23 [PATCH 0/2] PNPACPI: cope with invalid device IDs Dmitry Torokhov
2010-06-05 2:24 ` [PATCH 1/2] " Dmitry Torokhov
@ 2010-06-05 2:24 ` Dmitry Torokhov
1 sibling, 0 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2010-06-05 2:24 UTC (permalink / raw)
To: Bjorn Helgaas, Len Brown; +Cc: linux-kernel, linux-acpi
pnp_add_device() may fail so we need to ihandle errors and avoid leaking
memory. Also, do not use ACPI-specific return codes (AE_OK) but rather
standard ones.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/pnp/pnpacpi/core.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 2029cb5..8c5142d 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -171,8 +171,9 @@ static char *pnpacpi_get_id(struct acpi_device *device)
static int __init pnpacpi_add_device(struct acpi_device *device)
{
- acpi_handle temp = NULL;
+ acpi_handle temp;
acpi_status status;
+ int error;
struct pnp_dev *dev;
char *pnpid;
struct acpi_hardware_id *id;
@@ -233,10 +234,16 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
/* clear out the damaged flags */
if (!dev->active)
pnp_init_resources(dev);
- pnp_add_device(dev);
+
+ error = pnp_add_device(dev);
+ if (error) {
+ put_device(&dev->dev);
+ return error;
+ }
+
num++;
- return AE_OK;
+ return 0;
}
static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] PNPACPI: cope with invalid device IDs
2010-06-05 2:24 ` [PATCH 1/2] " Dmitry Torokhov
@ 2010-09-17 22:37 ` Bjorn Helgaas
2010-09-17 22:49 ` Dmitry Torokhov
0 siblings, 1 reply; 8+ messages in thread
From: Bjorn Helgaas @ 2010-09-17 22:37 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Len Brown, linux-kernel, linux-acpi, Matthew Garrett
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;
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] PNPACPI: cope with invalid device IDs
2010-09-17 22:37 ` Bjorn Helgaas
@ 2010-09-17 22:49 ` Dmitry Torokhov
2010-09-17 22:56 ` Bjorn Helgaas
0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Torokhov @ 2010-09-17 22:49 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Len Brown, linux-kernel, linux-acpi, Matthew Garrett
On Friday, September 17, 2010 03:37:31 pm Bjorn Helgaas wrote:
> 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?
Yes, it does, "!" shoudl be dropped.
OTOH maybe we should keep the "primary" ID as is (so SYNSYN0003 would
still be _the_ id) but only refuse device if none of it's IDs (neither
_HID nor _CID) satisfy ispnpidacpi() requirements.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] PNPACPI: cope with invalid device IDs
2010-09-17 22:49 ` Dmitry Torokhov
@ 2010-09-17 22:56 ` Bjorn Helgaas
2010-09-18 17:11 ` Dmitry Torokhov
0 siblings, 1 reply; 8+ messages in thread
From: Bjorn Helgaas @ 2010-09-17 22:56 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Len Brown, linux-kernel, linux-acpi, Matthew Garrett
On Friday, September 17, 2010 04:49:39 pm Dmitry Torokhov wrote:
> On Friday, September 17, 2010 03:37:31 pm Bjorn Helgaas wrote:
> > 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?
>
> Yes, it does, "!" shoudl be dropped.
>
> OTOH maybe we should keep the "primary" ID as is (so SYNSYN0003 would
> still be _the_ id) but only refuse device if none of it's IDs (neither
> _HID nor _CID) satisfy ispnpidacpi() requirements.
I think we *should* keep the entire SYNSYN0003 ID, but I don't think
we currently can because we use a fixed-length array to store it.
I haven't had time or motivation to fix that yet.
Do you want to post an update fixing the is_exclusive_device() thing?
Bjorn
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] PNPACPI: cope with invalid device IDs
2010-09-17 22:56 ` Bjorn Helgaas
@ 2010-09-18 17:11 ` Dmitry Torokhov
2010-10-01 6:09 ` Len Brown
0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Torokhov @ 2010-09-18 17:11 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Len Brown, linux-kernel, linux-acpi, Matthew Garrett
On Fri, Sep 17, 2010 at 04:56:08PM -0600, Bjorn Helgaas wrote:
> On Friday, September 17, 2010 04:49:39 pm Dmitry Torokhov wrote:
> > On Friday, September 17, 2010 03:37:31 pm Bjorn Helgaas wrote:
> > > 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?
> >
> > Yes, it does, "!" shoudl be dropped.
> >
> > OTOH maybe we should keep the "primary" ID as is (so SYNSYN0003 would
> > still be _the_ id) but only refuse device if none of it's IDs (neither
> > _HID nor _CID) satisfy ispnpidacpi() requirements.
>
> I think we *should* keep the entire SYNSYN0003 ID, but I don't think
> we currently can because we use a fixed-length array to store it.
> I haven't had time or motivation to fix that yet.
>
Ah, right...
> Do you want to post an update fixing the is_exclusive_device() thing?
>
Here it is.
--
Dmitry
PNPACPI: cope with invalid device IDs
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
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.
Tested-by: Jan-Hendrik Zab <jan@jhz.name>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
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 dc4e32e..0d943ee 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
@@ -180,11 +180,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;
/*
@@ -192,11 +205,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;
@@ -227,7 +246,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;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] PNPACPI: cope with invalid device IDs
2010-09-18 17:11 ` Dmitry Torokhov
@ 2010-10-01 6:09 ` Len Brown
0 siblings, 0 replies; 8+ messages in thread
From: Len Brown @ 2010-10-01 6:09 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Bjorn Helgaas, linux-kernel, linux-acpi, Matthew Garrett
applied to acpi-test
thanks,
Len Brown, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-10-01 6:09 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-05 2:23 [PATCH 0/2] PNPACPI: cope with invalid device IDs Dmitry Torokhov
2010-06-05 2:24 ` [PATCH 1/2] " Dmitry Torokhov
2010-09-17 22:37 ` Bjorn Helgaas
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
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).