From patchwork Fri Jun 4 08:04:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 104235 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5484hBP024220 for ; Fri, 4 Jun 2010 08:04:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752668Ab0FDIEm (ORCPT ); Fri, 4 Jun 2010 04:04:42 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:57595 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752563Ab0FDIEj (ORCPT ); Fri, 4 Jun 2010 04:04:39 -0400 Received: by pwi3 with SMTP id 3so46137pwi.19 for ; Fri, 04 Jun 2010 01:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:subject:to:cc:date :message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=e8JEivYI6s1Z7JPbeutlASgKI+yzgGJc0AWraNwclz4=; b=E+ZTzkXkN7FrRa+XLYK/n6F/UownvrQ3O9mPLmkizpzNv15hqObW6d68wSCPekJnt1 MVEOdCk5KeLhf0Czuuzd86ZKZaeaCvOddp0PvnXcxhUt5JEqegBefpPxij+WlQzHAbQa 51TQrtTdLpv6QfDdiMZXTD5Iq5bWpm9sJ9fO8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:subject:to:cc:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; b=JaMMRMk5RVSj4kTXT3DukBRnvHVYtbIHxQt30EOasJcFGFDdvcA9aG9PDer3B8ZDWQ 1Q38GiTMmMI+u8I6BWoTneoBwDs1oZam3HVylQpIwPYaru1BuhaQZlkfGUmJr5ggvw/q /auOE4+8/WC0ge/lw96viRBt71TehRixV90qk= Received: by 10.115.86.38 with SMTP id o38mr8151601wal.170.1275638675850; Fri, 04 Jun 2010 01:04:35 -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 a23sm6567174wam.2.2010.06.04.01.04.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 04 Jun 2010 01:04:34 -0700 (PDT) From: Dmitry Torokhov Subject: [PATCH] PNPACPI: cope with invalid device IDs To: Bjorn Helgaas , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Len Brown Date: Fri, 04 Jun 2010 01:04:32 -0700 Message-ID: <20100604080432.16068.31159.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 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 (demeter.kernel.org [140.211.167.41]); Fri, 04 Jun 2010 08:04:43 +0000 (UTC) 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;