From patchwork Thu Jun 18 20:46:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 31245 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5IKknG5014540 for ; Thu, 18 Jun 2009 20:46:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752199AbZFRUqz (ORCPT ); Thu, 18 Jun 2009 16:46:55 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752456AbZFRUqz (ORCPT ); Thu, 18 Jun 2009 16:46:55 -0400 Received: from g4t0017.houston.hp.com ([15.201.24.20]:16568 "EHLO g4t0017.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752199AbZFRUqy (ORCPT ); Thu, 18 Jun 2009 16:46:54 -0400 Received: from smtp1.fc.hp.com (smtp1.fc.hp.com [15.15.136.127]) by g4t0017.houston.hp.com (Postfix) with ESMTP id D424D38722; Thu, 18 Jun 2009 20:46:57 +0000 (UTC) Received: from localhost.localdomain (lart.fc.hp.com [15.11.146.31]) by smtp1.fc.hp.com (Postfix) with ESMTP id A2A39255775; Thu, 18 Jun 2009 20:11:18 +0000 (UTC) Received: from bob.kio (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id 9136326145; Thu, 18 Jun 2009 14:46:57 -0600 (MDT) Subject: [PATCH 3/5] ACPI: pci_root: use driver data rather than list lookup To: Len Brown From: Bjorn Helgaas Cc: linux-acpi@vger.kernel.org Date: Thu, 18 Jun 2009 14:46:57 -0600 Message-ID: <20090618204657.15850.22025.stgit@bob.kio> In-Reply-To: <20090618203916.15850.7977.stgit@bob.kio> References: <20090618203916.15850.7977.stgit@bob.kio> User-Agent: StGit/0.14.3.347.g594a MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org There's no need to search the list to find the acpi_pci_root structure. We saved it as device->driver_data when we added the device. Signed-off-by: Bjorn Helgaas --- drivers/acpi/pci_root.c | 21 ++++----------------- 1 files changed, 4 insertions(+), 17 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index c780008..e490a2e 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -599,30 +599,17 @@ end: static int acpi_pci_root_start(struct acpi_device *device) { - struct acpi_pci_root *root; - + struct acpi_pci_root *root = acpi_driver_data(device); - list_for_each_entry(root, &acpi_pci_roots, node) { - if (root->device == device) { - pci_bus_add_devices(root->bus); - return 0; - } - } - return -ENODEV; + pci_bus_add_devices(root->bus); + return 0; } static int acpi_pci_root_remove(struct acpi_device *device, int type) { - struct acpi_pci_root *root = NULL; - - - if (!device || !acpi_driver_data(device)) - return -EINVAL; - - root = acpi_driver_data(device); + struct acpi_pci_root *root = acpi_driver_data(device); kfree(root); - return 0; }