From patchwork Thu Sep 17 22:02:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 7211201 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B6C89BEEC1 for ; Thu, 17 Sep 2015 22:04:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D8B7A204FC for ; Thu, 17 Sep 2015 22:04:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07E5520702 for ; Thu, 17 Sep 2015 22:04:32 +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 1ZchGU-0003YV-Tj; Thu, 17 Sep 2015 22:02:50 +0000 Received: from mail-ig0-x229.google.com ([2607:f8b0:4001:c05::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZchGL-0003R3-7l for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2015 22:02:41 +0000 Received: by igbkq10 with SMTP id kq10so23109278igb.0 for ; Thu, 17 Sep 2015 15:02:20 -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:in-reply-to:references; bh=AVLf/1hsr6aHfS/eXUyTQknqib3bxw4cj1j9rUWKbeY=; b=BC1ROCo3ozUDRyp3dpapdCyFBk3kIU/cxO9B46kuW4gGxprDLWMJIL6++SrwEPdKaI yl9YeP3zdjDnNM2GHduL8UY8a9JIJg0gEha3Cl/gbjgkWs34bPuXvl0G8dx3yBJf1xlf kULHZE4dZm9liDMJbXny4KKKIS451whRj+uaGgsJTNU/pQqdZPmuayLqC22DyEkIfmNW lsL/5Z+Iy9r1HbSv18dv/vpPdG/wjC360wAtulgBDljpb6OKEYfqz/mzuyYUEBluZPyE CYqpcjp6q1f49byFU1CnZUT8bu0oMxqb0CnadS7/9DfZDMHmBgsr2i9+LckbU0FwX4KI I44Q== X-Received: by 10.50.66.197 with SMTP id h5mr28434858igt.82.1442527340349; Thu, 17 Sep 2015 15:02:20 -0700 (PDT) Received: from dl.caveonetworks.com (64.2.3.194.ptr.us.xo.net. [64.2.3.194]) by smtp.gmail.com with ESMTPSA id y6sm5099270igl.17.2015.09.17.15.02.18 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 17 Sep 2015 15:02:18 -0700 (PDT) Received: from dl.caveonetworks.com (localhost.localdomain [127.0.0.1]) by dl.caveonetworks.com (8.14.5/8.14.5) with ESMTP id t8HM2Hw0001225; Thu, 17 Sep 2015 15:02:17 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id t8HM2Hsw001224; Thu, 17 Sep 2015 15:02:17 -0700 From: David Daney To: linux-kernel@vger.kernel.org, Bjorn Helgaas , linux-pci@vger.kernel.org, Will Deacon , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Marc Zyngier Subject: [PATCH v2 1/5] PCI: Add pci_bus_fixup_irqs(). Date: Thu, 17 Sep 2015 15:02:08 -0700 Message-Id: <1442527332-1174-2-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1442527332-1174-1-git-send-email-ddaney.cavm@gmail.com> References: <1442527332-1174-1-git-send-email-ddaney.cavm@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150917_150241_326915_11CE936A X-CRM114-Status: GOOD ( 13.48 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Daney MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 From: David Daney pci_bus_fixup_irqs() works like pci_fixup_irqs(), except it only does the fixups for devices on the specified bus. Follow-on patch will use the new function. Signed-off-by: David Daney --- This patch didn't exist in v1 of the set. drivers/pci/setup-irq.c | 30 ++++++++++++++++++++++++++++++ include/linux/pci.h | 4 ++++ 2 files changed, 34 insertions(+) diff --git a/drivers/pci/setup-irq.c b/drivers/pci/setup-irq.c index 95c225b..189ad17 100644 --- a/drivers/pci/setup-irq.c +++ b/drivers/pci/setup-irq.c @@ -66,3 +66,33 @@ void pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *), pdev_fixup_irq(dev, swizzle, map_irq); } EXPORT_SYMBOL_GPL(pci_fixup_irqs); + +struct pci_bus_fixup_cb_info { + u8 (*swizzle)(struct pci_dev *, u8 *); + int (*map_irq)(const struct pci_dev *, u8, u8); +}; + +static int pci_bus_fixup_irq_cb(struct pci_dev *dev, void *arg) +{ + struct pci_bus_fixup_cb_info *info = arg; + + pdev_fixup_irq(dev, info->swizzle, info->map_irq); + return 0; +} + +/* + * Fixup the irqs only for devices on the given bus using supplied + * swizzle and map_irq function pointers + */ +void pci_bus_fixup_irqs(struct pci_bus *bus, + u8 (*swizzle)(struct pci_dev *, u8 *), + int (*map_irq)(const struct pci_dev *, u8, u8)) +{ + struct pci_bus_fixup_cb_info info; + + info.swizzle = swizzle; + info.map_irq = map_irq; + pci_walk_bus(bus, pci_bus_fixup_irq_cb, &info); + +} +EXPORT_SYMBOL_GPL(pci_bus_fixup_irqs); diff --git a/include/linux/pci.h b/include/linux/pci.h index e90eb22..b505b50 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1120,6 +1120,10 @@ void pdev_enable_device(struct pci_dev *); int pci_enable_resources(struct pci_dev *, int mask); void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), int (*)(const struct pci_dev *, u8, u8)); +void pci_bus_fixup_irqs(struct pci_bus *, + u8 (*)(struct pci_dev *, u8 *), + int (*)(const struct pci_dev *, u8, u8)); + #define HAVE_PCI_REQ_REGIONS 2 int __must_check pci_request_regions(struct pci_dev *, const char *); int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *);