From patchwork Fri Oct 2 18:43:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 7318471 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 432E79F1B9 for ; Fri, 2 Oct 2015 18:48:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A84120855 for ; Fri, 2 Oct 2015 18:48:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 68D4620610 for ; Fri, 2 Oct 2015 18:48:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753446AbbJBSoO (ORCPT ); Fri, 2 Oct 2015 14:44:14 -0400 Received: from mail-io0-f179.google.com ([209.85.223.179]:35533 "EHLO mail-io0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753383AbbJBSoL (ORCPT ); Fri, 2 Oct 2015 14:44:11 -0400 Received: by ioiz6 with SMTP id z6so129527284ioi.2; Fri, 02 Oct 2015 11:44:10 -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=ScnNnh6ikl+2bSz6zRpaNYu1d+dx51eSE/wYi6a2C14=; b=nxH1KoL1jaHQ/ievWNLPZwcdC02Dc2seJfSeC5YhSL597yZr5I7vzGrUuKqllxvsff gXAtaSLGLtgl52SD+3Vc1P5i8/+oAbHuW4kp2T4f60YwWpwIw97Z/md4y7vJESmpiyDd QWNNO8fOdsEUQIObNPemnrSppywPsicQUWyqCsHypHnoqVpMjVcNRpujYNMNPPueq577 WwKFmXXSgai29I4IdrhsAI/bwsmtxnEwQxiw8EPVh/yaKcb6f+N/0rbmsXORq16gOMoz 8QK+WWofch+YwWYhgCEWA+QjA64ddKftYf6od5F02tuMJhHWUsatSH8vgBDFRFqS3Cjk 43gQ== X-Received: by 10.107.6.209 with SMTP id f78mr20412314ioi.194.1443811450486; Fri, 02 Oct 2015 11:44:10 -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 d7sm137097igl.1.2015.10.02.11.44.07 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 02 Oct 2015 11:44:08 -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 t92Ii6Il018921; Fri, 2 Oct 2015 11:44:06 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id t92Ii6CA018920; Fri, 2 Oct 2015 11:44:06 -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 Cc: David Daney Subject: [PATCH v4 1/5] PCI: Add pci_bus_fixup_irqs(). Date: Fri, 2 Oct 2015 11:43:59 -0700 Message-Id: <1443811443-18878-2-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1443811443-18878-1-git-send-email-ddaney.cavm@gmail.com> References: <1443811443-18878-1-git-send-email-ddaney.cavm@gmail.com> 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 --- No change from v2. 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 *);