fn register_interrupt(
    dev: &DevWithInterrupt,
    dev_list: &[DevWithInterrupt],
    intc_map: &BTreeMap<u32, usize>,
) -> DeviceResult {
    let mut pos = 0;
    while pos < dev.interrupts_extended.len() {
        let parent = dev.interrupts_extended[pos];
        // find the interrupt parent in `dev_list`
        if let Some(intc) = intc_map.get(&parent).map(|&i| &dev_list[i]) {
            let cells = intc.interrupt_cells.ok_or(DeviceError::InvalidParam)?;
            if let Device::Irq(irq) = &intc.dev {
                // get irq_num from the `interrupts_extended` property
                let irq_num = dev.interrupts_extended[pos + 1] as usize;
                if irq_num != 0xffff_ffff {
                    info!(
                        "device-tree: register interrupts for {:?}: {:?}, irq_num={:#x}",
                        intc.dev, dev.dev, irq_num
                    );
                    irq.register_device(irq_num, dev.dev.inner())?;
                    // enable the interrupt after registration
                    irq.unmask(irq_num)?;
                }
            } else {
                warn!(
                    "device-tree: node with phandle {:#x} is not an interrupt-controller",
                    parent
                );
                return Err(DeviceError::InvalidParam);
            }
            // process the next interrupt parent
            pos += 1 + cells as usize;
        } else {
            warn!(
                "device-tree: no such node with phandle {:#x} as the interrupt-parent",
                parent
            );
            return Err(DeviceError::InvalidParam);
        }
    }
    Ok(())
}
/// Register interrupts for `dev` according to its interrupt parent, which can
/// be found from the phandle-device mapping.
Register interrupts for `dev` according to its interrupt parent, which can
be found from the phandle-device mapping.
Register interrupts for ` dev ` according to its interrupt parent which can be found from the phandle - device mapping .
fn register_interrupt(
    dev: &DevWithInterrupt,
    dev_list: &[DevWithInterrupt],
    intc_map: &BTreeMap<u32, usize>,
) -> DeviceResult {
    let mut pos = 0;
    while pos < dev.interrupts_extended.len() {
        let parent = dev.interrupts_extended[pos];
        // find the interrupt parent in `dev_list`
        if let Some(intc) = intc_map.get(&parent).map(|&i| &dev_list[i]) {
            let cells = intc.interrupt_cells.ok_or(DeviceError::InvalidParam)?;
            if let Device::Irq(irq) = &intc.dev {
                // get irq_num from the `interrupts_extended` property
                let irq_num = dev.interrupts_extended[pos + 1] as usize;
                if irq_num != 0xffff_ffff {
                    info!(
                        "device-tree: register interrupts for {:?}: {:?}, irq_num={:#x}",
                        intc.dev, dev.dev, irq_num
                    );
                    irq.register_device(irq_num, dev.dev.inner())?;
                    // enable the interrupt after registration
                    irq.unmask(irq_num)?;
                }
            } else {
                warn!(
                    "device-tree: node with phandle {:#x} is not an interrupt-controller",
                    parent
                );
                return Err(DeviceError::InvalidParam);
            }
            // process the next interrupt parent
            pos += 1 + cells as usize;
        } else {
            warn!(
                "device-tree: no such node with phandle {:#x} as the interrupt-parent",
                parent
            );
            return Err(DeviceError::InvalidParam);
        }
    }
    Ok(())
}
fn register_interrupt ( dev : & DevWithInterrupt , dev_list : & [ DevWithInterrupt ] , intc_map : & BTreeMap < u32 , usize > , ) -> DeviceResult { let mut pos = 0 ; while pos < dev . interrupts_extended . len ( ) { let parent = dev . interrupts_extended [ pos ] ; // find the interrupt parent in `dev_list` if let Some ( intc ) = intc_map . get ( & parent ) . map ( | & i | & dev_list [ i ] ) { let cells = intc . interrupt_cells . ok_or ( DeviceError :: InvalidParam ) ? ; if let Device :: Irq ( irq ) = & intc . dev { // get irq_num from the `interrupts_extended` property let irq_num = dev . interrupts_extended [ pos + 1 ] as usize ; if irq_num != 0xffff_ffff { info ! ( " " intc dev dev dev irq_num ) ; irq . register_device ( irq_num , dev . dev . inner ( ) ) ? ; // enable the interrupt after registration irq . unmask ( irq_num ) ? ; } } else { warn ! ( " " parent ) ; return Err ( DeviceError :: InvalidParam ) ; } // process the next interrupt parent pos += 1 + cells as usize ; } else { warn ! ( " " parent ) ; return Err ( DeviceError :: InvalidParam ) ; } } Ok ( ( ) ) }
Register interrupts for `dev` according to its interrupt parent, which can
be found from the phandle-device mapping.
Register interrupts for ` dev ` according to its interrupt parent which can be found from the phandle - device mapping .
dev
&DevWithInterrupt
dev_list
&[DevWithInterrupt]
intc_map
&BTreeMap<u32, usize>
dev
&DevWithInterrupt
dev_list
&[DevWithInterrupt]
intc_map
&BTreeMap<u32, usize>