From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD065C4332F for ; Wed, 16 Nov 2022 16:30:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239114AbiKPQaF (ORCPT ); Wed, 16 Nov 2022 11:30:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239159AbiKPQ3r (ORCPT ); Wed, 16 Nov 2022 11:29:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFC506035F; Wed, 16 Nov 2022 08:24:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7B3C6B81DE2; Wed, 16 Nov 2022 16:23:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7905C433C1; Wed, 16 Nov 2022 16:23:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668615838; bh=DiTEt8XP0MxtxKbF5ev7VXOTUwbITQ2VyXFIkyGrEn4=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=PJ6wYAJRMkj/NnbJKwutaEqZGsul0Y5oZ+yT84rWOuJiP+x2WAy2XC1Hdsnf2CweP Y0+tPWImMSwYmXIsB64fs2r3+RwLwvptw8bZNL/hnIdDAGQoshhpq2d+G4awA8LAEi cbUeZHPd0sTqISD9d50J//8Xvlv1QxAiamBAD7GWuiHsBIQQQZ/Kdle1bKcYK2sTIe NQgxmVstgW3cEmnfco4AZJUTpnhbNfpEElLkIPJXmpTyq30zRs0Dn2VzVeYjl0Z/We TaVLWE0vlpVmCGS9+QNfYXtDa7eocyk+ce9knsywPyNpt11zw1FZyBCTGgYY2Yi4Q9 /uoSU11QFLcxw== Date: Wed, 16 Nov 2022 10:23:56 -0600 From: Bjorn Helgaas To: Thomas Gleixner Cc: LKML , 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: Re: [patch 24/39] PCI/MSI: Move pci_irq_vector() to api.c Message-ID: <20221116162356.GA1115513@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221111122014.984490384@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Fri, Nov 11, 2022 at 02:54:53PM +0100, Thomas Gleixner wrote: > 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). >