History log of /linux-6.15/samples/rust/rust_driver_platform.rs (Results 1 – 3 of 3)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7
# 4d320e30 14-Mar-2025 Danilo Krummrich <[email protected]>

rust: platform: fix unrestricted &mut platform::Device

As by now, platform::Device is implemented as:

#[derive(Clone)]
pub struct Device(ARef<device::Device>);

This may be convenient, but has th

rust: platform: fix unrestricted &mut platform::Device

As by now, platform::Device is implemented as:

#[derive(Clone)]
pub struct Device(ARef<device::Device>);

This may be convenient, but has the implication that drivers can call
device methods that require a mutable reference concurrently at any
point of time.

Instead define platform::Device as

pub struct Device<Ctx: DeviceContext = Normal>(
Opaque<bindings::platform_dev>,
PhantomData<Ctx>,
);

and manually implement the AlwaysRefCounted trait.

With this we can implement methods that should only be called from
bus callbacks (such as probe()) for platform::Device<Core>. Consequently,
we make this type accessible in bus callbacks only.

Arbitrary references taken by the driver are still of type
ARef<platform::Device> and hence don't provide access to methods that are
reserved for bus callbacks.

Fixes: 683a63befc73 ("rust: platform: add basic platform device / driver abstractions")
Reviewed-by: Benno Lossin <[email protected]>
Signed-off-by: Danilo Krummrich <[email protected]>
Acked-by: Boqun Feng <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


Revision tags: v6.14-rc6
# 38559da6 09-Mar-2025 Guilherme Giacomo Simoes <[email protected]>

rust: module: introduce `authors` key

In the `module!` macro, the `author` field is currently of type `String`.

Since modules can have multiple authors, this limitation prevents
specifying more tha

rust: module: introduce `authors` key

In the `module!` macro, the `author` field is currently of type `String`.

Since modules can have multiple authors, this limitation prevents
specifying more than one.

Add an `authors` field as `Option<Vec<String>>` to allow creating
modules with multiple authors, and change the documentation and all
current users to use it. Eventually, the single `author` field may
be removed.

[ The `modinfo` key needs to still be `author`; otherwise, tooling
may not work properly, e.g.:

$ modinfo --author samples/rust/rust_print.ko
Rust for Linux Contributors

I have also kept the original `author` field (undocumented), so
that we can drop it more easily in a kernel cycle or two.

- Miguel ]

Suggested-by: Miguel Ojeda <[email protected]>
Link: https://github.com/Rust-for-Linux/linux/issues/244
Reviewed-by: Charalampos Mitrodimas <[email protected]>
Reviewed-by: Alice Ryhl <[email protected]>
Reviewed-by: Andreas Hindborg <[email protected]>
Signed-off-by: Guilherme Giacomo Simoes <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Fixed `modinfo` key. Kept `author` field. Reworded message
accordingly. Updated my email. - Miguel ]
Signed-off-by: Miguel Ojeda <[email protected]>

show more ...


Revision tags: v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4
# b2e8a832 19-Dec-2024 Danilo Krummrich <[email protected]>

samples: rust: add Rust platform sample driver

Add a sample Rust platform driver illustrating the usage of the platform
bus abstractions.

This driver probes through either a match of device / drive

samples: rust: add Rust platform sample driver

Add a sample Rust platform driver illustrating the usage of the platform
bus abstractions.

This driver probes through either a match of device / driver name or a
match within the OF ID table.

Reviewed-by: Rob Herring (Arm) <[email protected]>
Signed-off-by: Danilo Krummrich <[email protected]>
Tested-by: Dirk Behme <[email protected]>
Tested-by: Fabien Parent <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...