From patchwork Fri Mar 20 20:56:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Chiang X-Patchwork-Id: 13379 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 n2KKufK9001652 for ; Fri, 20 Mar 2009 20:56:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758695AbZCTU4Y (ORCPT ); Fri, 20 Mar 2009 16:56:24 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758758AbZCTU4Y (ORCPT ); Fri, 20 Mar 2009 16:56:24 -0400 Received: from g4t0014.houston.hp.com ([15.201.24.17]:6322 "EHLO g4t0014.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758695AbZCTU4W (ORCPT ); Fri, 20 Mar 2009 16:56:22 -0400 Received: from smtp2.fc.hp.com (smtp2.fc.hp.com [15.11.136.114]) by g4t0014.houston.hp.com (Postfix) with ESMTP id 3301B2431B; Fri, 20 Mar 2009 20:56:21 +0000 (UTC) Received: from localhost.localdomain (lart.fc.hp.com [15.11.146.31]) by smtp2.fc.hp.com (Postfix) with ESMTP id 750102BD791; Fri, 20 Mar 2009 20:32:53 +0000 (UTC) Received: from bob.kio (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id DDDE32615B; Fri, 20 Mar 2009 14:56:20 -0600 (MDT) From: Alex Chiang Subject: [PATCH v5 06/13] PCI: do not enable bridges more than once To: jbarnes@virtuousgeek.org Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Alex Chiang Date: Fri, 20 Mar 2009 14:56:20 -0600 Message-ID: <20090320205620.12275.52427.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 In preparation for PCI core hotplug, we need to ensure that we do not attempt to re-enable bridges that have already been enabled. Reported-by: Kenji Kaneshige Signed-off-by: Alex Chiang --- drivers/pci/bus.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 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/bus.c b/drivers/pci/bus.c index 118c777..68f91a2 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -184,8 +184,10 @@ void pci_enable_bridges(struct pci_bus *bus) list_for_each_entry(dev, &bus->devices, bus_list) { if (dev->subordinate) { - retval = pci_enable_device(dev); - pci_set_master(dev); + if (atomic_read(&dev->enable_cnt) == 0) { + retval = pci_enable_device(dev); + pci_set_master(dev); + } pci_enable_bridges(dev->subordinate); } }