when to use devm_request_irq and irq_set_chained_handler_and_data
when to use devm_request_irq and when to use irq_set_chained_handler_and_data. I see that some drivers are not using devm_request_irq instead using irq_set_chained_handler_and_data for setting up irq handling.
If we use irq_set_chained_handler_and_data will it show up in cat /proc/interrupts
Quoted 3 lines · bharat kumar gogada
when to use
devm_request_irqand when to useirq_set_chained_handler_and_data. I see that some drivers are not usingdevm_request_irqinstead usingirq_set_chained_handler_and_datafor setting up irq handling.
If you're writing code for a driver that is not consuming the interrupt itself, but demultiplexing and forwarding it to another subsystem by calling generic_handle_irq() (or something similar), then you must implement a chained irqchip (as I mentioned yesterday while reviewing your PCIe controler driver).
Quoted 2 lines
If we use
irq_set_chained_handler_and_datawill it show up in cat/proc/interrupts
No. Because this intermediate irqchip doesn't handle the interrupt, the final handler is. Otherwise, you'd end up with twice the number of interrupts...
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Thanks, as mentioned in your review if have separate irq line which our driver consumes and we use devm_request_irq to setup irq line. Then can we use the same irq line number to setup chained irqchip but will there be two handlers for each of these or we can use the same handler.
Quoted 3 lines
when to use
devm_request_irqand when to useirq_set_chained_handler_and_data. I see that some drivers are not usingdevm_request_irqinstead usingirq_set_chained_handler_and_datafor setting up irq handling.
If you're writing code for a driver that is not consuming the interrupt itself, but demultiplexing and forwarding it to another subsystem by calling generic_handle_irq() (or something similar), then you must implement a chained irqchip (as I mentioned yesterday while reviewing your PCIe controler driver).
Quoted 2 lines
If we use
irq_set_chained_handler_and_datawill it show up in cat/proc/interrupts
No. Because this intermediate irqchip doesn't handle the interrupt, the final handler is. Otherwise, you'd end up with twice the number of interrupts...
M.
--
Jazz is not dead. It just smells funny...
Quoted 5 lines · Bharat Kumar Gogada
Thanks, as mentioned in your review if have separate irq line which our driver consumes and we use
devm_request_irqto setup irq line. Then can we use the same irq line number to setup chained irqchip but will there be two handlers for each of these or we can use the same handler.
I'm not sure I understand what you mean here, but let me be clear about what I want to see in your particular driver:
- if you handle MSIs, you need an MSI domain
- if you call generic_handle_irq(), your need a chained irqchip with its own irq domain
None of the above cases can be implemented using devm_request_irq, or request_irq, or setup_irq.
If you have interrupts that are directly consumed by your driver (because they are interrupts that are unrelated to devices that are on the PCIe bus), then you can possibly use devm_request_irq.
Thanks,
M.
Signature · 1 line
Jazz is not dead. It just smells funny...