Re: [PATCH v6 3/6] rust: irq: add support for non-threaded IRQs and handlers

Daniel Almeida
2025-07-07T16:19:43Z

Alice,

[…]

>> +/// The value that can be returned from an IrqHandler or a ThreadedIrqHandler.
>> +pub enum IrqReturn {
>> + /// The interrupt was not from this device or was not handled.
>> + None,
>> +
>> + /// The interrupt was handled by this device.
>> + Handled,
>> +}
>> +
>> +impl IrqReturn {
>> + fn into_inner(self) -> u32 {
>> + match self {
>> + IrqReturn::None => bindings::irqreturn_IRQ_NONE,
>> + IrqReturn::Handled => bindings::irqreturn_IRQ_HANDLED,
>
> One option is to specify these in the enum:
>
> /// The value that can be returned from an IrqHandler or a ThreadedIrqHandler.
> pub enum IrqReturn {
> /// The interrupt was not from this device or was not handled.
> None = bindings::irqreturn_IRQ_NONE,
>
> /// The interrupt was handled by this device.
> Handled = bindings::irqreturn_IRQ_HANDLED,
> }

This requires explicitly setting #[repr(u32)], which is something that was
reverted at an earlier iteration of the series on Benno’s request.

— Daniel