Re: [PATCH 1/2] rust: retain pointer mut-ness in `container_of!`
From: Benno Lossin
Date: Fri Mar 14 2025 - 15:22:29 EST
On Fri Mar 7, 2025 at 10:58 PM CET, Tamir Duberstein wrote:
> Avoid casting the input pointer to `*const _`, allowing the output
> pointer to be `*mut` if the input is `*mut`. This allows a number of
> `*const` to `*mut` conversions to be removed at the cost of slightly
> worse ergonomics when the macro is used with a reference rather than a
> pointer; the only example of this was in the macro's own doctest.
>
> Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxx>
Reviewed-by: Benno Lossin <benno.lossin@xxxxxxxxx>
---
Cheers,
Benno
> ---
> rust/kernel/lib.rs | 5 ++---
> rust/kernel/pci.rs | 2 +-
> rust/kernel/platform.rs | 2 +-
> rust/kernel/rbtree.rs | 23 ++++++++++-------------
> 4 files changed, 14 insertions(+), 18 deletions(-)