]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
devres: don't require ARCH_DMA_MINALIGN for devres actions
authorDanilo Krummrich <dakr@kernel.org>
Mon, 2 Feb 2026 23:48:17 +0000 (00:48 +0100)
committerDanilo Krummrich <dakr@kernel.org>
Tue, 17 Mar 2026 22:58:35 +0000 (23:58 +0100)
commit2b5c6a14b5b4326916ef20b39eea3564ad786e9f
treec2fc4e764d0db6d74d7a58e9e00ebe04dedc37c8
parent6fe9d3b942d2d18eee35ac9b0b3443d4caabefb6
devres: don't require ARCH_DMA_MINALIGN for devres actions

Currently, devres actions are allocated with devres_alloc(), which
allocates a struct devres with a flexible array member for the actual
data of the resource. The flexible array member is aligned to
ARCH_DMA_MINALIGN, which is wasteful for devres actions that only need
to store a struct action_devres.

Introduce struct devres_action to handle devres actions separately from
struct devres, analogous to what we do for struct devres_group.

Speaking of which, without this patch struct devres_group is treated as
struct devres in release_nodes(). While this is not an actual bug, as
release callbacks for devres nodes in struct devres_group are empty
functions anyways, it is a bit messy and can be confusing.

(Note that besides devres actions, the Rust devres code will also make
use of this. The Rust compiler can figure out the correct alignment of T
in Devres<T> itself, i.e. no need to force a minimum alignment.)

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20260202235210.55176-5-dakr@kernel.org
[ Add missing node->release check in devres_for_each_res() and
  find_dr(); use kzalloc_obj(). - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/base/devres.c