From: "Uwe Kleine-König" <ukleinek@kernel.org>
To: Andreas Hindborg <a.hindborg@kernel.org>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
"Lorenzo Stoakes" <ljs@kernel.org>,
"Vlastimil Babka" <vbabka@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
"Uladzislau Rezki" <urezki@gmail.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
"Lyude Paul" <lyude@redhat.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Todd Kjos" <tkjos@android.com>,
"Christian Brauner" <brauner@kernel.org>,
"Carlos Llamas" <cmllamas@google.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Dave Ertman" <david.m.ertman@intel.com>,
"Leon Romanovsky" <leon@kernel.org>,
"Paul Moore" <paul@paul-moore.com>,
"Serge Hallyn" <sergeh@kernel.org>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Alexander Viro" <viro@zeniv.linux.org.uk>,
"Jan Kara" <jack@suse.cz>,
"Igor Korotin" <igor.korotin@linux.dev>,
"Viresh Kumar" <vireshk@kernel.org>, "Nishanth Menon" <nm@ti.com>,
"Stephen Boyd" <sboyd@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Pavel Tikhomirov" <ptikhomirov@virtuozzo.com>,
"Michal Wilczynski" <m.wilczynski@samsung.com>,
"Ira Weiny" <iweiny@kernel.org>,
"Philipp Stanner" <phasta@kernel.org>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, driver-core@lists.linux.dev,
linux-block@vger.kernel.org,
linux-security-module@vger.kernel.org,
dri-devel@lists.freedesktop.org, linux-fsdevel@vger.kernel.org,
linux-pm@vger.kernel.org, linux-pci@vger.kernel.org,
linux-pwm@vger.kernel.org, linux-usb@vger.kernel.org,
"Oliver Mangold" <oliver.mangold@pm.me>,
"Viresh Kumar" <viresh.kumar@linaro.org>
Subject: Re: [PATCH v20 5/8] rust: rename `AlwaysRefCounted` to `RefCounted`.
Date: Mon, 24 Aug 2026 14:26:11 +0200 [thread overview]
Message-ID: <aow36NjRc5Ig0hG8@monoceros> (raw)
In-Reply-To: <20260824-unique-ref-v20-5-490735672187@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1632 bytes --]
Hello,
On Mon, Aug 24, 2026 at 01:17:57PM +0200, Andreas Hindborg wrote:
> diff --git a/rust/kernel/pwm.rs b/rust/kernel/pwm.rs
> index 6c9d667009ef7..2d1cd74dd98e1 100644
> --- a/rust/kernel/pwm.rs
> +++ b/rust/kernel/pwm.rs
> @@ -13,7 +13,11 @@
> devres,
> error::{self, to_result},
> prelude::*,
> - sync::aref::{ARef, AlwaysRefCounted},
> + sync::aref::{
> + ARef,
> + AlwaysRefCounted,
> + RefCounted, //
> + },
> types::Opaque, //
> };
> use core::{
> @@ -629,7 +633,7 @@ pub fn new<'a>(
> }
>
> // SAFETY: Implements refcounting for `Chip` using the embedded `struct device`.
> -unsafe impl<T: PwmOps> AlwaysRefCounted for Chip<T> {
> +unsafe impl<T: PwmOps> RefCounted for Chip<T> {
> #[inline]
> fn inc_ref(&self) {
> // SAFETY: `self.0.get()` points to a valid `pwm_chip` because `self` exists.
> @@ -647,6 +651,10 @@ unsafe fn dec_ref(obj: NonNull<Chip<T>>) {
> }
> }
>
> +// SAFETY: We do not implement `Ownable`, thus it is okay to obtain an `ARef<Chip<T>>` from a
> +// `&Chip<T>`.
> +unsafe impl<T: PwmOps> AlwaysRefCounted for Chip<T> {}
> +
> // SAFETY: `Chip` is a wrapper around `*mut bindings::pwm_chip`. The underlying C
> // structure's state is managed and synchronized by the kernel's device model
> // and PWM core locking mechanisms. Therefore, it is safe to move the `Chip`
I don't understand that, but if this is considered ok by the Rust folks,
I'm fine with merging it via their tree.
Acked-by: Uwe Kleine-König <ukleinek@kernel.org> # for pwm.rs
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2026-08-24 12:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 11:17 [PATCH v20 0/8] rust: add `Ownable` trait and `Owned` type Andreas Hindborg
2026-08-24 11:17 ` [PATCH v20 1/8] rust: alloc: add `KBox::into_non_null` Andreas Hindborg
2026-08-25 13:01 ` Danilo Krummrich
2026-08-24 11:17 ` [PATCH v20 2/8] rust: types: Add Ownable/Owned types Andreas Hindborg
2026-08-24 11:17 ` [PATCH v20 3/8] rust: implement `ForeignOwnable` for `Owned` Andreas Hindborg
2026-08-24 11:17 ` [PATCH v20 4/8] rust: page: convert to `Ownable` Andreas Hindborg
2026-08-25 13:20 ` [PATCH v20 4/8] rust: page: convert to `Ownable`' Alice Ryhl
2026-08-25 13:34 ` [PATCH v20 4/8] rust: page: convert to `Ownable` Danilo Krummrich
2026-08-24 11:17 ` [PATCH v20 5/8] rust: rename `AlwaysRefCounted` to `RefCounted` Andreas Hindborg
2026-08-24 12:26 ` Uwe Kleine-König [this message]
2026-08-24 11:17 ` [PATCH v20 6/8] rust: Add missing SAFETY documentation for `ARef` example Andreas Hindborg
2026-08-24 11:36 ` Miguel Ojeda
2026-08-26 9:29 ` Andreas Hindborg
2026-08-24 11:17 ` [PATCH v20 7/8] rust: Add `OwnableRefCounted` Andreas Hindborg
2026-08-25 13:16 ` Danilo Krummrich
2026-08-25 13:37 ` Gary Guo
2026-08-24 11:18 ` [PATCH v20 8/8] rust: page: add `from_raw()` Andreas Hindborg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aow36NjRc5Ig0hG8@monoceros \
--to=ukleinek@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=arve@android.com \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=brauner@kernel.org \
--cc=cmllamas@google.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=david.m.ertman@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=driver-core@lists.linux.dev \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=igor.korotin@linux.dev \
--cc=iweiny@kernel.org \
--cc=jack@suse.cz \
--cc=kwilczynski@kernel.org \
--cc=leon@kernel.org \
--cc=liam@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=m.wilczynski@samsung.com \
--cc=nm@ti.com \
--cc=ojeda@kernel.org \
--cc=oliver.mangold@pm.me \
--cc=paul@paul-moore.com \
--cc=phasta@kernel.org \
--cc=ptikhomirov@virtuozzo.com \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=sergeh@kernel.org \
--cc=simona@ffwll.ch \
--cc=tamird@kernel.org \
--cc=tkjos@android.com \
--cc=tmgross@umich.edu \
--cc=urezki@gmail.com \
--cc=vbabka@kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=vireshk@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=work@onurozkan.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox