Re: [PATCH v2 5/5] rust: pci: expose the allocated interrupt type

[email protected]
Newsgroups org.kernel.vger.linux-pci
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The `irq_type` method on `IrqVector` is missing the `#[inline]` attribute, which is required by the subsystem guidelines for small forwarding functions in abstractions.
--

--- Patch [5]: [PATCH v2 5/5] rust: pci: expose the allocated interrupt type ---
commit 2729ea5a5c9bd73b2db961974f58b91749e6fbc9
Author: Danilo Krummrich <[email protected]>

rust: pci: expose the allocated interrupt type

This commit adds irq_type() methods to IrqVectorRegistration and IrqVector to
wrap the pci_irq_type() C function. This allows drivers to query the interrupt
type rather than assuming which type the PCI core selected.

Link: https://lore.kernel.org/all/[email protected]/

> diff --git a/rust/kernel/pci/irq.rs b/rust/kernel/pci/irq.rs
> index b3dce5b49d571..41059b922492e 100644
> --- a/rust/kernel/pci/irq.rs
> +++ b/rust/kernel/pci/irq.rs
[ ... ]
> @@ -106,6 +116,11 @@ pub fn index(&self) -> usize {
>      pub fn vectors(&self) -> &'a IrqVectorRegistration<'a> {
>          self.reg
>      }
> +
> +    /// Returns the interrupt type the PCI core selected for this vector's allocation.
> +    pub fn irq_type(&self) -> IrqType {
> +        self.reg.irq_type()
> +    }

[Severity: Low]
This isn't a bug, but should this method have an #[inline] annotation?

The Rust subsystem guidelines specify that small or forwarding functions in
abstractions should be annotated with #[inline]. Since this just forwards to
self.reg.irq_type(), adding the annotation would ensure it aligns with the
coding guidelines.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.