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=1796383208; b=Cfa107wW/Qzw61Q+7BV48WdtMScvUM4pen/lDTBQ2JaD4GckP045CPa0R4G9eXCZ7SBD DEizaRwMD9gARZFfbvXdKhdH2+7ajC9CeMCCXz/XiQ53ixUg9cBP1XEY4gcG4gCXjJx2y 8S6eG34uzTULZYoJJ8CtWsShpPi2FTBzNjwxKI1TRs0+/vY44rMrES4x3veWpUvGsmYHv 67L8MADksFFhYWvarDzyAsJZYXuFqsqoII+CeQPB2bdGJTEdRHdWjkMw9R9t8LVxI3PTk Hn8U7Wyqs8BClNbB5DtcAqx/TkjEf1oJXPc70FKMnl1ulwahs3JKKi22LEjzzwDZJxw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383208; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=H+1YAu6XCMGIHnY5qdjmBEVD1mP7VM2Zk7PdNeuzfD0=; b=w4R0odSze+LGgIh2K8+QShfxcAGoNzWgevGg5TxrBrlz65KSpUIjUoyHbJM6uOgrTz5w SDj7q+7Akq4tb3sEw/4kvVGRjVe8xwRrtJT4hkKtRpbwv4e24TWdy5RcyFoTiM2FVVDFk 3qSiFGJGrJnSz2Apl+xuMwZFE3W0c4+8ZvE0ZeQfSAtXTyRjGwRuzq/B5dETLdJpI6V8W iKhMS+MzJhBzGpquyu+y3wCk8+3ao1YBQzEm+ElS0grWpVCotAoCYDrbZF38Ts6ihOcf0 bU59hCmNfbolWeFYcEqPh2QKu6Qipjln76/cz5t1M5c4oGNR86dxWbyb+BW7j1hTpsQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=cokEMkXD; 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 8FE4B606A330; Fri, 4 Dec 2026 11:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=cokEMkXD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 070001F0092C; Fri, 4 Dec 2026 11:20:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383208; bh=H+1YAu6XCMGIHnY5qdjmBEVD1mP7VM2Zk7PdNeuzfD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cokEMkXDxG7kRDNbiURt5XNRH2AWTiOTevvyT6JAXzTrgF4pz75OXzSCBNLz+hOwp CPHncHy+iLj4nv0GRRrVblBI6NEFk9G3Vpu/22ihR2H10BUyiB2CekzY13aIx6sGlU UPbiOSE8aJEhM8J1SgHuw94RUFDN3dJGZBBr1y20= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Raag Jadav , Andy Shevchenko , Zijun Hu , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.12 126/555] devres: Move devm_*_action*() APIs to devres.h Date: Fri, 4 Dec 2026 19:02:49 +0900 Message-ID: <20261204100612.616580318@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andy Shevchenko [ Upstream commit f5e5631df596ade5875ba1dc5d640611745d0c0d ] We have a newly created header linux/device/devres.h that gathers device managed APIs, so users won't need to include entire device.h for only these ones. Move devm_*_action*() APIs to devres.h as well. Reviewed-by: Raag Jadav Signed-off-by: Andy Shevchenko Reviewed-by: Zijun Hu Acked-by: Greg Kroah-Hartman Link: https://lore.kernel.org/r/20250220162238.2738038-2-andriy.shevchenko@linux.intel.com Signed-off-by: Bartosz Golaszewski Stable-dep-of: 6c6508e742b4 ("usb: dwc3: xilinx: unwind ZynqMP platform init on probe failure and remove") Signed-off-by: Sasha Levin --- include/linux/device.h | 38 ---------------------------------- include/linux/device/devres.h | 39 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/include/linux/device.h b/include/linux/device.h index 601e60c68504c..a1d412a9d6324 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -286,44 +286,6 @@ int __must_check device_create_bin_file(struct device *dev, void device_remove_bin_file(struct device *dev, const struct bin_attribute *attr); -/* allows to add/remove a custom action to devres stack */ -int devm_remove_action_nowarn(struct device *dev, void (*action)(void *), void *data); - -/** - * devm_remove_action() - removes previously added custom action - * @dev: Device that owns the action - * @action: Function implementing the action - * @data: Pointer to data passed to @action implementation - * - * Removes instance of @action previously added by devm_add_action(). - * Both action and data should match one of the existing entries. - */ -static inline -void devm_remove_action(struct device *dev, void (*action)(void *), void *data) -{ - WARN_ON(devm_remove_action_nowarn(dev, action, data)); -} - -void devm_release_action(struct device *dev, void (*action)(void *), void *data); - -int __devm_add_action(struct device *dev, void (*action)(void *), void *data, const char *name); -#define devm_add_action(dev, action, data) \ - __devm_add_action(dev, action, data, #action) - -static inline int __devm_add_action_or_reset(struct device *dev, void (*action)(void *), - void *data, const char *name) -{ - int ret; - - ret = __devm_add_action(dev, action, data, name); - if (ret) - action(data); - - return ret; -} -#define devm_add_action_or_reset(dev, action, data) \ - __devm_add_action_or_reset(dev, action, data, #action) - /** * devm_alloc_percpu - Resource-managed alloc_percpu * @dev: Device to allocate per-cpu memory for diff --git a/include/linux/device/devres.h b/include/linux/device/devres.h index 9b49f99158508..9cd1787ef28ed 100644 --- a/include/linux/device/devres.h +++ b/include/linux/device/devres.h @@ -8,6 +8,7 @@ #include #include #include +#include struct device; struct device_node; @@ -126,4 +127,42 @@ void __iomem *devm_of_iomap(struct device *dev, struct device_node *node, int in #endif +/* allows to add/remove a custom action to devres stack */ +int devm_remove_action_nowarn(struct device *dev, void (*action)(void *), void *data); + +/** + * devm_remove_action() - removes previously added custom action + * @dev: Device that owns the action + * @action: Function implementing the action + * @data: Pointer to data passed to @action implementation + * + * Removes instance of @action previously added by devm_add_action(). + * Both action and data should match one of the existing entries. + */ +static inline +void devm_remove_action(struct device *dev, void (*action)(void *), void *data) +{ + WARN_ON(devm_remove_action_nowarn(dev, action, data)); +} + +void devm_release_action(struct device *dev, void (*action)(void *), void *data); + +int __devm_add_action(struct device *dev, void (*action)(void *), void *data, const char *name); +#define devm_add_action(dev, action, data) \ + __devm_add_action(dev, action, data, #action) + +static inline int __devm_add_action_or_reset(struct device *dev, void (*action)(void *), + void *data, const char *name) +{ + int ret; + + ret = __devm_add_action(dev, action, data, name); + if (ret) + action(data); + + return ret; +} +#define devm_add_action_or_reset(dev, action, data) \ + __devm_add_action_or_reset(dev, action, data, #action) + #endif /* _DEVICE_DEVRES_H_ */ -- 2.53.0