From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Kohei Ito" <koheiito.dev@gmail.com>
Cc: "Bartosz Golaszewski" <brgl@kernel.org>,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
linux-gpio@vger.kernel.org, "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Onur Özkan" <work@onurozkan.dev>
Subject: Re: [PATCH 3/3] sample: rust: Add GPIO consumer sample driver
Date: Mon, 14 Sep 2026 10:41:29 +0900 [thread overview]
Message-ID: <DLENO35F39LL.2YNA66D9FCXYH@nvidia.com> (raw)
In-Reply-To: <6aa662d7.0ca013b1.1575e3.0a60@mx.google.com>
On Sun Sep 13, 2026 at 5:46 PM JST, Kohei Ito wrote:
> Hi, Bartosz,
>
> On Thu, Sep 10, 2026 at 12:37:17AM -0700, Bartosz Golaszewski wrote:
>> On Sun, 6 Sep 2026 10:45:51 +0200, Kohei Ito <koheiito.dev@gmail.com> said:
>> > Add a sample driver to demonstrate the use of the Rust GPIO APIs.
>> >
>> > Signed-off-by: Kohei Ito <koheiito.dev@gmail.com>
>> > ---
>>
>> I don't like samples as they rarely get built or tested. We seem to already
>> have kunit support for rust, wouldn't it make more sense to implement a kunit
>> module for rust GPIO abstractions? If we don't have provider abstractions, you
>> should be able to reuse gpio-sim as the GPIO controller for testing just by
>> instantiating simulated GPIO devices.
>
> Thank you for your suggestion.
>
> I assume the kunit module you have in mind would be implemented like
> `gpiolib-kunit.c`. Based on your comment, I agree that a kunit-based
> approach is more appropriate than a sample driver.
>
> However, as far as I know, we don't yet have Rust abstractions for
> platform_device registration and software_node, which are required to
> implement a kunit-based module for testing GPIO consumer APIs. Given the
> current state of Rust for Linux, I think creating a sample driver is a
> more practical approach for now. I would like to consider migrating to a
> kunit-based module as future work.
The problem is that this sample driver never probes, so in effect it is
only ever compile-tested. Without support for the provider API, you need
to include a small C fixture providing a GPIO chip for it to be actually
runtime-tested.
Doing the same using KUnit would involve building the `gpio_chip` using a
bunch of unsafe statements working with the C bindings (which would then
in turn require `gpio/driver.h` to be added), so I guess we'll want to
wait until we have a proper Rust provider API to go that direction.
But if we add a sample driver, we need to make sure it is exercised.
next prev parent reply other threads:[~2026-09-14 1:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 8:45 [PATCH 0/3] rust: Add basic GPIO consumer abstractions Kohei Ito
2026-09-06 8:45 ` [PATCH 1/3] rust: gpio: add GPIO module with common definitions Kohei Ito
2026-09-06 9:56 ` Miguel Ojeda
2026-09-06 13:09 ` Gary Guo
2026-09-06 15:53 ` Kohei Ito
2026-09-16 13:29 ` Linus Walleij
2026-10-03 16:50 ` Kohei Ito
2026-09-06 8:45 ` [PATCH 2/3] rust: gpio: Add basic consumer abstractions Kohei Ito
2026-09-10 7:38 ` Bartosz Golaszewski
2026-09-13 8:58 ` Alexandre Courbot
2026-10-03 16:45 ` Kohei Ito
2026-09-06 8:45 ` [PATCH 3/3] sample: rust: Add GPIO consumer sample driver Kohei Ito
2026-09-10 7:37 ` Bartosz Golaszewski
2026-09-13 8:46 ` Kohei Ito
2026-09-14 1:41 ` Alexandre Courbot [this message]
2026-09-14 8:36 ` Bartosz Golaszewski
2026-09-21 13:12 ` Kohei Ito
2026-09-21 14:38 ` Bartosz Golaszewski
2026-09-22 13:32 ` Alexandre Courbot
2026-10-03 16:58 ` Kohei Ito
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DLENO35F39LL.2YNA66D9FCXYH@nvidia.com \
--to=acourbot@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=brgl@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=koheiito.dev@gmail.com \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.