Re: [PATCH 1/3] rust: gpio: add GPIO module with common definitions
From: Linus Walleij
Date: Wed Sep 16 2026 - 09:36:55 EST
Hi Kohei,
thanks for your patch!
On Sun, Sep 6, 2026 at 10:46 AM Kohei Ito <koheiito.dev@xxxxxxxxx> wrote:
> Add the top-level GPIO module with minimal common definitions. This
> module is the basis for future Rust GPIO extensions.
Describe what you want to enable by this patch.
- Enabling in-kernel Rust code to use things from the
GPIO subsystem? (It looks like so.)
- Writing GPIO drivers in rust? (It seems like not.)
> Signed-off-by: Kohei Ito <koheiito.dev@xxxxxxxxx>
(...)
> +/// Describes the logical GPIO level, i.e. taking the ACTIVE_LOW status into account.
> +#[derive(Clone, Copy, PartialEq, Eq)]
> +pub enum LogicalLineLevel {
Neat!
> +/// Describes the raw GPIO level, i.e. the value of its physical line without regard for its
> +/// ACTIVE_LOW status.
> +#[derive(Clone, Copy, PartialEq, Eq)]
> +pub enum PhysicalLineLevel {
No thanks.
We want to hide the actual physical line level inside the
gpiolib (encapsulation).
We should not expose the physical line level at all
unless there is a consumer in the kernel that absolutely
needs this, and there is none.
Yours,
Linus Walleij