From patchwork Fri Nov 11 13:54:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 18770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp753261wru; Fri, 11 Nov 2022 05:58:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf4a1TfeSWJaWtHVnUVvtFxiOQImZVv8TP2EyOcPfqDAft8DA6RLJIt1/sjwMiytdHUkBPqH X-Received: by 2002:a17:906:793:b0:78c:ad86:d3 with SMTP id l19-20020a170906079300b0078cad8600d3mr1877419ejc.643.1668175082918; Fri, 11 Nov 2022 05:58:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668175082; cv=none; d=google.com; s=arc-20160816; b=gLOGsdVY+UvcYOUbL0XUtYMFgEEXNIeFS9CBcIcB34rcBhtOmuWd6S4yBb0cXpT+eK wyxLqrCoLwJnF8pkUg288XzYi3yETzVrwdSLFr6N5uw4Vj8ZC0HSbeczeMNH5Sy+WIzI Um8TnbThW9i3M2bKkz99+Chht9PZoTgAN4XNcNYEZYYDLYjLBcPBngQTgmcLK5qVqhy8 Piz8A/EXqMTZXUdqFU8XyhSbkTQBDQKPMI6OCt7HMZ/fps3rHQmeyytkxdLjVg0l5BdY phUcUAjAqeNUfw6a/bG5OGCoJ1LmT0o89KsmjwSVRbNncl9FdTi5nT0k3mmREtJQrEcM oK0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=bxe0AjpBaoDMg06CufdaCUWamwxhkdwl4bTBiQjCzNI=; b=W5FXLZm/CAkPbe6/BEyfoALjfpWdKi4HQk7WR+/RBuRKgqVWAoJmR/r/+41NfcJvtJ GSItKeD/2++eVeS72Sq8UyL9S3dXbaokwO0pDC4C3/K0LoNDHHGaHESuPzNFbCbI5Ybx VrwJJdgX9Cd5MCAF9bX4APFGTed3Sa85BecFiukvhTo2ei/fO/iAxSt+8ESp7FGDSgrQ xQlOTFiBBpMMIgMGpLgDMrezo6nqF7uS9s08hE2nkQZbpaiatZybs6X7LdTgxr4Gt6Ij sz+9TUyfUOKO3LfawmA1JFuia9anL4InN01beNYj4FRsH3JspnQc9tX6RtWTEg17juWW 5CYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cMGjLzZL; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=GqtozON3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j18-20020a05640211d200b00462e628189asi2509729edw.304.2022.11.11.05.57.38; Fri, 11 Nov 2022 05:58:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cMGjLzZL; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=GqtozON3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233750AbiKKN5D (ORCPT + 99 others); Fri, 11 Nov 2022 08:57:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233592AbiKKN4D (ORCPT ); Fri, 11 Nov 2022 08:56:03 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E47295B5BF; Fri, 11 Nov 2022 05:54:55 -0800 (PST) Message-ID: <20221111122014.984490384@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668174893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=bxe0AjpBaoDMg06CufdaCUWamwxhkdwl4bTBiQjCzNI=; b=cMGjLzZLtmJIj58oYr5P3Ok8YQZLmzLoqv8TcqjtDHGQGStfIwRRz5FAYENf+XUzKGvFfS U1HqMwbCGOu0ahCBvnP2LQuO4FVRfi6O6k8841mBDJLItntDNq2ICHJfGF8UOnvYlFZE1u MX98Yle05T3N1FhK+437CoOLSQfAyuWBThsr5H67RoLT46/GqCnJG2QP2J6tNr1wDFi7CZ uGECO372Vzpln/6RAnJjnLmcyJnBJYPQkkFr8QpGCUaz1gFD7VWXhMt+ebnZbvAhE0jFBC vOwD7a/CNm1eMI6JXWXXhXxMeCiz1a0yK3djJ5QxUfmSDOqc5eODC3QC3m22Cg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668174893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=bxe0AjpBaoDMg06CufdaCUWamwxhkdwl4bTBiQjCzNI=; b=GqtozON3j5ddGqHse/b7ZFUeu9EaxdoXxaDKXGoeMNdAqhq3kEXBAFF/JTK28GaSU9IPnt NQvt0Gobxx0TOqBQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Joerg Roedel , Will Deacon , linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Marc Zyngier , Greg Kroah-Hartman , Jason Gunthorpe , Dave Jiang , Alex Williamson , Kevin Tian , Dan Williams , Logan Gunthorpe , Ashok Raj , Jon Mason , Allen Hubbe , "Ahmed S. Darwish" , Reinette Chatre , Michael Ellerman , Christophe Leroy , linuxppc-dev@lists.ozlabs.org Subject: [patch 24/39] PCI/MSI: Move pci_irq_vector() to api.c References: <20221111120501.026511281@linutronix.de> MIME-Version: 1.0 Date: Fri, 11 Nov 2022 14:54:53 +0100 (CET) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749208355735757506?= X-GMAIL-MSGID: =?utf-8?q?1749208355735757506?= From: Ahmed S. Darwish To distangle the maze in msi.c, all exported device-driver MSI APIs are now to be grouped in one file, api.c. Move pci_irq_vector() and let its kernel-doc match the rest of the file. Signed-off-by: Ahmed S. Darwish Signed-off-by: Thomas Gleixner Acked-by: Bjorn Helgaas --- drivers/pci/msi/api.c | 23 +++++++++++++++++++++++ drivers/pci/msi/msi.c | 24 ------------------------ 2 files changed, 23 insertions(+), 24 deletions(-) --- diff --git a/drivers/pci/msi/api.c b/drivers/pci/msi/api.c index 8546749afa6e..0f1ec87e3f9f 100644 --- a/drivers/pci/msi/api.c +++ b/drivers/pci/msi/api.c @@ -182,3 +182,26 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, return nvecs; } EXPORT_SYMBOL(pci_alloc_irq_vectors_affinity); + +/** + * pci_irq_vector() - Get Linux IRQ number of a device interrupt vector + * @dev: the PCI device to operate on + * @nr: device-relative interrupt vector index (0-based); has different + * meanings, depending on interrupt mode + * MSI-X the index in the MSI-X vector table + * MSI the index of the enabled MSI vectors + * INTx must be 0 + * + * Return: the Linux IRQ number, or -EINVAL if @nr is out of range + */ +int pci_irq_vector(struct pci_dev *dev, unsigned int nr) +{ + unsigned int irq; + + if (!dev->msi_enabled && !dev->msix_enabled) + return !nr ? dev->irq : -EINVAL; + + irq = msi_get_virq(&dev->dev, nr); + return irq ? irq : -EINVAL; +} +EXPORT_SYMBOL(pci_irq_vector); diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index a028774f438d..38ad2fe4b85c 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -900,30 +900,6 @@ void pci_free_irq_vectors(struct pci_dev *dev) EXPORT_SYMBOL(pci_free_irq_vectors); /** - * pci_irq_vector - return Linux IRQ number of a device vector - * @dev: PCI device to operate on - * @nr: Interrupt vector index (0-based) - * - * @nr has the following meanings depending on the interrupt mode: - * MSI-X: The index in the MSI-X vector table - * MSI: The index of the enabled MSI vectors - * INTx: Must be 0 - * - * Return: The Linux interrupt number or -EINVAl if @nr is out of range. - */ -int pci_irq_vector(struct pci_dev *dev, unsigned int nr) -{ - unsigned int irq; - - if (!dev->msi_enabled && !dev->msix_enabled) - return !nr ? dev->irq : -EINVAL; - - irq = msi_get_virq(&dev->dev, nr); - return irq ? irq : -EINVAL; -} -EXPORT_SYMBOL(pci_irq_vector); - -/** * pci_irq_get_affinity - return the affinity of a particular MSI vector * @dev: PCI device to operate on * @nr: device-relative interrupt vector index (0-based).