All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/2] rust: leds: add led classdev abstractions
@ 2025-10-18 20:59 Markus Probst
  2025-10-18 20:59 ` [PATCH v5 1/2] rust: Add trait to convert a device reference to a bus device reference Markus Probst
  2025-10-18 20:59 ` [PATCH v5 2/2] rust: leds: add basic led classdev abstractions Markus Probst
  0 siblings, 2 replies; 4+ messages in thread
From: Markus Probst @ 2025-10-18 20:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Miguel Ojeda, Alex Gaynor, Danilo Krummrich,
	Rafael J. Wysocki, Igor Korotin, Lee Jones, Pavel Machek
  Cc: Dave Ertman, Ira Weiny, Leon Romanovsky, Boqun Feng, Gary Guo,
	bjorn3_gh, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Daniel Almeida, Bjorn Helgaas, kwilczynski,
	linux-kernel, rust-for-linux, linux-pci, linux-leds,
	Markus Probst

This patch currently depends on
https://lore.kernel.org/rust-for-linux/20251005102226.41876-1-igor.korotin.linux@gmail.com/.

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 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

 rust/kernel/auxiliary.rs |   7 +
 rust/kernel/device.rs    |  41 +++++
 rust/kernel/i2c.rs       |   7 +
 rust/kernel/led.rs       | 375 +++++++++++++++++++++++++++++++++++++++
 rust/kernel/lib.rs       |   1 +
 rust/kernel/pci.rs       |   7 +
 rust/kernel/usb.rs       |   6 +
 7 files changed, 444 insertions(+)
 create mode 100644 rust/kernel/led.rs

-- 
2.49.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-19 14:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-18 20:59 [PATCH v5 0/2] rust: leds: add led classdev abstractions Markus Probst
2025-10-18 20:59 ` [PATCH v5 1/2] rust: Add trait to convert a device reference to a bus device reference Markus Probst
2025-10-19 14:28   ` Danilo Krummrich
2025-10-18 20:59 ` [PATCH v5 2/2] rust: leds: add basic led classdev abstractions Markus Probst

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.