From patchwork Tue Sep 22 23:49:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 7246501 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 D3494BEEC1 for ; Tue, 22 Sep 2015 23:53:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC20C209B0 for ; Tue, 22 Sep 2015 23:53:14 +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 1D4DD208D5 for ; Tue, 22 Sep 2015 23:53:14 +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 1ZeXJq-0005ab-VP; Tue, 22 Sep 2015 23:49:54 +0000 Received: from mail-ig0-x22b.google.com ([2607:f8b0:4001:c05::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZeXJh-0005Tt-U8 for linux-arm-kernel@lists.infradead.org; Tue, 22 Sep 2015 23:49:46 +0000 Received: by igcrk20 with SMTP id rk20so90966230igc.1 for ; Tue, 22 Sep 2015 16:49:24 -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=b0ooe3a8OXasuiywzALA7xOn3Wi9Hv2z+1beZnEMtfw=; b=BFN8rC3gms+v3HvpwuccJt1ycNqOZwJ5iB1C7Ny5fdNtkiPN7GMvnAhw2YbkvMVyBN NbQKti0tG8txmI2bQ3JJGaEgLX00z27N4hGcTCtexb5heGVae38fS0i2i0pHUeGdZauI Vd4faXvrfvzCEPB5qQVyMbcTXTsP/nkucB1jb76PQh8MkePZ+Gqviaw1HAvLZRCeA+D6 DzXYG40yq9+gDL76c+A6AJUqOzJPVPXCHLEJMr0Nc1RKbsvYXtlp0LtDIJFUHcK5Wv9p rQ3kmnZuARk7oclW8k/BCLe1bQxUo4bVCCfbyK6aA6kO8UB4aKA9TYIy+z4YTBqmHUqv f8Sw== X-Received: by 10.50.8.69 with SMTP id p5mr1846080iga.43.1442965764865; Tue, 22 Sep 2015 16:49:24 -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 i26sm2325101iod.27.2015.09.22.16.49.23 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 22 Sep 2015 16:49:23 -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 t8MNnMpX012970; Tue, 22 Sep 2015 16:49:22 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id t8MNnMfl012969; Tue, 22 Sep 2015 16:49:22 -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 v3 1/6] PCI: Add pci_bus_fixup_irqs(). Date: Tue, 22 Sep 2015 16:49:12 -0700 Message-Id: <1442965757-12925-2-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1442965757-12925-1-git-send-email-ddaney.cavm@gmail.com> References: <1442965757-12925-1-git-send-email-ddaney.cavm@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150922_164946_059448_650656FE X-CRM114-Status: GOOD ( 13.85 ) 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, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 --- No change from v2. 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 *);