drivers/char/ip2: separate polling and irq-driven work entry points

Polling currently calls the irq handler, which loops through all the
boards, calling the work function for all polling boards with work.

irq handling loops through all the boards, finding the specific board
that applies to us, and calling the work just for that one board.

The two logics are sufficiently different to warrant different
functions, rather than being slack and calling the same function in two
different ways.

This serves to make the interrupt handler a -lot- more efficient.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

+20 -7
+20 -7
drivers/char/ip2/ip2main.c
··· 752 continue; 753 rc = request_irq( ip2config.irq[i], ip2_interrupt, 754 IP2_SA_FLAGS | (ip2config.type[i] == PCI ? IRQF_SHARED : 0), 755 - pcName, (void *)&pcName); 756 if (rc) { 757 printk(KERN_ERR "IP2: an request_irq failed: error %d\n",rc); 758 ip2config.irq[i] = CIR_POLL; ··· 1191 #endif /* USE_IQI */ 1192 } 1193 1194 - static irqreturn_t 1195 - ip2_interrupt(int irq, void *dev_id) 1196 { 1197 int i; 1198 i2eBordStrPtr pB; 1199 - int handled = 0; 1200 1201 ip2trace (ITRC_NO_PORT, ITRC_INTR, 99, 1, irq ); 1202 ··· 1208 // IRQ = 0 for polled boards, we won't poll "IRQ" boards 1209 1210 if ( pB && (pB->i2eUsingIrq == irq) ) { 1211 - handled = 1; 1212 ip2_irq_work(pB); 1213 } 1214 } ··· 1215 ++irq_counter; 1216 1217 ip2trace (ITRC_NO_PORT, ITRC_INTR, ITRC_RETURN, 0 ); 1218 - return IRQ_RETVAL(handled); 1219 } 1220 1221 /******************************************************************************/ ··· 1252 // Just polled boards, IRQ = 0 will hit all non-interrupt boards. 1253 // It will NOT poll boards handled by hard interrupts. 1254 // The issue of queued BH interrups is handled in ip2_interrupt(). 1255 - ip2_interrupt(0, NULL); 1256 1257 PollTimer.expires = POLL_TIMEOUT; 1258 add_timer( &PollTimer );
··· 752 continue; 753 rc = request_irq( ip2config.irq[i], ip2_interrupt, 754 IP2_SA_FLAGS | (ip2config.type[i] == PCI ? IRQF_SHARED : 0), 755 + pcName, i2BoardPtrTable[i]); 756 if (rc) { 757 printk(KERN_ERR "IP2: an request_irq failed: error %d\n",rc); 758 ip2config.irq[i] = CIR_POLL; ··· 1191 #endif /* USE_IQI */ 1192 } 1193 1194 + static void 1195 + ip2_polled_interrupt(void) 1196 { 1197 int i; 1198 i2eBordStrPtr pB; 1199 + const int irq = 0; 1200 1201 ip2trace (ITRC_NO_PORT, ITRC_INTR, 99, 1, irq ); 1202 ··· 1208 // IRQ = 0 for polled boards, we won't poll "IRQ" boards 1209 1210 if ( pB && (pB->i2eUsingIrq == irq) ) { 1211 ip2_irq_work(pB); 1212 } 1213 } ··· 1216 ++irq_counter; 1217 1218 ip2trace (ITRC_NO_PORT, ITRC_INTR, ITRC_RETURN, 0 ); 1219 + } 1220 + 1221 + static irqreturn_t 1222 + ip2_interrupt(int irq, void *dev_id) 1223 + { 1224 + i2eBordStrPtr pB = dev_id; 1225 + 1226 + ip2trace (ITRC_NO_PORT, ITRC_INTR, 99, 1, pB->i2eUsingIrq ); 1227 + 1228 + ip2_irq_work(pB); 1229 + 1230 + ++irq_counter; 1231 + 1232 + ip2trace (ITRC_NO_PORT, ITRC_INTR, ITRC_RETURN, 0 ); 1233 + return IRQ_HANDLED; 1234 } 1235 1236 /******************************************************************************/ ··· 1239 // Just polled boards, IRQ = 0 will hit all non-interrupt boards. 1240 // It will NOT poll boards handled by hard interrupts. 1241 // The issue of queued BH interrups is handled in ip2_interrupt(). 1242 + ip2_polled_interrupt(); 1243 1244 PollTimer.expires = POLL_TIMEOUT; 1245 add_timer( &PollTimer );