Re: [PATCH 1/2] rust: device: add BoundInternal device context and InternalBoundContext trait

From: Markus Probst

Date: Sun Jun 28 2026 - 21:21:16 EST


On Sat, 2026-05-30 at 15:27 +0200, Danilo Krummrich wrote:
> Add a new BoundInternal device context type for cases where bus
> abstractions need access to internal device infrastructure, where
> CoreInternal would not be justified.
>
> Introduce the InternalBoundContext marker trait, implemented by both
> CoreInternal and BoundInternal, to allow methods that require internal
> bus abstraction access to a bound device to be generic over both
> contexts.
>
> The deref hierarchy now has two branches:
> - CoreInternal<'a> => Core<'a> => Bound => Normal
> - BoundInternal => Bound => Normal
>
> Update impl_device_context_deref! and impl_device_context_into_aref!
> macros to emit the BoundInternal => Bound deref and the corresponding
> ARef conversion.
>
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> ---
> This is needed by both the serdev bus code [1] and the runtime PM series [2].
>
> [1] https://lore.kernel.org/driver-core/DIW1B4FUIXO7.28GSUA0CEA4EV@xxxxxxxxxx/
> [2] https://lore.kernel.org/driver-core/DIKIJ81CV55B.3TA7PV8N4BN0E@xxxxxxxxxx/
> ---
> rust/kernel/device.rs | 43 +++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 41 insertions(+), 2 deletions(-)

Reviewed-By: Markus Probst <markus.probst@xxxxxxxxx>

Thanks
- Markus Probst

Attachment: signature.asc
Description: This is a digitally signed message part