]> www.infradead.org Git - users/jedix/linux-maple.git/commit
devres: add devm_remove_action_nowarn()
authorDanilo Krummrich <dakr@kernel.org>
Tue, 7 Jan 2025 12:25:10 +0000 (13:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Jan 2025 14:49:06 +0000 (15:49 +0100)
commitf1725160fd28a2e65e47166637aa44856a1a7f89
treec18de29fa84d957ef2f1b80cc9f6deb96fc77137
parent827ed8b1590d4d29dae837283d606709ffeebe37
devres: add devm_remove_action_nowarn()

devm_remove_action() warns if the action to remove does not exist
(anymore).

The Rust devres abstraction, however, has a use-case to call
devm_remove_action() at a point where it can't be guaranteed that the
corresponding action hasn't been released yet.

In particular, an instance of `Devres<T>` may be dropped after the
action has been released. So far, `Devres<T>` worked around this by
keeping the inner type alive.

Hence, add devm_remove_action_nowarn(), which returns an error code if
the action has been removed already.

A subsequent patch uses devm_remove_action_nowarn() to remove the action
when `Devres<T>` is dropped.

Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/r/20250107122609.8135-1-dakr@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/devres.c
include/linux/device.h