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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1AE5C4332F for ; Wed, 16 Nov 2022 16:20:18 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4NC7Yr6mDGz3f6Z for ; Thu, 17 Nov 2022 03:20:16 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=FlscaLWa; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:4641:c500::1; helo=dfw.source.kernel.org; envelope-from=helgaas@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=FlscaLWa; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4NC7X35jrBz3cQk for ; Thu, 17 Nov 2022 03:18:43 +1100 (AEDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 53F9361E6A; Wed, 16 Nov 2022 16:18:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D73DAC433D6; Wed, 16 Nov 2022 16:18:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668615521; bh=xsQa1DiNL/6zsloEcEu6Ukvgx+aoLHbVelli9P0JdkE=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=FlscaLWaTxDQUiFYrKfxiw8Is512INpNfhSwD6LYRM/LnWLISkfHWVCN+HI/HB9Py CsOhz4ZFu9t7L185gW+tLdKnqOtA3Vi5HLkuAa1nZI7K6BAv9o39vy1Lv1qTxuBuGQ KyiF119c19UlukBK0owCVhyFtkaOtpHJI6YvfTw/wRpXfbq0DchoKF8zCS3SR5PP3q ZwhtzlykAPL9KZKn5sXdOJ5n5ZirM7s3EoBn1D84oSCdfUjX2DfIIqirJqJOU53hDC R07my9UXS+C1zX0eVsWpoRdG26lfCPZWHT7PBdtjzRHCgNFiNEyVCzm12MEAqnv7fj ixetgCl6U1k3g== Date: Wed, 16 Nov 2022 10:18:39 -0600 From: Bjorn Helgaas To: Thomas Gleixner Subject: Re: [patch 20/39] PCI/MSI: Move pci_enable_msi() API to api.c Message-ID: <20221116161839.GA1115061@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221111122014.755178149@linutronix.de> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pci@vger.kernel.org, Will Deacon , Lorenzo Pieralisi , Dave Jiang , Ashok Raj , Joerg Roedel , x86@kernel.org, Jason Gunthorpe , Allen Hubbe , Kevin Tian , "Ahmed S. Darwish" , Jon Mason , linuxppc-dev@lists.ozlabs.org, Alex Williamson , Bjorn Helgaas , Dan Williams , Reinette Chatre , Greg Kroah-Hartman , LKML , Marc Zyngier , Logan Gunthorpe Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, Nov 11, 2022 at 02:54:46PM +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_enable_msi() and make its kernel-doc comprehensive. > > Signed-off-by: Ahmed S. Darwish > Signed-off-by: Thomas Gleixner Acked-by: Bjorn Helgaas Nit: suggest "disentangle" or "untangle" for "distangle" here and in subsequent patches. > --- > drivers/pci/msi/api.c | 23 +++++++++++++++++++++++ > drivers/pci/msi/msi.c | 14 ++------------ > drivers/pci/msi/msi.h | 1 + > 3 files changed, 26 insertions(+), 12 deletions(-) > --- > diff --git a/drivers/pci/msi/api.c b/drivers/pci/msi/api.c > index 7485942cbe5d..63d7f8f6a284 100644 > --- a/drivers/pci/msi/api.c > +++ b/drivers/pci/msi/api.c > @@ -13,6 +13,29 @@ > #include "msi.h" > > /** > + * pci_enable_msi() - Enable MSI interrupt mode on device > + * @dev: the PCI device to operate on > + * > + * Legacy device driver API to enable MSI interrupts mode on device and > + * allocate a single interrupt vector. On success, the allocated vector > + * Linux IRQ will be saved at @dev->irq. The driver must invoke > + * pci_disable_msi() on cleanup. > + * > + * NOTE: The newer pci_alloc_irq_vectors() / pci_free_irq_vectors() API > + * pair should, in general, be used instead. > + * > + * Return: 0 on success, errno otherwise > + */ > +int pci_enable_msi(struct pci_dev *dev) > +{ > + int rc = __pci_enable_msi_range(dev, 1, 1, NULL); > + if (rc < 0) > + return rc; > + return 0; > +} > +EXPORT_SYMBOL(pci_enable_msi); > + > +/** > * pci_disable_msi() - Disable MSI interrupt mode on device > * @dev: the PCI device to operate on > * > diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c > index 4a1300b74518..98f07ad9af62 100644 > --- a/drivers/pci/msi/msi.c > +++ b/drivers/pci/msi/msi.c > @@ -790,8 +790,8 @@ void pci_disable_msix(struct pci_dev *dev) > } > EXPORT_SYMBOL(pci_disable_msix); > > -static int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec, > - struct irq_affinity *affd) > +int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec, > + struct irq_affinity *affd) > { > int nvec; > int rc; > @@ -844,16 +844,6 @@ static int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec, > } > } > > -/* deprecated, don't use */ > -int pci_enable_msi(struct pci_dev *dev) > -{ > - int rc = __pci_enable_msi_range(dev, 1, 1, NULL); > - if (rc < 0) > - return rc; > - return 0; > -} > -EXPORT_SYMBOL(pci_enable_msi); > - > static int __pci_enable_msix_range(struct pci_dev *dev, > struct msix_entry *entries, int minvec, > int maxvec, struct irq_affinity *affd, > diff --git a/drivers/pci/msi/msi.h b/drivers/pci/msi/msi.h > index 634879277349..00bb98d5bb0e 100644 > --- a/drivers/pci/msi/msi.h > +++ b/drivers/pci/msi/msi.h > @@ -87,6 +87,7 @@ static inline __attribute_const__ u32 msi_multi_mask(struct msi_desc *desc) > /* MSI internal functions invoked from the public APIs */ > void pci_msi_shutdown(struct pci_dev *dev); > void pci_free_msi_irqs(struct pci_dev *dev); > +int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec, struct irq_affinity *affd); > > /* Legacy (!IRQDOMAIN) fallbacks */ > #ifdef CONFIG_PCI_MSI_ARCH_FALLBACKS >