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=1796128226; b=doMK9VT8DFz4CjMUh42IRmSJZSwRt5t4A/B8rquPtpM9VmgbVuxCA+2R4ngNyBFtkmEa Yzm+AQ5OpLKSVdnlHrVSD1lvsjw9uJRsOtxc8GjTEOsqUVLvdgR5/EQ8YIgJsMVN4bPdC MYwjM/ru4nJDb+OJJCKql9MgC37RaxLPqiu/uiSt8pHKR8vjitjkV32zuhshfk9X9amGb oUfv2sg4Gu4kr6L/inaTni86DWnKHDYu0WgE7VFykD0e3iny02CkIXul8aAPj3Xes1cq4 B5Ufxp0ZKsCs0IjHyM0spxtd5UkN37KXxMZmXDQw8bmAUKApxrMPp/clFb58sE7xSYQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796128226; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=zBbxhb8FkqpE0FGK/UDbSyby81zrf/0BJZZ6s81GOQM=; b=UlhIdpNIQHN5WBG0nHhNxUjjOw5RBTWG3eWlJ/9yKwalliHWhNIHXK64cy8EOtwkP0vt 7rIJMxway8nv3X2VyQx/VbsEjkqLSvrDRQeR3O31Og/+AxiZiNXOXgxcuVuH0//Ngs2xK T3/cFCG4fnqZjOcQ7/PZtdSplNm7YqV7z+pgqZzz233EXdyV2ZAf/l59XuNkzFtwivCRI ty3LDVeLJlJw/5Qi/pKWRdBY4upkK11tNK/e1OsbGu1itKeoQfvEQgFawf4fUAs5afrVp F+aXhxzkzWywvvV9K6tjulFa+0eHJlGjMskfhx4VuIdVRIgg01600D0f3xE8aZ3n7QA== 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=ZdtllAkp; 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 F350C606A320 for ; Tue, 1 Dec 2026 12:30:25 +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=ZdtllAkp Received: by smtp.kernel.org (Postfix) with ESMTPSA id D45B41F00897; Tue, 1 Dec 2026 12:30:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796128225; bh=zBbxhb8FkqpE0FGK/UDbSyby81zrf/0BJZZ6s81GOQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ZdtllAkpvDnuw/UsEcnrfyKFj5vrN4yiU0uaTO77g6B9fDqDgRo9Re0Cc9eEea1if 4ySYqRD+L7wpinHZ1bHe+xXZk2Dvp+sO004th48AWoijXy/rNi9E/IFv6t/sMR9ZST E9pBLG0ejTrT5PAqanYvtRglRrI42nfEzmJhKoRW0JbnJgk2bSbNDNZl+9TnBgy03h ZzQAkkKbnh+O5GjewDqf4J28XebLZ3tBz31yNYi7fCffn/BJyyGU4LHaksmQxXKtE9 dFTSTnpXf6bb6b+ALgBDhlOJe0uDwGnF1CjcqvzzxFqUWNSimLGp4FcD08sabw3P6C MiTAdWPQ6QI9w== From: Philipp Stanner To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, Philipp Stanner Subject: [PATCH 2/3] PCI: Better document pcim_enable_device() Date: Tue, 1 Dec 2026 13:29:51 +0100 Message-ID: <20261201122951.904104-4-phasta@kernel.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261201122951.904104-2-phasta@kernel.org> References: <20261201122951.904104-2-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 in remove(). 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 9a085fb18100..afc7e966bb32 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