Assume a pci-driver for the linux-kernel. This device can have multiple channels that can be "up'ed" or "down'ed" individually.
Each "up" calls the function .ndo_open
and each "down" calls .ndo_stop
.
This device needs only one interrupt-line which can be requested with request_irq ()
. Each request will create one interrupt-line.
Important to note here is, that interrupt-lines are rare and they should not be created mindless.
My question to this situation is, where should I use request_irq()
?
In my opinion I have two possible solutions for this.
- Right in the
probe()
. This will only create one interrupt-line but it will always be created when the pc is turned on. So it might be unused. - In
.ndo_open
. This will create the interrupt-line only when it is needed, but a multichannel device can create mutliple calls of.ndo_open
which will result in multiple calls ofrequest_irq()
I was not able to find any information about this situation in the kernel docs. If there is some guideline for this, can you please explain/show it to me? I also checked other pci-drivers from the git-repo but none (or at least the ones I checked) had this problem.