From patchwork Tue May 14 16:51:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 2568051 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 23780DF24C for ; Tue, 14 May 2013 16:56:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757534Ab3ENQw4 (ORCPT ); Tue, 14 May 2013 12:52:56 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:65510 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757829Ab3ENQwx (ORCPT ); Tue, 14 May 2013 12:52:53 -0400 Received: by mail-pa0-f54.google.com with SMTP id kx1so685098pab.41 for ; Tue, 14 May 2013 09:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=JxZD4kEITPLdHL9G5zBaOStbAfOKKG2cSb3XBHiytSw=; b=p0qvJNpoL32HvG4hIJ9IfnXfN+RJsB8SjPXqhvpGKJUhEkpcpX9iQ79E5Iy7AgNmNr 6TWne9MT8OgQpjS2YvXcleKbEMwrUozTp/vPnyfQCYsg8anvqh2EzpxNlR4IvVkj2qJv z3bkoKxlDJOiHd6RAf38iruOeAUD0z+aGFA11i47SOi8TL+FEZgicbNbpcqxOXQRtF78 7KopoPqJsuR+s3ctuN4Js8MZxtQmSNoWgHY2fvSWzuMdC+HEw5FluQESntTpdgWeyg79 X6VVmu2KKy0qoLc0M3CZ9wCvB9C2W9O4t8eMu4llMcet2DQW90CmolFCJ45nFADQR0Yc NCwQ== X-Received: by 10.68.192.225 with SMTP id hj1mr8064663pbc.162.1368550372947; Tue, 14 May 2013 09:52:52 -0700 (PDT) Received: from localhost.localdomain ([120.196.98.100]) by mx.google.com with ESMTPSA id v5sm18919924pbz.4.2013.05.14.09.52.48 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 May 2013 09:52:52 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas , Yinghai Lu Cc: Jiang Liu , "Rafael J . Wysocki" , Greg Kroah-Hartman , Gu Zheng , Toshi Kani , Myron Stowe , Yijing Wang , Jiang Liu , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Tony Luck , Fenghua Yu , linux-ia64@vger.kernel.org Subject: [RFC PATCH v2, part 2 06/18] PCI, IA64: use hotplug-safe iterators to walk PCI buses Date: Wed, 15 May 2013 00:51:50 +0800 Message-Id: <1368550322-1045-6-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1368550322-1045-1-git-send-email-jiang.liu@huawei.com> References: <1368550322-1045-1-git-send-email-jiang.liu@huawei.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Enhance IA64 architecture specific code to use hotplug-safe iterators to walk PCI buses. Signed-off-by: Jiang Liu Cc: Tony Luck Cc: Fenghua Yu Cc: Greg Kroah-Hartman Cc: linux-ia64@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- arch/ia64/hp/common/sba_iommu.c | 2 +- arch/ia64/sn/kernel/io_common.c | 2 +- arch/ia64/sn/pci/tioca_provider.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index bcda5b2..6faf241 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c @@ -2156,7 +2156,7 @@ sba_init(void) #ifdef CONFIG_PCI { struct pci_bus *b = NULL; - while ((b = pci_find_next_bus(b)) != NULL) + for_each_pci_root_bus(b) sba_connect_bus(b); } #endif diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c index 11f2275..87d8d8f 100644 --- a/arch/ia64/sn/kernel/io_common.c +++ b/arch/ia64/sn/kernel/io_common.c @@ -530,7 +530,7 @@ sn_io_late_init(void) * info from the PROM). */ bus = NULL; - while ((bus = pci_find_next_bus(bus)) != NULL) { + for_each_pci_root_bus(bus) { bussoft = SN_PCIBUS_BUSSOFT(bus); nasid = NASID_GET(bussoft->bs_base); cnode = nasid_to_cnodeid(nasid); diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c index a70b11f..cd8c0fb 100644 --- a/arch/ia64/sn/pci/tioca_provider.c +++ b/arch/ia64/sn/pci/tioca_provider.c @@ -624,7 +624,7 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont nasid_to_cnodeid(tioca_common->ca_closest_nasid); tioca_common->ca_kernel_private = (u64) tioca_kern; - bus = pci_find_bus(tioca_common->ca_common.bs_persist_segment, + bus = pci_get_bus(tioca_common->ca_common.bs_persist_segment, tioca_common->ca_common.bs_persist_busnum); BUG_ON(!bus); tioca_kern->ca_devices = &bus->devices; @@ -632,6 +632,7 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont /* init GART */ if (tioca_gart_init(tioca_kern) < 0) { + pci_bus_put(bus); kfree(tioca_kern); kfree(tioca_common); return NULL;