]> git.ipfire.org Git - thirdparty/linux.git/commit
rust: Add trait to convert a device reference to a bus device reference
authorMarkus Probst <markus.probst@posteo.de>
Mon, 27 Oct 2025 20:06:03 +0000 (20:06 +0000)
committerDanilo Krummrich <dakr@kernel.org>
Mon, 17 Nov 2025 22:00:51 +0000 (11:00 +1300)
commite4addc7cc2dfcc19f1c8c8e47f3834b22cb21559
tree3b64a849d11179a07ddce4592af810735b250041
parent13ae55e24a854efd33eb84bbd19a74b933228ccd
rust: Add trait to convert a device reference to a bus device reference

Implement the `AsBusDevice` trait for converting a `Device` reference to a
bus device reference for all bus devices.

The `AsBusDevice` trait allows abstractions to provide the bus device in
class device callbacks. It must not be used by drivers and is intended for
bus and class device abstractions only.

Signed-off-by: Markus Probst <markus.probst@posteo.de>
Link: https://patch.msgid.link/20251027200547.1038967-2-markus.probst@posteo.de
[ * Remove unused import.
  * Change visibility of AsBusDevice to public.
  * Fix build for USB.
  * Add impl for I2cClient.
  - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/auxiliary.rs
rust/kernel/device.rs
rust/kernel/i2c.rs
rust/kernel/pci.rs
rust/kernel/platform.rs
rust/kernel/usb.rs