From patchwork Thu Feb 26 01:29:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yijing Wang X-Patchwork-Id: 5886551 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 51A39BF440 for ; Thu, 26 Feb 2015 01:39:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6DB4720373 for ; Thu, 26 Feb 2015 01:39:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7804C20374 for ; Thu, 26 Feb 2015 01:39:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754113AbbBZBib (ORCPT ); Wed, 25 Feb 2015 20:38:31 -0500 Received: from [119.145.14.64] ([119.145.14.64]:23912 "EHLO szxga01-in.huawei.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753583AbbBZBcm (ORCPT ); Wed, 25 Feb 2015 20:32:42 -0500 Received: from 172.24.2.119 (EHLO szxeml430-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CJX56599; Thu, 26 Feb 2015 09:32:03 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml430-hub.china.huawei.com (10.82.67.185) with Microsoft SMTP Server id 14.3.158.1; Thu, 26 Feb 2015 09:31:54 +0800 From: Yijing Wang To: Bjorn Helgaas CC: Jiang Liu , , Yinghai Lu , , Marc Zyngier , , Russell King , , Thomas Gleixner , Benjamin Herrenschmidt , Rusty Russell , Tony Luck , , "David S. Miller" , "Guan Xuetao" , , , Liviu Dudau , "Arnd Bergmann" , Geert Uytterhoeven , "Yijing Wang" Subject: [PATCH v3 11/30] PCI: Save sysdata in pci_host_bridge drvdata Date: Thu, 26 Feb 2015 09:29:28 +0800 Message-ID: <1424914187-21027-12-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1424914187-21027-1-git-send-email-wangyijing@huawei.com> References: <1424914187-21027-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Save platform specific sysdata in pci_host_bridge drvdata, host bridge specific operation need to access it before the pci bus creation. Signed-off-by: Yijing Wang --- drivers/pci/host-bridge.c | 4 +++- drivers/pci/probe.c | 18 ++++++++---------- include/linux/pci.h | 3 ++- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c index 5039b3b..b42a4bb 100644 --- a/drivers/pci/host-bridge.c +++ b/drivers/pci/host-bridge.c @@ -23,7 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev) } struct pci_host_bridge *pci_create_host_bridge( - struct device *parent, u32 db, struct list_head *resources) + struct device *parent, u32 db, + struct list_head *resources, void *sysdata) { int error; int bus = PCI_BUSNUM(db); @@ -58,6 +59,7 @@ struct pci_host_bridge *pci_create_host_bridge( host->dev.parent = parent; INIT_LIST_HEAD(&host->windows); host->dev.release = pci_release_host_bridge_dev; + dev_set_drvdata(&host->dev, sysdata); dev_set_name(&host->dev, "pci%04x:%02x", host->domain, host->busnum); diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index ec4f99d..45056cb 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1865,8 +1865,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus) } static struct pci_bus *__pci_create_root_bus( - struct pci_host_bridge *bridge, struct pci_ops *ops, - void *sysdata) + struct pci_host_bridge *bridge, struct pci_ops *ops) { int error; struct pci_bus *b; @@ -1882,7 +1881,7 @@ static struct pci_bus *__pci_create_root_bus( if (!b) return NULL; - b->sysdata = sysdata; + b->sysdata = dev_get_drvdata(&bridge->dev); b->ops = ops; b->number = b->busn_res.start = bridge->busnum; pci_bus_assign_domain_nr(b, parent); @@ -1954,11 +1953,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, u32 db, { struct pci_host_bridge *host; - host = pci_create_host_bridge(parent, db, resources); + host = pci_create_host_bridge(parent, db, resources, sysdata); if (!host) return NULL; - return __pci_create_root_bus(host, ops, sysdata); + return __pci_create_root_bus(host, ops); } int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max) @@ -2025,8 +2024,7 @@ void pci_bus_release_busn_res(struct pci_bus *b) } static struct pci_bus *__pci_scan_root_bus( - struct pci_host_bridge *host, struct pci_ops *ops, - void *sysdata) + struct pci_host_bridge *host, struct pci_ops *ops) { struct resource_entry *window; bool found = false; @@ -2039,7 +2037,7 @@ static struct pci_bus *__pci_scan_root_bus( break; } - b = __pci_create_root_bus(host, ops, sysdata); + b = __pci_create_root_bus(host, ops); if (!b) { pci_free_host_bridge(host); return NULL; @@ -2065,11 +2063,11 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db, { struct pci_host_bridge *host; - host = pci_create_host_bridge(parent, db, resources); + host = pci_create_host_bridge(parent, db, resources, sysdata); if (!host) return NULL; - return __pci_scan_root_bus(host, ops, sysdata); + return __pci_scan_root_bus(host, ops); } EXPORT_SYMBOL(pci_scan_root_bus); diff --git a/include/linux/pci.h b/include/linux/pci.h index 4d11228..74e038d 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -418,7 +418,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge, int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge); struct pci_host_bridge *pci_create_host_bridge( - struct device *parent, u32 dombus, struct list_head *resources); + struct device *parent, u32 dombus, + struct list_head *resources, void *sysdata); /* * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond * to P2P or CardBus bridge windows) go in a table. Additional ones (for