diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-10-23 19:12:11 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-23 19:53:17 -0400 |
commit | f07ef395ad4cd050e695edfec217ceb2158220a3 (patch) | |
tree | d0a228dca81cdeb774dfb0f80121199b5e2a088d /drivers/char | |
parent | 080eb42f31a8a6dde1568f906692d9914cdfbfe8 (diff) |
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>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/riscom8.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index b37e626f4faa..102ece4c4e0e 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -79,7 +79,6 @@ | |||
79 | 79 | ||
80 | #define RS_EVENT_WRITE_WAKEUP 0 | 80 | #define RS_EVENT_WRITE_WAKEUP 0 |
81 | 81 | ||
82 | static struct riscom_board * IRQ_to_board[16]; | ||
83 | static struct tty_driver *riscom_driver; | 82 | static struct tty_driver *riscom_driver; |
84 | 83 | ||
85 | static struct riscom_board rc_board[RC_NBOARD] = { | 84 | static struct riscom_board rc_board[RC_NBOARD] = { |
@@ -537,16 +536,14 @@ static inline void rc_check_modem(struct riscom_board const * bp) | |||
537 | } | 536 | } |
538 | 537 | ||
539 | /* The main interrupt processing routine */ | 538 | /* The main interrupt processing routine */ |
540 | static irqreturn_t rc_interrupt(int irq, void * dev_id) | 539 | static irqreturn_t rc_interrupt(int dummy, void * dev_id) |
541 | { | 540 | { |
542 | unsigned char status; | 541 | unsigned char status; |
543 | unsigned char ack; | 542 | unsigned char ack; |
544 | struct riscom_board *bp; | 543 | struct riscom_board *bp = dev_id; |
545 | unsigned long loop = 0; | 544 | unsigned long loop = 0; |
546 | int handled = 0; | 545 | int handled = 0; |
547 | 546 | ||
548 | bp = IRQ_to_board[irq]; | ||
549 | |||
550 | if (!(bp->flags & RC_BOARD_ACTIVE)) | 547 | if (!(bp->flags & RC_BOARD_ACTIVE)) |
551 | return IRQ_NONE; | 548 | return IRQ_NONE; |
552 | 549 | ||
@@ -603,7 +600,7 @@ static irqreturn_t rc_interrupt(int irq, void * dev_id) | |||
603 | */ | 600 | */ |
604 | 601 | ||
605 | /* Called with disabled interrupts */ | 602 | /* Called with disabled interrupts */ |
606 | static inline int rc_setup_board(struct riscom_board * bp) | 603 | static int rc_setup_board(struct riscom_board * bp) |
607 | { | 604 | { |
608 | int error; | 605 | int error; |
609 | 606 | ||
@@ -611,7 +608,7 @@ static inline int rc_setup_board(struct riscom_board * bp) | |||
611 | return 0; | 608 | return 0; |
612 | 609 | ||
613 | error = request_irq(bp->irq, rc_interrupt, IRQF_DISABLED, | 610 | error = request_irq(bp->irq, rc_interrupt, IRQF_DISABLED, |
614 | "RISCom/8", NULL); | 611 | "RISCom/8", bp); |
615 | if (error) | 612 | if (error) |
616 | return error; | 613 | return error; |
617 | 614 | ||
@@ -619,14 +616,13 @@ static inline int rc_setup_board(struct riscom_board * bp) | |||
619 | bp->DTR = ~0; | 616 | bp->DTR = ~0; |
620 | rc_out(bp, RC_DTR, bp->DTR); /* Drop DTR on all ports */ | 617 | rc_out(bp, RC_DTR, bp->DTR); /* Drop DTR on all ports */ |
621 | 618 | ||
622 | IRQ_to_board[bp->irq] = bp; | ||
623 | bp->flags |= RC_BOARD_ACTIVE; | 619 | bp->flags |= RC_BOARD_ACTIVE; |
624 | 620 | ||
625 | return 0; | 621 | return 0; |
626 | } | 622 | } |
627 | 623 | ||
628 | /* Called with disabled interrupts */ | 624 | /* Called with disabled interrupts */ |
629 | static inline void rc_shutdown_board(struct riscom_board *bp) | 625 | static void rc_shutdown_board(struct riscom_board *bp) |
630 | { | 626 | { |
631 | if (!(bp->flags & RC_BOARD_ACTIVE)) | 627 | if (!(bp->flags & RC_BOARD_ACTIVE)) |
632 | return; | 628 | return; |
@@ -634,7 +630,6 @@ static inline void rc_shutdown_board(struct riscom_board *bp) | |||
634 | bp->flags &= ~RC_BOARD_ACTIVE; | 630 | bp->flags &= ~RC_BOARD_ACTIVE; |
635 | 631 | ||
636 | free_irq(bp->irq, NULL); | 632 | free_irq(bp->irq, NULL); |
637 | IRQ_to_board[bp->irq] = NULL; | ||
638 | 633 | ||
639 | bp->DTR = ~0; | 634 | bp->DTR = ~0; |
640 | rc_out(bp, RC_DTR, bp->DTR); /* Drop DTR on all ports */ | 635 | rc_out(bp, RC_DTR, bp->DTR); /* Drop DTR on all ports */ |
@@ -1594,7 +1589,6 @@ static inline int rc_init_drivers(void) | |||
1594 | if (!riscom_driver) | 1589 | if (!riscom_driver) |
1595 | return -ENOMEM; | 1590 | return -ENOMEM; |
1596 | 1591 | ||
1597 | memset(IRQ_to_board, 0, sizeof(IRQ_to_board)); | ||
1598 | riscom_driver->owner = THIS_MODULE; | 1592 | riscom_driver->owner = THIS_MODULE; |
1599 | riscom_driver->name = "ttyL"; | 1593 | riscom_driver->name = "ttyL"; |
1600 | riscom_driver->major = RISCOM8_NORMAL_MAJOR; | 1594 | riscom_driver->major = RISCOM8_NORMAL_MAJOR; |