Re: [PATCH v4 13/13] samples: rust: add Rust platform sample driver

Rob Herring
2024-12-05T18:04:04Z

On Thu, Dec 5, 2024 at 11:09 AM Dirk Behme <dirk.behme@gmail.com> wrote:
>
> Hi Danilo,
>
> On 05.12.24 15:14, Danilo Krummrich wrote:
> > 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.
> >
> > Signed-off-by: Danilo Krummrich <dakr@kernel.org>
>
> Not a review comment, but a question/proposal:
>
> What do you think to convert the platform sample into an example/test?
> And drop it in samples/rust then? Like [1] below?
>
> We would have (a) a complete example in the documentation and (b) some
> (KUnit) test coverage and (c) have one patch less in the series and
> (d) one file less to maintain long term.

I think that's going to become unwieldy when/if we add properties,
iomem, and every other thing a driver can call in probe.

OTOH, the need for the sample will quickly diminish once there are
real drivers using this stuff.

> I think to remember that it was mentioned somewhere that a
> documentation example / KUnit test is preferred over samples/rust (?).

Really? I've only figured out how you build and run the samples. I
started looking into how to do the documentation kunit stuff and still
haven't figured it out. I'm sure it is "easy", but it's not as easy as
the samples and yet another thing to go learn with the rust stuff. For
example, just ensuring it builds is more than just "compile the
kernel". We already have so many steps for submitting things upstream
and rust is just adding more on top.

Rob