Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2168084rwb; Thu, 17 Nov 2022 07:22:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf5dbQzG3VIOm2VxRhv51hM8pYa22u83mzs2N8Xk1psnnqOLO+vEBWS9VT8jVuXL0n5PVIz0 X-Received: by 2002:a17:902:e8d8:b0:188:b840:deec with SMTP id v24-20020a170902e8d800b00188b840deecmr3330830plg.15.1668698561153; Thu, 17 Nov 2022 07:22:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668698561; cv=none; d=google.com; s=arc-20160816; b=xOtrEwm5mtBdbLF8EEZ2IVaj4A61WmUSNIzHcUQcrB/247loMHwzNqmui2uv0XMzbU /SND8AYAY4YrxsDy7k4JBckkpGlJ7VJ4j4kp12TcobC3Qiqgm9SSssJ31f5tMfXREfzp cNrbVBiw3HFFqCtZyVuqH5JNciwDJsn3CbbGRc6JoM3bnbgDUvd/13BThTUixstBuus/ xDGClarhYrwpR9BuwRDHcG+eNELabmUN5hfuJ5tUKAimt6YF2/Q5t5y26DWaeuY9iejH 5PGPp76ENm8lPmj2VXodL0hb2Tya9UaURjota8GBAzWh/7w+0TNZonoVBNliBTOm2TOD n8KA== 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=U0EA+g4Bcyz2I47A6x9+qV6VZ1P347eeX/eR5+TVmlc=; b=dDSrgeN11UM+BiBLdu3iERDV9/gTs4HhIJxtL6cohEZMk2obv3LiJp/ZZCBHwDA9E/ mChJMA9gPfAIee9SrEGAYbCNgLeV6EUoFtO5ETJ+IaDnSR+ZgbgnUL4o7IrKY9Ha0hq8 EQ/XddCsS2JRsQ2NkRjMrOr80ZVZYQQOnK/a6K5vaimtmFp6QSRyTMfBx7BC3y4vWKIf JbnG7+HfJJE02696cK1vYapJu4ykcsJGotypkYvVgkVWYUatvIFEQ1wVZGOOFWdILP/F F4oNO/QmB9ZU4W00wRf9F6QxWF15rejN3EdwF9VQ115PxXrC+7QElVZjeMBvwsw14Gue bNIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oLdys8Gr; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a63d104000000b0046fb2a57348si1213774pgg.84.2022.11.17.07.22.18; Thu, 17 Nov 2022 07:22:41 -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=oLdys8Gr; 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 S240319AbiKQPJa (ORCPT + 92 others); Thu, 17 Nov 2022 10:09:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240285AbiKQPIu (ORCPT ); Thu, 17 Nov 2022 10:08:50 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0711E7721F; Thu, 17 Nov 2022 07:08:08 -0800 (PST) Date: Thu, 17 Nov 2022 15:08:05 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668697686; 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=U0EA+g4Bcyz2I47A6x9+qV6VZ1P347eeX/eR5+TVmlc=; b=oLdys8GrKc1rBQWSF81TyiXDk1FW3/Mpborfl6iOC6ihd5p8cQP3LIvikCv1y9om198Egm 1lwJ3s04SeztseFpjlv+VYOCvHueoMnfx9Sre212VmJCbshKgYT8Y3dR8JuaCk/gffgxuS sYF6DX8wErU928PPLrOKhBDxXokPG7Y0uWQoUY6plGu12iohYHZdD13yzuJ428SsQnH12D +AajRqUkOtEmGuM2RUFJpYiaC+99PZIkd2eU0NhcIwuz80SXY6qvITscT8EstNqWMeWUiD WZsX3AWIzA9AriToMRo+byQ1Q8KYJbs/h7sPG8NYEiHf5tqGGFy6NL1WWlQdyg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668697686; 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=U0EA+g4Bcyz2I47A6x9+qV6VZ1P347eeX/eR5+TVmlc=; b=jTQUljMiEQonEh0A1SUtxKm1P2jpyyYx7CKlYAlqA606+UxM8/luK7cXsjJKJyadEWKd2F N1h5Z2VAIF6BmmAg== 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_msix_vec_count() 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: <20221111122015.099461602@linutronix.de> References: <20221111122015.099461602@linutronix.de> MIME-Version: 1.0 Message-ID: <166869768535.4906.5642923343631874738.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 The following commit has been merged into the irq/core branch of tip: Commit-ID: 7b50f62776672e7b328455eddc90ceb01b64ac3e Gitweb: https://git.kernel.org/tip/7b50f62776672e7b328455eddc90ceb01b64ac3e Author: Ahmed S. Darwish AuthorDate: Fri, 11 Nov 2022 14:54:56 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 17 Nov 2022 15:15:21 +01:00 PCI/MSI: Move pci_msix_vec_count() 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_msix_vec_count() 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/20221111122015.099461602@linutronix.de --- drivers/pci/msi/api.c | 20 ++++++++++++++++++++ drivers/pci/msi/msi.c | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/pci/msi/api.c b/drivers/pci/msi/api.c index 2ff2a9c..83ea38f 100644 --- a/drivers/pci/msi/api.c +++ b/drivers/pci/msi/api.c @@ -60,6 +60,26 @@ void pci_disable_msi(struct pci_dev *dev) EXPORT_SYMBOL(pci_disable_msi); /** + * pci_msix_vec_count() - Get number of MSI-X interrupt vectors on device + * @dev: the PCI device to operate on + * + * Return: number of MSI-X interrupt vectors available on this device + * (i.e., the device's MSI-X capability structure "table size"), -EINVAL + * if the device is not MSI-X capable, other errnos otherwise. + */ +int pci_msix_vec_count(struct pci_dev *dev) +{ + u16 control; + + if (!dev->msix_cap) + return -EINVAL; + + pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control); + return msix_table_size(control); +} +EXPORT_SYMBOL(pci_msix_vec_count); + +/** * pci_enable_msix_range() - Enable MSI-X interrupt mode on device * @dev: the PCI device to operate on * @entries: input/output parameter, array of MSI-X configuration entries diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index ed8caf5..1226d66 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -701,26 +701,6 @@ void pci_msi_shutdown(struct pci_dev *dev) pcibios_alloc_irq(dev); } -/** - * pci_msix_vec_count - return the number of device's MSI-X table entries - * @dev: pointer to the pci_dev data structure of MSI-X device function - * This function returns the number of device's MSI-X table entries and - * therefore the number of MSI-X vectors device is capable of sending. - * It returns a negative errno if the device is not capable of sending MSI-X - * interrupts. - **/ -int pci_msix_vec_count(struct pci_dev *dev) -{ - u16 control; - - if (!dev->msix_cap) - return -EINVAL; - - pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control); - return msix_table_size(control); -} -EXPORT_SYMBOL(pci_msix_vec_count); - static int __pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec, struct irq_affinity *affd, int flags) {