From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796302427; b=qJGohCcslo7wF3z1lG29ZJp42stIWwc3MDwaut01seWfFYjwFJ5XHj511D7s9zjhIDcq zSG8iZcbtYBHL3rr/yJdnoXGFUOD+KefwMivqdMWnAPn8v0tgacDPpDh6pFeCCAhiK9nj QeDrCqs+T/9eF6BA7RrxaoWnu6/+dENEmxIbdtIUjYkZpm9q7712vWdum9Ao7mcZ89WVO EIBNC+vjuVeJwD1/T7f3rYViVS6KIWtspeWiV6h73SJ/WS3EzsR9+mNHWjVHvgJRM6DVu J0dyDdYCg9a7acWu2UisxsJ/nyAWJY47lYIR4PKgvYq2AvXmhqGcMwuqi6mOljKA2YA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796302427; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=A/idx+qonijmp1i3XVSjGEf62oj6A6zHepZO9WnRITQ=; b=ot3Y+shK7pJ2Z7Nowu/StTqjXwa49wTohQx5Qfd98elimwcPE/2XSkjbbx/7U7eiI4Gr /NlMEV5YhEdABpEqqbamNCket41rQVsGbL9D4badK+14XuNEVbotmJw6DZCSm9rGbRnDp bdU7dC0fWcia/QCkG9lgOn0qQxlMrGs4Brcqm5VfLVbWsE5Sq4f3/tw+rWOrYnjlh8QMh QV0QZepsar5PuLTJXs6TfizIh6L+SXmJu8shwTcQsdwX1XXKaYKXbkUU/7ErufgcxFO3U D0vKMtXql3fPYJcSh8pII75P6lCYbtmZ0Vfe+MYUZojd4c+TxdwTLNYb1iStaXI6Tjw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eCmvCerm; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7023B606A322 for ; Thu, 3 Dec 2026 12:53:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eCmvCerm Received: by smtp.kernel.org (Postfix) with ESMTPSA id 510CA1F000C1; Thu, 3 Dec 2026 12:53:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796302427; bh=A/idx+qonijmp1i3XVSjGEf62oj6A6zHepZO9WnRITQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eCmvCermeGxt0OuVRhNIScz1U+p4SWhZyoI3MlKD9rIJL7IiIMyVFDfWkQLRCUYBu dnMfKwBuLSW5xP0cItstR5r9seCE7BkyxA0YwbTPEuNGNJrfHAF3+bQou8pulfWppq JeNzMyCMWLexEC/ioY03wGy7qLeNojgCkVsOH+l3FmXS+Yh9VaWfI4arze/cQZT0BZ VWbgHUSdGxNE1fezvL6PNE6yiU/ofoGCVUMzeGZ9ik6IPJ37+K2p0ZkG4Nr/FJg4MR aOnP8RJvhvIz//Rd44tYjVCmslbBsAkiQaJhepGlay5NpwUpHgb5DdOmmwbrGMgGc6 IC62LdJcxL9CQ== From: Philipp Stanner To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, Philipp Stanner Subject: [PATCH v2 2/3] PCI: Better document pcim_enable_device() Date: Thu, 3 Dec 2026 13:53:29 +0100 Message-ID: <20261203125328.2421736-5-phasta@kernel.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261203125328.2421736-3-phasta@kernel.org> References: <20261203125328.2421736-3-phasta@kernel.org> X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit pcim_enable_device() enables a PCI device and registers a devres action which will automatically disable the device on driver detach. Users should only use it if they want to fully rely on automatic resource management. Unfortunately, users often get the function's purpose wrong and intermingle it with manual calls to pci_disable_device() et al. Better document what pcim_enable_device() is intended for and when it should be used. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index 48451581516a..3e49017bb717 100644 --- a/drivers/pci/devres.c +++ b/drivers/pci/devres.c @@ -365,7 +365,11 @@ static void pcim_disable_device(void *pdev_raw) * Returns: 0 on success, negative error code on failure. * * Managed pci_enable_device(). Device will automatically be disabled on - * driver detach. + * driver detach. You should only use this function in probe(), not in, e.g., + * resume(). + * + * If you need manual enabling and disabling, use pci_enable_device() paired + * with pci_disable_device(). Do not mix them with pcim_enable_device(). */ int pcim_enable_device(struct pci_dev *pdev) { -- 2.56.0