From patchwork Sat Sep 18 17:11:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 190022 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8IHBIYd007389 for ; Sat, 18 Sep 2010 17:11:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754273Ab0IRRLQ (ORCPT ); Sat, 18 Sep 2010 13:11:16 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:55333 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753066Ab0IRRLP (ORCPT ); Sat, 18 Sep 2010 13:11:15 -0400 Received: by pvg2 with SMTP id 2so835584pvg.19 for ; Sat, 18 Sep 2010 10:11:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=73PoTYK6Eu6liLj7JG+lRYChUJrSo3UFgXV4N8rZNoM=; b=xiV3v2erubynrR+GeokdHyasFqvkh+JCnJTcp8uKtxx/pGh/CUhYhFgNDvFlI9NXss 2ltAVa4fb0c8Yz+/RpwW7GkE6SYOcOZ6WrCSObVibCbY1MVnA6M/p0+hJ20/s/6rbYn5 Y2/2EFGnaATLrWPkbaNJalIrXaL6Jy9q7+z4U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=k3VVRQpxCePUq7waQ4iDx/KUcKbrjx1qKACbhnlwyMaig+D2aHZWWlyl5hwWYBtRuB ns1M+oXdEOmSQAS7FRhWntQqLGFyTE9PSCENAtYK2hDGE+iYOEr+V12rVkyLNT1PvPqd VgSgSB5Iw7ugDz6Bk8GIIIMyFnFMkzpdJJsPA= Received: by 10.142.148.3 with SMTP id v3mr5645212wfd.2.1284829875333; Sat, 18 Sep 2010 10:11:15 -0700 (PDT) Received: from mailhub.coreip.homeip.net (c-24-6-153-206.hsd1.ca.comcast.net [24.6.153.206]) by mx.google.com with ESMTPS id y36sm3670988wfd.6.2010.09.18.10.11.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 18 Sep 2010 10:11:13 -0700 (PDT) Date: Sat, 18 Sep 2010 10:11:09 -0700 From: Dmitry Torokhov To: Bjorn Helgaas Cc: Len Brown , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Matthew Garrett Subject: Re: [PATCH 1/2] PNPACPI: cope with invalid device IDs Message-ID: <20100918171109.GA6563@core.coreip.homeip.net> References: <20100605022058.25768.77560.stgit@localhost.localdomain> <201009171637.32127.bjorn.helgaas@hp.com> <201009171549.42276.dmitry.torokhov@gmail.com> <201009171656.11239.bjorn.helgaas@hp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201009171656.11239.bjorn.helgaas@hp.com> User-Agent: Mutt/1.5.20 (2009-12-10) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 18 Sep 2010 17:11:18 +0000 (UTC) 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;