From patchwork Tue Aug 12 07:25:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 35241 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 103FA203C5 for ; Tue, 12 Aug 2014 07:08:05 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id ij19sf27883829vcb.4 for ; Tue, 12 Aug 2014 00:08:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:mime-version:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=19dO3QRG4kgRr1S1ATv59hdSTuA1mYkTdwVMqGkfyfA=; b=A5INm6rxW7G3v9K9XWKWovd1jsyDq6jGsAtKxZ0lOpnU2eAdd2BkmNWLUdPr+F6vmh 0Fen8bgX6k5jD6A1LbwfwSQtDwsymTzE/kFjzccEUG48ACquNA/Y31QUs+uh35FbvQ6e 2Ol6Nbh6lY4zJaTGoLNC98ZX5sh7jAENVi8pulUraYC68rxtpIj1PwyIr0B1PX8ZF48c oZikqBL+YO8kgkZ9G4DOQCg27Rwman9D7pBNoBUZnn96jhyBGiz9q71BabZ2Lbp+kZos rKcqY51o2s4cxLjjE6Y4XTcfCfiNLE9xEXd1LAqta2TYtZDs3/vHGSlAXmLeAYEOieSX tpSA== X-Gm-Message-State: ALoCoQnecq7NIC6i5Q7lMmuks7jZQbPOXjcyW+mDKbNnV/mYA/5M0QKzPcEG/P6oVf/799QiCdVN X-Received: by 10.236.44.205 with SMTP id n53mr15982736yhb.12.1407827284854; Tue, 12 Aug 2014 00:08:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.98.35 with SMTP id n32ls9070qge.11.gmail; Tue, 12 Aug 2014 00:08:04 -0700 (PDT) X-Received: by 10.220.144.147 with SMTP id z19mr2194875vcu.26.1407827284769; Tue, 12 Aug 2014 00:08:04 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id oh5si7770441vcb.6.2014.08.12.00.08.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Aug 2014 00:08:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hy4so12844165vcb.36 for ; Tue, 12 Aug 2014 00:08:04 -0700 (PDT) X-Received: by 10.52.34.209 with SMTP id b17mr111053vdj.49.1407827284637; Tue, 12 Aug 2014 00:08:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp224775vcb; Tue, 12 Aug 2014 00:08:03 -0700 (PDT) X-Received: by 10.70.53.138 with SMTP id b10mr2694882pdp.44.1407827283504; Tue, 12 Aug 2014 00:08:03 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id fb7si15386549pab.27.2014.08.12.00.08.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Aug 2014 00:08:03 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; 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 1XH6Aa-0003JR-Nn; Tue, 12 Aug 2014 07:06:56 +0000 Received: from szxga03-in.huawei.com ([119.145.14.66]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XH6AD-0002gC-Er for linux-arm-kernel@lists.infradead.org; Tue, 12 Aug 2014 07:06:35 +0000 Received: from 172.24.2.119 (EHLO szxeml421-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id ASY16048; Tue, 12 Aug 2014 15:02:38 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml421-hub.china.huawei.com (10.82.67.160) with Microsoft SMTP Server id 14.3.158.1; Tue, 12 Aug 2014 15:02:25 +0800 From: Yijing Wang To: Bjorn Helgaas Subject: [RFC PATCH 02/20] MSI: Clean up struct msi_chip argument Date: Tue, 12 Aug 2014 15:25:55 +0800 Message-ID: <1407828373-24322-3-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1407828373-24322-1-git-send-email-wangyijing@huawei.com> References: <1407828373-24322-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.0A020209.53E9BC13.0076,ss=1,re=0.000,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2011-05-27 18:58:46 X-Mirapoint-Loop-Id: 2d62244c56728838084bf00449433aaf X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140812_000634_311269_1FA2B63C X-CRM114-Status: GOOD ( 15.90 ) X-Spam-Score: -1.4 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [119.145.14.66 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [119.145.14.66 listed in wl.mailspike.net] -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: linux-mips@linux-mips.org, linux-ia64@vger.kernel.org, linux-pci@vger.kernel.org, Thierry Reding , Xinwei Hu , Yijing Wang , "H. Peter Anvin" , sparclinux@vger.kernel.org, linux-s390@vger.kernel.org, Russell King , Joerg Roedel , x86@kernel.org, Sebastian Ott , Benjamin Herrenschmidt , xen-devel@lists.xenproject.org, arnab.basu@freescale.com, Arnd Bergmann , Konrad Rzeszutek Wilk , Marc Zyngier , Chris Metcalf , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , Tony Luck , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Wuyun , linuxppc-dev@lists.ozlabs.org, "David S. Miller" 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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: wangyijing@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Msi_chip functions setup_irq/teardown_irq/check_device rarely use msi_chip argument. We can get msi_chip pointer from the device pointer or irq number, so clean up msi_chip arguments. This patch is also preparation for using msi_chip in all platforms to setup/teardown MSI irqs. Signed-off-by: Yijing Wang CC: Thierry Reding CC: Thomas Petazzoni --- drivers/irqchip/irq-armada-370-xp.c | 12 +++++------- drivers/pci/host/pci-tegra.c | 8 +++++--- drivers/pci/host/pcie-designware.c | 4 ++-- drivers/pci/host/pcie-rcar.c | 8 +++++--- drivers/pci/msi.c | 6 +++--- include/linux/msi.h | 8 +++----- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index c887e6e..ee1f0ba 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c @@ -129,9 +129,8 @@ static void armada_370_xp_free_msi(int hwirq) mutex_unlock(&msi_used_lock); } -static int armada_370_xp_setup_msi_irq(struct msi_chip *chip, - struct pci_dev *pdev, - struct msi_desc *desc) +static int armada_370_xp_setup_msi_irq(struct pci_dev *pdev, + struct msi_desc *desc) { struct msi_msg msg; int virq, hwirq; @@ -156,8 +155,7 @@ static int armada_370_xp_setup_msi_irq(struct msi_chip *chip, return 0; } -static void armada_370_xp_teardown_msi_irq(struct msi_chip *chip, - unsigned int irq) +static void armada_370_xp_teardown_msi_irq(unsigned int irq) { struct irq_data *d = irq_get_irq_data(irq); unsigned long hwirq = d->hwirq; @@ -166,8 +164,8 @@ static void armada_370_xp_teardown_msi_irq(struct msi_chip *chip, armada_370_xp_free_msi(hwirq); } -static int armada_370_xp_check_msi_device(struct msi_chip *chip, struct pci_dev *dev, - int nvec, int type) +static int armada_370_xp_check_msi_device(struct pci_dev *dev, + int nvec, int type) { /* We support MSI, but not MSI-X */ if (type == PCI_CAP_ID_MSI) diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 869a921..3872bc0 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -1192,9 +1192,10 @@ static irqreturn_t tegra_pcie_msi_irq(int irq, void *data) return processed > 0 ? IRQ_HANDLED : IRQ_NONE; } -static int tegra_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev, +static int tegra_msi_setup_irq(struct pci_dev *pdev, struct msi_desc *desc) { + struct msi_chip *chip = pdev->bus->msi; struct tegra_msi *msi = to_tegra_msi(chip); struct msi_msg msg; unsigned int irq; @@ -1220,10 +1221,11 @@ static int tegra_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev, return 0; } -static void tegra_msi_teardown_irq(struct msi_chip *chip, unsigned int irq) +static void tegra_msi_teardown_irq(unsigned int irq) { - struct tegra_msi *msi = to_tegra_msi(chip); struct irq_data *d = irq_get_irq_data(irq); + struct msi_chip *chip = irq_get_chip_data(irq); + struct tegra_msi *msi = to_tegra_msi(chip); tegra_msi_free(msi, d->hwirq); } diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index 52bd3a1..2204456 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c @@ -342,7 +342,7 @@ static void clear_irq(unsigned int irq) msi->msi_attrib.multiple = 0; } -static int dw_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev, +static int dw_msi_setup_irq(struct pci_dev *pdev, struct msi_desc *desc) { int irq, pos, msgvec; @@ -384,7 +384,7 @@ static int dw_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev, return 0; } -static void dw_msi_teardown_irq(struct msi_chip *chip, unsigned int irq) +static void dw_msi_teardown_irq(unsigned int irq) { clear_irq(irq); } diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 4884ee5..647bc9f 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -615,9 +615,10 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data) return IRQ_HANDLED; } -static int rcar_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev, +static int rcar_msi_setup_irq(struct pci_dev *pdev, struct msi_desc *desc) { + struct msi_chip *chip = pdev->bus->msi; struct rcar_msi *msi = to_rcar_msi(chip); struct rcar_pcie *pcie = container_of(chip, struct rcar_pcie, msi.chip); struct msi_msg msg; @@ -645,10 +646,11 @@ static int rcar_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev, return 0; } -static void rcar_msi_teardown_irq(struct msi_chip *chip, unsigned int irq) +static void rcar_msi_teardown_irq(unsigned int irq) { - struct rcar_msi *msi = to_rcar_msi(chip); struct irq_data *d = irq_get_irq_data(irq); + struct msi_chip *chip = irq_get_chip_data(irq); + struct rcar_msi *msi = to_rcar_msi(chip); rcar_msi_free(msi, d->hwirq); } diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index bff25df..782b242 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -37,7 +37,7 @@ int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) if (!chip || !chip->setup_irq) return -EINVAL; - err = chip->setup_irq(chip, dev, desc); + err = chip->setup_irq(dev, desc); if (err < 0) return err; @@ -53,7 +53,7 @@ void __weak arch_teardown_msi_irq(unsigned int irq) if (!chip || !chip->teardown_irq) return; - chip->teardown_irq(chip, irq); + chip->teardown_irq(irq); } int __weak arch_msi_check_device(struct pci_dev *dev, int nvec, int type) @@ -63,7 +63,7 @@ int __weak arch_msi_check_device(struct pci_dev *dev, int nvec, int type) if (!chip || !chip->check_device) return 0; - return chip->check_device(chip, dev, nvec, type); + return chip->check_device(dev, nvec, type); } int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) diff --git a/include/linux/msi.h b/include/linux/msi.h index 78e6b6e..a510d25 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -72,11 +72,9 @@ struct msi_chip { struct device_node *of_node; struct list_head list; - int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev, - struct msi_desc *desc); - void (*teardown_irq)(struct msi_chip *chip, unsigned int irq); - int (*check_device)(struct msi_chip *chip, struct pci_dev *dev, - int nvec, int type); + int (*setup_irq)(struct pci_dev *dev, struct msi_desc *desc); + void (*teardown_irq)(unsigned int irq); + int (*check_device)(struct pci_dev *dev, int nvec, int type); }; #endif /* LINUX_MSI_H */