Re: [PATCH v6] rust: aref: make `AlwaysRefCounted::inc_ref` an associated function

"Gary Guo" <[email protected]>
Newsgroups org.kernel.vger.linux-security-module,dev.linux.lists.driver-core,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-block,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci,org.kernel.vger.linux-pm,org.kernel.vger.linux-pwm,org.kernel.vger.rust-for-linux,org.kvack.linux-mm
Message-ID <[email protected]>
On Sun Jun 28, 2026 at 10:51 AM BST, Trevor Chan wrote:
> `AlwaysRefCounted::inc_ref` is a function that shouldn't be called lightly.
> 
> To prevent accidentally calling it, change `inc_ref` to be an associated function.
> 
> Modify all `AlwaysRefCounted` implementors to work with this change.
> 
> Suggested-by: Benno Lossin <[email protected]>
> Link: https://github.com/Rust-for-Linux/linux/issues/1177
> Reviewed-by: Alice Ryhl <[email protected]>
> Signed-off-by: Trevor Chan <[email protected]>

Reviewed-by: Gary Guo <[email protected]>

> ---
> Changes in v2:
>  - Don't word wrap the patch
> Changes in v3:
>  - Make argument name of `Empty::inc_ref` consistent with `Empty::dec_ref`
> Changes in v4:
>  - Rebase to new rust-next, change new implementors
>  - Reword explanation for change in `AlwaysRefCounted::inc_ref` doc comment
> Changes in v5:
>  - Change commit message to be imperative
> Changes in v6:
>  - Change all the implementors
> ---
>  rust/kernel/auxiliary.rs        |  4 ++--
>  rust/kernel/block/mq/request.rs |  4 ++--
>  rust/kernel/cred.rs             |  4 ++--
>  rust/kernel/device.rs           |  4 ++--
>  rust/kernel/device/property.rs  |  4 ++--
>  rust/kernel/drm/device.rs       |  4 ++--
>  rust/kernel/drm/gem/mod.rs      |  4 ++--
>  rust/kernel/drm/gpuvm/mod.rs    |  4 ++--
>  rust/kernel/drm/gpuvm/vm_bo.rs  |  4 ++--
>  rust/kernel/fs/file.rs          |  8 ++++----
>  rust/kernel/i2c.rs              |  8 ++++----
>  rust/kernel/mm.rs               |  8 ++++----
>  rust/kernel/mm/mmput_async.rs   |  4 ++--
>  rust/kernel/opp.rs              |  4 ++--
>  rust/kernel/pci.rs              |  4 ++--
>  rust/kernel/pid_namespace.rs    |  4 ++--
>  rust/kernel/platform.rs         |  4 ++--
>  rust/kernel/pwm.rs              |  2 +-
>  rust/kernel/sync/aref.rs        | 11 +++++++----
>  rust/kernel/task.rs             |  4 ++--
>  rust/kernel/usb.rs              |  8 ++++----
>  21 files changed, 54 insertions(+), 51 deletions(-)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.