[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8e1d09db23439a361e12b93bbaa2f80959799775.camel@posteo.de>
Date: Thu, 13 Nov 2025 14:43:03 +0000
From: Markus Probst <markus.probst@...teo.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Miguel Ojeda
<ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Danilo Krummrich
<dakr@...nel.org>, "Rafael J. Wysocki" <rafael@...nel.org>, Lee Jones
<lee@...nel.org>, Pavel Machek <pavel@...nel.org>
Cc: Dave Ertman <david.m.ertman@...el.com>, Ira Weiny <ira.weiny@...el.com>,
Leon Romanovsky <leon@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>, 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>, Bjorn Helgaas
<bhelgaas@...gle.com>, Krzysztof Wilczyński
<kwilczynski@...nel.org>, rust-for-linux@...r.kernel.org,
linux-leds@...r.kernel.org, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 0/2] rust: leds: add led classdev abstractions
On Thu, 2025-11-13 at 15:20 +0100, Markus Probst wrote:
> On Mon, 2025-10-27 at 20:06 +0000, Markus Probst wrote:
> > This patch series has previously been contained in
> > https://lore.kernel.org/rust-for-linux/20251008181027.662616-1-markus.probst@posteo.de/T/#t
> > which added a rust written led driver for a microcontroller via i2c.
> >
> > As the reading and writing to the i2c client via the register!
> > macro has not been implemented yet [1], the patch series will only
> > contain the additional abstractions required.
> >
> > [1] https://lore.kernel.org/rust-for-linux/DDDS2V0V2NVJ.16ZKXCKUA1HUV@kernel.org/
> >
> > The following changes were made:
> > * add abstraction to convert a device reference to a bus device
> > reference for use in class device callbacks
> >
> > * add basic led classdev abstractions to register and unregister leds
> >
> > Changes since v6:
> > * fixed typos
> > * improved documentation
> >
> > Changes since v5:
> > * rename `IntoBusDevice` trait into `AsBusDevice`
> > * fix documentation about `LedOps::BLOCKING`
> > * removed dependency on i2c bindings
> > * added `AsBusDevice` implementation for `platform::Device`
> > * removed `device::Device` fallback implementation
> > * document that `AsBusDevice` must not be used by drivers and is
> > intended for bus and class device abstractions only.
> >
> > Changes since v4:
> > * add abstraction to convert a device reference to a bus device
> > reference
> > * require the bus device as parent device and provide it in class device
> > callbacks
> > * remove Pin<Vec<_>> abstraction (as not relevant for the led
> > abstractions)
> > * fixed formatting in `led::Device::new`
> > * fixed `LedOps::BLOCKING` did the inverse effect
> >
> > Changes since v3:
> > * fixed kunit tests failing because of example in documentation
> >
> > Changes since v2:
> > * return `Devres` on `led::Device` creation
> > * replace KBox<T> with T in struct definition
> > * increment and decrement reference-count of fwnode
> > * make a device parent mandatory for led classdev creation
> > * rename `led::Handler` to `led::LedOps`
> > * add optional `brightness_get` function to `led::LedOps`
> > * use `#[vtable]` instead of `const BLINK: bool`
> > * use `Opaque::cast_from` instead of casting a pointer
> > * improve documentation
> > * improve support for older rust versions
> > * use `&Device<Bound>` for parent
> >
> > Changes since v1:
> > * fixed typos noticed by Onur Özkan
> >
> > Markus Probst (2):
> > rust: Add trait to convert a device reference to a bus device
> > reference
> > rust: leds: add basic led classdev abstractions
> >
> > Markus Probst (2):
> > rust: Add trait to convert a device reference to a bus device
> > reference
> > rust: leds: add basic led classdev abstractions
>
> Hi,
>
> So you know in advance, I will add a 3. patch for multicolor led
> classdev abstractions (drivers/leds/led-class-multicolor.c,
> include/linux/led-class-multicolor.h) to this patch series.
>
> In the atmega1608 led driver (the user of these abstractions) there are
> leds with different colors that share the same slot.
> Technically "drivers/leds/rgb/leds-group-multicolor.c" could be used in
> combination with single color leds instead, but then hardware
> accelerated blinking wouldn't be supported. I think it would make more
> sense to directly implement it in the driver.
>
> The existing 2 patches shouldn't change, so feel free to review them.
>
> Thanks
> - Markus Probst
ignore the duplicate email. Sending the email gave an error, retrying
resulted in the email being sent twice.
Thanks
- Markus Probst
>
> >
> > rust/kernel/auxiliary.rs | 7 +
> > rust/kernel/device.rs | 33 ++++
> > rust/kernel/led.rs | 375 +++++++++++++++++++++++++++++++++++++++
> > rust/kernel/lib.rs | 1 +
> > rust/kernel/pci.rs | 7 +
> > rust/kernel/platform.rs | 7 +
> > rust/kernel/usb.rs | 6 +
> > 7 files changed, 436 insertions(+)
> > create mode 100644 rust/kernel/led.rs
Powered by blists - more mailing lists