aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/hp/sim
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-03-05 08:52:17 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 15:27:57 -0500
commit964105b501071e8a0e9feb1d0e4b3e46508bc38e (patch)
treee312158b9f0ffdb4c6ad46d554593b70e3092114 /arch/ia64/hp/sim
parentd852256389f1bcf506710ea5de77debde40013b9 (diff)
TTY: simserial, remove support of shared interrupts
It never worked there. The ISR was never written for that kind of stuff. So remove all that crap with a hash of linked lists and pass the pointer directly to the ISR. BTW this answers the question there: * I don't know exactly why they don't use the dev_id opaque data * pointer instead of this extra lookup table -> Because they thought they will support more devices bound to a single interrupt w/o IRQF_SHARED. They would need exactly the hash there. What I don't understand is rebinding of the interrupt in the shutdown path. They perhaps meant to do just synchronize_irq? In any case, this is all gone and free_irq there properly. By removing the hash we save some bits (exactly NR_IRQS * 8 bytes of .bss and over a kilo of .text): before: text data bss dec hex filename 19600 320 8227 28147 6df3 ../a/ia64/arch/ia64/hp/sim/simserial.o after: text data bss dec hex filename 18568 320 28 18916 49e4 ../a/ia64/arch/ia64/hp/sim/simserial.o Note that a shared interrupt could not work too. request_irq requires data parameter to be non-NULL. So the whole IRQ_T exercise was pointless. Finally, this helps us remove another two members of async_struct :). Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/ia64/hp/sim')
-rw-r--r--arch/ia64/hp/sim/simserial.c64
1 files changed, 7 insertions, 57 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;