From patchwork Thu Nov 17 15:08:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 21720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp453049wrr; Thu, 17 Nov 2022 07:11:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf4zrGtqBRYJR7uf9EqzWS/2mjvCjiwGpy/BeK+3rdp+NiMBfS2G+Ve0RJff7FDA+MY6Z+m0 X-Received: by 2002:aa7:d803:0:b0:467:f948:6df4 with SMTP id v3-20020aa7d803000000b00467f9486df4mr2482675edq.217.1668697887355; Thu, 17 Nov 2022 07:11:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668697887; cv=none; d=google.com; s=arc-20160816; b=O6ysgMCgv2UMcULhUdtZs2gDZyWtUBMMrpJAy31fh5JHtXE50Vyrp3tpQZVpxdjxdC d46t4WOvE0g+PHXDmT5y7R9BqKUstgeb14ji2und+IEf+MFbMYc/zV2zV/3hLcUOjQ2B 1liWUNaNGAIfpl5BQ6velYDUgNarfzNE73/tbQun7yrBkX4BVPzctm4SwZ1z/dIDgMej 8hEYI5hLpLwWUdOM1HAenxBD1U0yMIrNWBjj4TAqdol4WTPM5rniz+bUc+li76Os8Gex F+Sa2BSgaOoKDgbt/RNddnd7ipMh6m7FH1s9DJ9mlINsIPcnXmjfL5KlzV/JWxp90duI N6eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=peJq8Ks1dEw3XWuTUsuDaZpzNCb022fzg98JsheBEA0=; b=Kh+t4/uMY4W/iibRBCS0iIpYrL6Pwk62XhHoIDKr+nQeeswsoCdt3NS8mwFj9TR803 08ElRYi/FodCwQkQQmUfXPPyExrUt9ETjY1djrWoQ1X2/We3Pmlh04sfdyCQeTTOvxNA +46QfTHJrX3X7PcxbWnRYZOng06r6FwcXKPinZbagToRJ4JRnW9WHXnvVAj8Ys62/EDL IZHvzbuusmrLKyvLUFEIRSvO/BsE7qyuvVFLAwGg/wGjSwjTlWmhUrkCmWWJsiwduDUI TkDtY29Qr/TyrpUaGrVzdtS2Ubgisd6bGjfDxMMLM3OKPrQ5g/KIhdOGEUk7tof8lEFP SaZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="K53tl4K/"; dkim=neutral (no key) header.i=@linutronix.de; 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 y16-20020a056402359000b00461d28ac266si1057000edc.579.2022.11.17.07.10.57; Thu, 17 Nov 2022 07:11:27 -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="K53tl4K/"; dkim=neutral (no key) header.i=@linutronix.de; 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 S240255AbiKQPKD (ORCPT + 99 others); Thu, 17 Nov 2022 10:10:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240373AbiKQPJW (ORCPT ); Thu, 17 Nov 2022 10:09:22 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B82F97818F; Thu, 17 Nov 2022 07:08:14 -0800 (PST) Date: Thu, 17 Nov 2022 15:08:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668697693; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=peJq8Ks1dEw3XWuTUsuDaZpzNCb022fzg98JsheBEA0=; b=K53tl4K/CgjdNQE9WUi2XoL8BGSBhN3P5brdpY8Xxp7PLsC/Vf7mTaLwQfM7Q6E4E7wdgx 08RbhEcfV4OAWV24WRFvSNX6gPeue7OLmkyDzeDBtYx8Sck0HEuxg5hajKHc6Wyzgg1/WK GaPqEpG3dx3ARR1sTTf+ioXsvD6FaL+7QqKmApugj+wm0QJRIgOdjDanyHy6m0h/vNoI+u BrTcRds1xRxktK14uUTPCyGAApe70yYaVLTUw/nnOUkiIpvB8LWKUwa+iNhFBGT7RzmZ04 PcILAeYQnYFy92mJN51bZeakNt9hRjEzqFgIbliiTCcG3SSIhdzDG0uyTV+tZQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668697693; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=peJq8Ks1dEw3XWuTUsuDaZpzNCb022fzg98JsheBEA0=; b=XVrFIr+pAAW0IQ4q8a8zzeMiYifvFe3wa89sKStz/9GtOfggywpazY5JJbLOcX5blWHzUd 9lisITNEgwq3DkAQ== From: "tip-bot2 for Ahmed S. Darwish" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] PCI/MSI: Move pci_enable_msi() API to api.c Cc: "Ahmed S. Darwish" , Thomas Gleixner , Bjorn Helgaas , x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20221111122014.755178149@linutronix.de> References: <20221111122014.755178149@linutronix.de> MIME-Version: 1.0 Message-ID: <166869769215.4906.1971584986944692969.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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?1749208338166041756?= X-GMAIL-MSGID: =?utf-8?q?1749756556213452496?= The following commit has been merged into the irq/core branch of tip: Commit-ID: bbda3407982211123caadbfdee23594647bd4516 Gitweb: https://git.kernel.org/tip/bbda3407982211123caadbfdee23594647bd4516 Author: Ahmed S. Darwish AuthorDate: Fri, 11 Nov 2022 14:54:46 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 17 Nov 2022 15:15:20 +01:00 PCI/MSI: Move pci_enable_msi() API to api.c To disentangle 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 Link: https://lore.kernel.org/r/20221111122014.755178149@linutronix.de --- 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 7485942..63d7f8f 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 4a1300b..98f07ad 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 6348792..00bb98d 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