From patchwork Mon Apr 9 16:22:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 151448 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1A65CB6FDC for ; Tue, 10 Apr 2012 02:25:43 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757488Ab2DIQZm (ORCPT ); Mon, 9 Apr 2012 12:25:42 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:40501 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757437Ab2DIQZl (ORCPT ); Mon, 9 Apr 2012 12:25:41 -0400 Received: by mail-iy0-f174.google.com with SMTP id z16so6060703iag.19 for ; Mon, 09 Apr 2012 09:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=9c18sSoWk5iaZxzz1FMGWByWGaGZr4tC2kbBKEM9zb4=; b=Skx4oDeFsIdqf+ufw+aLdwMAHZJrks/PON3sFlDZxJKjy9N7cPqNPnrjKlx+PY2rld GVQBPgGWMfQFyR0R3gHesAvbfwj76ptIy2yxTRGJEgQo9Q/rp1SaM6GJLACy7ryEIufT jzBrIdPBKUEYKm+3dnnLNEXWpMnpgewfJBbkqcr1UpvefvWb/gqqtuqkwLat/Md+qQP+ 2zgnp/OrJLVPpm0FrJ4q1V+ly3N9pWSX7yqu3Q8xldWiCtSDl3ca3WpBGluB84U86BoJ TUe+mx6eaDC2AJ+UEYm4Sl7eHrwaQJt7JXUUto4LxMtMiXLj4ksGbzwCRi9XU2A5wPDA g2TQ== Received: by 10.50.179.40 with SMTP id dd8mr5672831igc.29.1333988741398; Mon, 09 Apr 2012 09:25:41 -0700 (PDT) Received: from localhost.localdomain ([221.221.23.44]) by mx.google.com with ESMTPS id en3sm38061224igc.2.2012.04.09.09.25.33 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 Apr 2012 09:25:40 -0700 (PDT) From: Jiang Liu To: Taku Izumi , Kenji Kaneshige , Yinghai Lu Cc: Jiang Liu , Bjorn Helgaas , Jiang Liu , Keping Chen , x86@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH V2 2/6] PCI, x86: split out pci_mmconfig_alloc() for code reuse Date: Tue, 10 Apr 2012 00:22:44 +0800 Message-Id: <1333988568-11282-3-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1333988568-11282-1-git-send-email-jiang.liu@huawei.com> References: <1333988568-11282-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 Split out pci_mmconfig_alloc() for code reuse, which will be used when supporting PCI root bridge hotplug. Signed-off-by: Jiang Liu --- arch/x86/pci/mmconfig-shared.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index f799949..5e2cd2a 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -61,8 +61,9 @@ static __init void list_add_sorted(struct pci_mmcfg_region *new) list_add_tail(&new->list, &pci_mmcfg_list); } -static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start, - int end, u64 addr) +static __devinit struct pci_mmcfg_region *pci_mmconfig_alloc(int segment, + int start, + int end, u64 addr) { struct pci_mmcfg_region *new; struct resource *res; @@ -79,8 +80,6 @@ static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start, new->start_bus = start; new->end_bus = end; - list_add_sorted(new); - res = &new->res; res->start = addr + PCI_MMCFG_BUS_OFFSET(start); res->end = addr + PCI_MMCFG_BUS_OFFSET(end + 1) - 1; @@ -96,6 +95,18 @@ static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start, return new; } +static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start, + int end, u64 addr) +{ + struct pci_mmcfg_region *new; + + new = pci_mmconfig_alloc(segment, start, end, addr); + if (new) + list_add_sorted(new); + + return new; +} + struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus) { struct pci_mmcfg_region *cfg;