Re: [PATCH v3 15/16] rust: platform: add basic platform device / driver abstractions

From: Fabien Parent
Date: Sun Oct 27 2024 - 00:32:50 EST


Hi Danilo,

On Tue Oct 22, 2024 at 2:31 PM PDT, Danilo Krummrich wrote:
> +/// An adapter for the registration of platform drivers.
> +pub struct Adapter<T: Driver>(T);

...

> +/// The platform driver trait.
> +///
> +/// # Example
> +///
> +///```
> +/// # use kernel::{bindings, c_str, of, platform};
> +///
> +/// struct MyDriver;
> +///
> +/// kernel::of_device_table!(
> +/// OF_TABLE,
> +/// MODULE_OF_TABLE,
> +/// <MyDriver as platform::Driver>::IdInfo,
> +/// [
> +/// (of::DeviceId::new(c_str!("redhat,my-device")), ())
> +/// ]
> +/// );
> +///
> +/// impl platform::Driver for MyDriver {
> +/// type IdInfo = ();
> +/// const ID_TABLE: platform::IdTable<Self::IdInfo> = &OF_TABLE;
> +///
> +/// fn probe(
> +/// _pdev: &mut platform::Device,
> +/// _id_info: Option<&Self::IdInfo>,
> +/// ) -> Result<Pin<KBox<Self>>> {
> +/// Err(ENODEV)
> +/// }
> +/// }
> +///```
...
> +/// Drivers must implement this trait in order to get a platform driver registered. Please refer to
> +/// the `Adapter` documentation for an example.

The `Adapter` doesn't have any examples, but there is one right
above this paragraph. Anyway I think the example is in the right place and
should not be moved over there.

I think this paragraph should be moved above the example and the last
sentence should be deleted.

Fabien