[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D9W5K3FPJ3SH.1AMA9VYM75Z4X@kernel.org>
Date: Wed, 14 May 2025 22:06:14 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Daniel Almeida" <daniel.almeida@...labora.com>, "Miguel Ojeda"
<ojeda@...nel.org>, "Alex Gaynor" <alex.gaynor@...il.com>, "Boqun Feng"
<boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Benno Lossin"
<benno.lossin@...ton.me>, "Andreas Hindborg" <a.hindborg@...nel.org>,
"Alice Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>,
"Danilo Krummrich" <dakr@...nel.org>, "Greg Kroah-Hartman"
<gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
"Thomas Gleixner" <tglx@...utronix.de>
Cc: <linux-kernel@...r.kernel.org>, <rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH v3 2/2] rust: platform: add irq accessors
On Wed May 14, 2025 at 9:20 PM CEST, Daniel Almeida wrote:
> + /// Same as [`Self::irq_by_name`] but does not print an error message if an IRQ
> + /// cannot be obtained.
> + pub fn optional_irq_by_name(&self, name: &CStr) -> Result<u32> {
> + // SAFETY: `self.as_raw` returns a valid pointer to a `struct platform_device`.
> + let res = unsafe {
> + bindings::platform_get_irq_byname_optional(self.as_raw(), name.as_char_ptr())
> + };
> +
> + if res < 0 {
> + return Err(Error::from_errno(res));
> + }
> +
> + Ok(res as u32)
This patch could make much use of the function for `Error` that does the
last 4 lines.
---
Cheers,
Benno
> + }
> }
>
> impl Deref for Device<device::Core> {
Powered by blists - more mailing lists