]> git.baikalelectronics.ru Git - kernel.git/commit
3c503: Fix IRQ probing
authorBen Hutchings <ben@decadent.org.uk>
Thu, 8 Apr 2010 03:55:47 +0000 (20:55 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 8 Apr 2010 03:55:47 +0000 (20:55 -0700)
commitfb41403d18e5f235ed87b07a312218f20957345f
tree96e70aaf37b7c35435324c66057be8aa34a7bdff
parent15c3f78475b20ea14b58f5c04922ec868961a60b
3c503: Fix IRQ probing

The driver attempts to select an IRQ for the NIC automatically by
testing which of the supported IRQs are available and then probing
each available IRQ with probe_irq_{on,off}().  There are obvious race
conditions here, besides which:
1. The test for availability is done by passing a NULL handler, which
   now always returns -EINVAL, thus the device cannot be opened:
   <http://bugs.debian.org/566522>
2. probe_irq_off() will report only the first ISA IRQ handled,
   potentially leading to a false negative.

There was another bug that meant it ignored all error codes from
request_irq() except -EBUSY, so it would 'succeed' despite this
(possibly causing conflicts with other ISA devices).  This was fixed
by d0c2dc3ba87ea3e25cc2687669298a69a3c90e24 'WARNING: some
request_irq() failures ignored in el2_open()', which exposed bug 1.

This patch:
1. Replaces the use of probe_irq_{on,off}() with a real interrupt handler
2. Adds a delay before checking the interrupt-seen flag
3. Disables interrupts on all failure paths
4. Distinguishes error codes from the second request_irq() call,
   consistently with the first

Compile-tested only.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/3c503.c