From patchwork Mon Oct 27 07:48:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yijing Wang X-Patchwork-Id: 5157821 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AD074C11AC for ; Mon, 27 Oct 2014 07:12:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F42E2024F for ; Mon, 27 Oct 2014 07:12:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 807CB201ED for ; Mon, 27 Oct 2014 07:12:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XieQT-0008SM-4Z; Mon, 27 Oct 2014 07:09:13 +0000 Received: from szxga03-in.huawei.com ([119.145.14.66]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XieQM-0008Nb-1B for linux-arm-kernel@lists.infradead.org; Mon, 27 Oct 2014 07:09:09 +0000 Received: from 172.24.2.119 (EHLO szxeml409-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AWE07461; Mon, 27 Oct 2014 15:07:29 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml409-hub.china.huawei.com (10.82.67.136) with Microsoft SMTP Server id 14.3.158.1; Mon, 27 Oct 2014 15:07:20 +0800 From: Yijing Wang To: Bjorn Helgaas Subject: [PATCH 02/10] PCI/MSI: Introduce weak pcibios_msi_controller() Date: Mon, 27 Oct 2014 15:48:39 +0800 Message-ID: <1414396127-30023-3-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1414396127-30023-1-git-send-email-wangyijing@huawei.com> References: <1414396127-30023-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A02020A.544DEF31.0189, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3ff181c1f0d39fd0d459c802015e7d48 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141027_000906_485541_0E050F48 X-CRM114-Status: GOOD ( 10.44 ) X-Spam-Score: -1.3 (-) Cc: Thomas Petazzoni , Russell King , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Xinwei Hu , Thierry Reding , Yijing Wang , Thomas Gleixner , Wuyun , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 Introduce a new weak pcibios_msi_controller() to get the associate msi_chip for PCI bus. This is preparation for save msi_chip in arch PCI sysdata. This weak function will be removed after we save msi_chip in generic pci_host_bridge. Suggested-by: Bjorn Helgaas Signed-off-by: Yijing Wang --- drivers/pci/msi.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 1c7ca4a..f085f7f 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -30,9 +30,24 @@ int pci_msi_ignore_mask; /* Arch hooks */ +struct msi_controller * __weak pcibios_msi_controller(struct pci_bus *bus) +{ + return NULL; +} + +struct msi_controller *pci_msi_controller(struct pci_bus *bus) +{ + struct msi_controller *ctrl = bus->msi; + + if (ctrl) + return ctrl; + + return pcibios_msi_controller(bus); +} + int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) { - struct msi_controller *ctrl = dev->bus->msi; + struct msi_controller *ctrl = pci_msi_controller(dev->bus); int err; if (!ctrl || !ctrl->setup_irq) @@ -48,7 +63,7 @@ int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) void __weak arch_teardown_msi_irq(unsigned int irq) { struct msi_desc *entry = irq_get_msi_desc(irq); - struct msi_controller *ctrl = entry->dev->bus->msi; + struct msi_controller *ctrl = pci_msi_controller(entry->dev->bus); if (!ctrl || !ctrl->teardown_irq) return;