aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/hp/sim/simserial.c64
-rw-r--r--include/linux/serialP.h2
2 files changed, 7 insertions, 59 deletions
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index d32b759b23f1..c35552df035e 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -92,8 +92,6 @@ static struct serial_uart_config uart_config[] = {
92 92
93struct tty_driver *hp_simserial_driver; 93struct tty_driver *hp_simserial_driver;
94 94
95static struct async_struct *IRQ_ports[NR_IRQS];
96
97static struct console *console; 95static struct console *console;
98 96
99static unsigned char *tmp_buf; 97static unsigned char *tmp_buf;
@@ -167,14 +165,9 @@ static void receive_chars(struct tty_struct *tty)
167 */ 165 */
168static irqreturn_t rs_interrupt_single(int irq, void *dev_id) 166static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
169{ 167{
170 struct async_struct * info; 168 struct async_struct *info = dev_id;
171 169
172 /* 170 if (!info->tty) {
173 * I don't know exactly why they don't use the dev_id opaque data
174 * pointer instead of this extra lookup table
175 */
176 info = IRQ_ports[irq];
177 if (!info || !info->tty) {
178 printk(KERN_INFO "simrs_interrupt_single: info|tty=0 info=%p problem\n", info); 171 printk(KERN_INFO "simrs_interrupt_single: info|tty=0 info=%p problem\n", info);
179 return IRQ_NONE; 172 return IRQ_NONE;
180 } 173 }
@@ -456,7 +449,6 @@ static void shutdown(struct async_struct * info)
456{ 449{
457 unsigned long flags; 450 unsigned long flags;
458 struct serial_state *state = info->state; 451 struct serial_state *state = info->state;
459 int retval;
460 452
461 if (!(state->flags & ASYNC_INITIALIZED)) 453 if (!(state->flags & ASYNC_INITIALIZED))
462 return; 454 return;
@@ -468,33 +460,8 @@ static void shutdown(struct async_struct * info)
468 460
469 local_irq_save(flags); 461 local_irq_save(flags);
470 { 462 {
471 /* 463 if (state->irq)
472 * First unlink the serial port from the IRQ chain... 464 free_irq(state->irq, info);
473 */
474 if (info->next_port)
475 info->next_port->prev_port = info->prev_port;
476 if (info->prev_port)
477 info->prev_port->next_port = info->next_port;
478 else
479 IRQ_ports[state->irq] = info->next_port;
480
481 /*
482 * Free the IRQ, if necessary
483 */
484 if (state->irq && (!IRQ_ports[state->irq] ||
485 !IRQ_ports[state->irq]->next_port)) {
486 if (IRQ_ports[state->irq]) {
487 free_irq(state->irq, NULL);
488 retval = request_irq(state->irq, rs_interrupt_single,
489 IRQ_T(state), "serial",
490 NULL);
491
492 if (retval)
493 printk(KERN_ERR "serial shutdown: request_irq: error %d"
494 " Couldn't reacquire IRQ.\n", retval);
495 } else
496 free_irq(state->irq, NULL);
497 }
498 465
499 if (info->xmit.buf) { 466 if (info->xmit.buf) {
500 free_page((unsigned long) info->xmit.buf); 467 free_page((unsigned long) info->xmit.buf);
@@ -645,7 +612,6 @@ startup(struct async_struct *info)
645{ 612{
646 unsigned long flags; 613 unsigned long flags;
647 int retval=0; 614 int retval=0;
648 irq_handler_t handler;
649 struct serial_state *state= info->state; 615 struct serial_state *state= info->state;
650 unsigned long page; 616 unsigned long page;
651 617
@@ -677,29 +643,13 @@ startup(struct async_struct *info)
677 /* 643 /*
678 * Allocate the IRQ if necessary 644 * Allocate the IRQ if necessary
679 */ 645 */
680 if (state->irq && (!IRQ_ports[state->irq] || 646 if (state->irq) {
681 !IRQ_ports[state->irq]->next_port)) { 647 retval = request_irq(state->irq, rs_interrupt_single,
682 if (IRQ_ports[state->irq]) { 648 IRQ_T(state), "simserial", info);
683 retval = -EBUSY;
684 goto errout;
685 } else
686 handler = rs_interrupt_single;
687
688 retval = request_irq(state->irq, handler, IRQ_T(state),
689 "simserial", NULL);
690 if (retval) 649 if (retval)
691 goto errout; 650 goto errout;
692 } 651 }
693 652
694 /*
695 * Insert serial port into IRQ chain.
696 */
697 info->prev_port = NULL;
698 info->next_port = IRQ_ports[state->irq];
699 if (info->next_port)
700 info->next_port->prev_port = info;
701 IRQ_ports[state->irq] = info;
702
703 if (info->tty) clear_bit(TTY_IO_ERROR, &info->tty->flags); 653 if (info->tty) clear_bit(TTY_IO_ERROR, &info->tty->flags);
704 654
705 info->xmit.head = info->xmit.tail = 0; 655 info->xmit.head = info->xmit.tail = 0;
diff --git a/include/linux/serialP.h b/include/linux/serialP.h
index 6ce488c46589..b8543f902453 100644
--- a/include/linux/serialP.h
+++ b/include/linux/serialP.h
@@ -56,8 +56,6 @@ struct async_struct {
56 wait_queue_head_t open_wait; 56 wait_queue_head_t open_wait;
57 wait_queue_head_t close_wait; 57 wait_queue_head_t close_wait;
58 wait_queue_head_t delta_msr_wait; 58 wait_queue_head_t delta_msr_wait;
59 struct async_struct *next_port; /* For the linked list */
60 struct async_struct *prev_port;
61}; 59};
62 60
63#endif /* _LINUX_SERIAL_H */ 61#endif /* _LINUX_SERIAL_H */