[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aGgcJxM_nKkFGtGn@cassiopeiae>
Date: Fri, 4 Jul 2025 20:23:35 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Daniel Almeida <daniel.almeida@...labora.com>
Cc: 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>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Benno Lossin <lossin@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Krzysztof Wilczyński <kwilczynski@...nel.org>,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
linux-pci@...r.kernel.org
Subject: Re: [PATCH v6 5/6] rust: platform: add irq accessors
On Thu, Jul 03, 2025 at 04:30:03PM -0300, Daniel Almeida wrote:
> +impl Device<Bound> {
> + /// Returns an [`IrqRequest`] for the IRQ at the given index, if any.
> + pub fn request_irq_by_index(&self, index: u32) -> Result<IrqRequest<'_>> {
> + // SAFETY: `self.as_raw` returns a valid pointer to a `struct platform_device`.
> + let irq = unsafe { bindings::platform_get_irq(self.as_raw(), index) };
> +
> + if irq < 0 {
> + return Err(Error::from_errno(irq));
> + }
> +
> + // SAFETY: `irq` is guaranteed to be a valid IRQ number for `&self`.
> + Ok(unsafe { IrqRequest::new(self.as_ref(), irq as u32) })
> + }
Sorry that I didn't notice that before: Please just name the functions returning
an IrqRequest e.g. irq_by_index(), without the 'request' prefix. And instead put
the 'request' prefix in front of the methods that return a actual
irq::Registration.
This is more in line with the C functions being named request_irq() and
request_threaded_irq().
Powered by blists - more mailing lists