[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <zdwto7ahccckl2r3qoculu52lsus3dey2lcur2l3ltrxp5nrcf@djusgl5cdfu3>
Date: Tue, 9 Dec 2025 09:08:37 +0100
From: Uwe Kleine-König <ukleinek@...nel.org>
To: Michal Wilczynski <m.wilczynski@...sung.com>
Cc: Markus Probst <markus.probst@...teo.de>,
linux-riscv@...ts.infradead.org, linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, Drew Fustini <fustini@...nel.org>, Guo Ren <guoren@...nel.org>,
Fu Wei <wefu@...hat.com>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>
Subject: Re: [PATCH v2] rust: pwm: Add UnregisteredChip wrapper around Chip
On Sun, Dec 07, 2025 at 11:16:59PM +0100, Michal Wilczynski wrote:
> On 12/2/25 19:17, Markus Probst wrote:
> > The `pwm::Registration::register` function provides no guarantee that the
> > function isn't called twice with the same pwm chip, which is considered
> > unsafe.
> >
> > Add `pwm::UnregisteredChip` as wrapper around `pwm::Chip`.
> > Implement `pwm::UnregisteredChip::register` for the registration. This
> > function takes ownership of `pwm::UnregisteredChip` and therefore
> > guarantees that the registration can't be called twice on the same pwm
> > chip.
> >
> > Signed-off-by: Markus Probst <markus.probst@...teo.de>
> > ---
> > This patch provides the additional guarantee that the pwm chip doesn't
> > get registered twice.
> >
> > The following changes were made:
> > - change the visibility of `pwm::Registration` to private
> > - remove the `pwm::Registration::register` function
> > - add `pwm::UnregisteredChip` - a wrapper around `pwm::Chip`
> > - return `pwm::UnregisteredChip` in `pwm::Chip::new`
> > - add `pwm::UnregisteredChip::register` for registering the pwm chip
> > once
> > - add Send + Sync bounds to `PwmOps`
> >
> > Note that I wasn't able to test this patch, due to the lack of hardware.
> >
> > Also I was not able to successfully compile drivers/pwm/pwm_th1520.rs,
> > as `clk::Clk` seems to be missing. I haven't found the missing patch
> > in linux-next nor in
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git/log/?h=pwm/for-next
> >
> > (the tree in which the th1520 pwm driver was merged).
> > So please verify yourself that the driver compiles and throws no errors.
What does "not able to successfully compile drivers/pwm/pwm_th1520.rs"
mean? You were unable to find a .config that included CONFIG_PWM_TH1520,
or you got a compiler error? If it's the latter, ...
> I suspect your kernel configuration is missing CONFIG_COMMON_CLK.
... are we missing a dependency for the driver?
> Thank you for your work. I've tested this patch successfully.
> Other than the typo this looks perfect.
>
> Tested-by: Michal Wilczynski <m.wilczynski@...sung.com>
> Acked-by: Michal Wilczynski <m.wilczynski@...sung.com>
I applied the the patch to
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-nexxt
as 6.20 material with Michal's tags and the typo fixed.
Thanks
Uwe
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists