From patchwork Sat Jun 5 02:24:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 104375 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 o552OsSB012072 for ; Sat, 5 Jun 2010 02:24:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755326Ab0FECYX (ORCPT ); Fri, 4 Jun 2010 22:24:23 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:38306 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755064Ab0FECYJ (ORCPT ); Fri, 4 Jun 2010 22:24:09 -0400 Received: by pvg16 with SMTP id 16so806283pvg.19 for ; Fri, 04 Jun 2010 19:24:07 -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:in-reply-to:references:user-agent:mime-version :content-type:content-transfer-encoding; bh=4VbnY6CzN/n4DqrSJbB6DGvslob16jLLRmZ2aeW7GCE=; b=QBEne8Hnemyt+ve1XuMeKJMQG44RWMHwIrjf7EA1a2V62BUvQhEug+DQ4X05N9TNLk iBg2nNuNIOTFxvvB0OZzXTABuchMdAIeUYt/0joUEMhXIqRmkD2t/eD4UY+Xh7AxTiwm OkLGDbMLcLFflTQCkF/T/LVl0uHV++rG/R0WU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:subject:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; b=BFFC5jXNpm1PDNTdphCVczfrkAvpmdgEU6FE1aqWZIQcwXVYo8b2w9SmqS3aVul25w Bs94XcMuuvkYHlIZdUU1nY2VsqgJbSdGXSAEeDGy1e2vb/X3t77A4oZKiLoTi9h8JIbg iLopw62kFZ4TtR0meNoBwHVX4VL75zTV8IvyQ= Received: by 10.115.67.26 with SMTP id u26mr9173454wak.109.1275704647609; Fri, 04 Jun 2010 19:24:07 -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 d20sm13995970waa.3.2010.06.04.19.24.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 04 Jun 2010 19:24:06 -0700 (PDT) From: Dmitry Torokhov Subject: [PATCH 1/2] PNPACPI: cope with invalid device IDs To: Bjorn Helgaas , Len Brown Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Date: Fri, 04 Jun 2010 19:24:04 -0700 Message-ID: <20100605022404.25768.77841.stgit@localhost.localdomain> In-Reply-To: <20100605022058.25768.77560.stgit@localhost.localdomain> References: <20100605022058.25768.77560.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]); Sat, 05 Jun 2010 02:24:55 +0000 (UTC) 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;