Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: clicedvly768 <harepro29@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com,
	ojeda@kernel.org, gary@garyguo.net
Subject: Re: [PATCH v5 2/2] rust: serio: add serio bus abstractions and port Gravis Stinger driver
Date: Fri, 06 Nov 2026 22:44:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-202339@kernel.org> (raw)
In-Reply-To: <20261106223033.452853-3-harepro29@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] rust: serio: invalid irqreturn constructor call in
  interrupt_callback()
--

commit 80f5c0b2557c72b097feba2779e0c1b32a6bd3c7
Author: clicedvly768 <harepro29@gmail.com>

rust: serio: add serio bus abstractions and port Gravis Stinger driver

This commit adds Rust abstractions for the serio bus subsystem and ports
the Gravis Stinger serial gamepad driver to Rust.

> diff --git a/rust/kernel/serio.rs b/rust/kernel/serio.rs
> new file mode 100644
> index 0000000000000..aca0b5a4f8742
> --- /dev/null
> +++ b/rust/kernel/serio.rs

[ ... ]

> +    unsafe extern "C" fn interrupt_callback(
> +        serio: *mut bindings::serio,
> +        data: c_uchar,
> +        flags: c_uint,
> +    ) -> bindings::irqreturn_t {
> +        // SAFETY: `serio` is valid.
> +        let raw = unsafe { bindings::serio_get_drvdata(serio) };
> +        if raw.is_null() {
> +            return bindings::irqreturn(IrqReturn::None as u32);
> +        }
> +
> +        // SAFETY: `raw` was created via `into_foreign()` in `connect_callback`.
> +        let mut borrowed = unsafe { <T::Data as ForeignOwnable>::borrow_mut(raw) };
> +        let ret = T::interrupt(&mut borrowed, data, flags);
> +        bindings::irqreturn(ret as u32)
> +    }

[Severity: High]
Does calling bindings::irqreturn(...) as a tuple-struct constructor break
the build when CONFIG_SERIO=y and CONFIG_RUST=y are enabled?

bindgen emits bindings::irqreturn and bindings::irqreturn_t as type aliases
for ffi::c_uint rather than a newtype struct, so invoking bindings::irqreturn
with function call syntax fails to compile with E0423.  Casting the values
with "as bindings::irqreturn_t" avoids this.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106223033.452853-1-harepro29@gmail.com?part=2

      reply	other threads:[~2026-11-06 22:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 22:30 [PATCH v5 0/2] rust: input: add input/serio abstractions and port Gravis Stinger driver clicedvly768
2026-11-06 22:30 ` [PATCH v5 1/2] rust: input: add input device abstractions clicedvly768
2026-11-06 22:49   ` Dmitry Torokhov
2026-11-06 22:30 ` [PATCH v5 2/2] rust: serio: add serio bus abstractions and port Gravis Stinger driver clicedvly768
2026-11-06 22:44   ` sashiko-bot [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=sashiko-outbox-202339@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gary@garyguo.net \
    --cc=harepro29@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=sashiko-reviews@lists.linux.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