drivers/char/riscom8: clean up irq handling

Make irq handling more efficient, by passing board pointer via
request_irq() to our irq handler's dev_id argument.

This eliminates a table lookup upon each interrupt, and eliminates an
associated global variable (the table).

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

+5 -11
+5 -11
drivers/char/riscom8.c
··· 79 80 #define RS_EVENT_WRITE_WAKEUP 0 81 82 - static struct riscom_board * IRQ_to_board[16]; 83 static struct tty_driver *riscom_driver; 84 85 static struct riscom_board rc_board[RC_NBOARD] = { ··· 536 } 537 538 /* The main interrupt processing routine */ 539 - static irqreturn_t rc_interrupt(int irq, void * dev_id) 540 { 541 unsigned char status; 542 unsigned char ack; 543 - struct riscom_board *bp; 544 unsigned long loop = 0; 545 int handled = 0; 546 - 547 - bp = IRQ_to_board[irq]; 548 549 if (!(bp->flags & RC_BOARD_ACTIVE)) 550 return IRQ_NONE; ··· 600 */ 601 602 /* Called with disabled interrupts */ 603 - static inline int rc_setup_board(struct riscom_board * bp) 604 { 605 int error; 606 ··· 608 return 0; 609 610 error = request_irq(bp->irq, rc_interrupt, IRQF_DISABLED, 611 - "RISCom/8", NULL); 612 if (error) 613 return error; 614 ··· 616 bp->DTR = ~0; 617 rc_out(bp, RC_DTR, bp->DTR); /* Drop DTR on all ports */ 618 619 - IRQ_to_board[bp->irq] = bp; 620 bp->flags |= RC_BOARD_ACTIVE; 621 622 return 0; 623 } 624 625 /* Called with disabled interrupts */ 626 - static inline void rc_shutdown_board(struct riscom_board *bp) 627 { 628 if (!(bp->flags & RC_BOARD_ACTIVE)) 629 return; ··· 630 bp->flags &= ~RC_BOARD_ACTIVE; 631 632 free_irq(bp->irq, NULL); 633 - IRQ_to_board[bp->irq] = NULL; 634 635 bp->DTR = ~0; 636 rc_out(bp, RC_DTR, bp->DTR); /* Drop DTR on all ports */ ··· 1589 if (!riscom_driver) 1590 return -ENOMEM; 1591 1592 - memset(IRQ_to_board, 0, sizeof(IRQ_to_board)); 1593 riscom_driver->owner = THIS_MODULE; 1594 riscom_driver->name = "ttyL"; 1595 riscom_driver->major = RISCOM8_NORMAL_MAJOR;
··· 79 80 #define RS_EVENT_WRITE_WAKEUP 0 81 82 static struct tty_driver *riscom_driver; 83 84 static struct riscom_board rc_board[RC_NBOARD] = { ··· 537 } 538 539 /* The main interrupt processing routine */ 540 + static irqreturn_t rc_interrupt(int dummy, void * dev_id) 541 { 542 unsigned char status; 543 unsigned char ack; 544 + struct riscom_board *bp = dev_id; 545 unsigned long loop = 0; 546 int handled = 0; 547 548 if (!(bp->flags & RC_BOARD_ACTIVE)) 549 return IRQ_NONE; ··· 603 */ 604 605 /* Called with disabled interrupts */ 606 + static int rc_setup_board(struct riscom_board * bp) 607 { 608 int error; 609 ··· 611 return 0; 612 613 error = request_irq(bp->irq, rc_interrupt, IRQF_DISABLED, 614 + "RISCom/8", bp); 615 if (error) 616 return error; 617 ··· 619 bp->DTR = ~0; 620 rc_out(bp, RC_DTR, bp->DTR); /* Drop DTR on all ports */ 621 622 bp->flags |= RC_BOARD_ACTIVE; 623 624 return 0; 625 } 626 627 /* Called with disabled interrupts */ 628 + static void rc_shutdown_board(struct riscom_board *bp) 629 { 630 if (!(bp->flags & RC_BOARD_ACTIVE)) 631 return; ··· 634 bp->flags &= ~RC_BOARD_ACTIVE; 635 636 free_irq(bp->irq, NULL); 637 638 bp->DTR = ~0; 639 rc_out(bp, RC_DTR, bp->DTR); /* Drop DTR on all ports */ ··· 1594 if (!riscom_driver) 1595 return -ENOMEM; 1596 1597 riscom_driver->owner = THIS_MODULE; 1598 riscom_driver->name = "ttyL"; 1599 riscom_driver->major = RISCOM8_NORMAL_MAJOR;