mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kohei Ito <koheiito.dev@gmail.com>
To: Bartosz Golaszewski <brgl@kernel.org>,
	Alexandre Courbot <acourbot@nvidia.com>
Cc: 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: Sun, 4 Oct 2026 01:58:10 +0900	[thread overview]
Message-ID: <6ac13424.00feb36c.a9616.9685@mx.google.com> (raw)
In-Reply-To: <DLLVT33ESJA5.1XE4J08AEZNMX@nvidia.com>

Hi Bartosz, Alexandre,

Thank you for your advice.

> >> The best approach I think is a combination of a Rust consumer driver and
> >> a C kunit module dedicated to testing the consumer driver. This is
> >> almost the same as `drivers/gpio/gpiolib-kunit.c`, except that instead
> >> of directly exercising the GPIO consumer APIs, the module I'm suggesting
> >> exercises them indirectly, through the Rust consumer driver.
> >>
> >
> > Can't you just call a C function registering the platform device from unsafe
> > rust?
> 
> You should be able to. It's a but laborious, but better than not having
> tests at all, and acceptable as a temporary solution IMHO.
> 
> Of course an even better solution would be to provide a safe abstraction
> for registering platform devices. :) I don't know exactly how much work
> that would be, but there is already a `platform` module, so supposedly
> we wouldn't be starting from absolute scratch.

Sure. I'll explore the Rust kunit approach by directly calling C
functions to register `platform_device` and `software_node` from unsafe
Rust. I'll also drop the sample driver. I'll let you know if I face
problems.

Best regards,
Kohei Ito

      reply	other threads:[~2026-10-03 16:58 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
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 [this message]

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=6ac13424.00feb36c.a9616.9685@mx.google.com \
    --to=koheiito.dev@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®