From patchwork Fri Mar 20 20:56:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Chiang X-Patchwork-Id: 13375 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 n2KKufK5001652 for ; Fri, 20 Mar 2009 20:56:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756167AbZCTU4F (ORCPT ); Fri, 20 Mar 2009 16:56:05 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755650AbZCTU4E (ORCPT ); Fri, 20 Mar 2009 16:56:04 -0400 Received: from g4t0017.houston.hp.com ([15.201.24.20]:25369 "EHLO g4t0017.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758025AbZCTU4C (ORCPT ); Fri, 20 Mar 2009 16:56:02 -0400 Received: from smtp1.fc.hp.com (smtp1.fc.hp.com [15.15.136.127]) by g4t0017.houston.hp.com (Postfix) with ESMTP id 0543138470; Fri, 20 Mar 2009 20:56:00 +0000 (UTC) Received: from localhost.localdomain (lart.fc.hp.com [15.11.146.31]) by smtp1.fc.hp.com (Postfix) with ESMTP id E5BA8247C4A; Fri, 20 Mar 2009 20:27:21 +0000 (UTC) Received: from bob.kio (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id 8F7932615B; Fri, 20 Mar 2009 14:56:00 -0600 (MDT) From: Alex Chiang Subject: [PATCH v5 02/13] PCI: don't scan existing devices To: jbarnes@virtuousgeek.org Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Trent Piepho , Alex Chiang Date: Fri, 20 Mar 2009 14:56:00 -0600 Message-ID: <20090320205600.12275.69126.stgit@bob.kio> In-Reply-To: <20090320204327.12275.43010.stgit@bob.kio> References: <20090320204327.12275.43010.stgit@bob.kio> User-Agent: StGIT/0.14.3.215.gff3d MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Trent Piepho pci_scan_single_device is supposed to add newly discovered devices to pci_bus->devices, but doesn't check to see if the device has already been added. This can cause problems if we ever want to use this interface to rescan the PCI bus. If the device is already added, just return it. Signed-off-by: Trent Piepho Signed-off-by: Alex Chiang --- drivers/pci/probe.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" 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/pci/probe.c b/drivers/pci/probe.c index 579a56c..b89a86e 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1013,6 +1013,12 @@ struct pci_dev *__ref pci_scan_single_device(struct pci_bus *bus, int devfn) { struct pci_dev *dev; + dev = pci_get_slot(bus, devfn); + if (dev) { + pci_dev_put(dev); + return dev; + } + dev = pci_scan_device(bus, devfn); if (!dev) return NULL;