aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-03-05 08:52:15 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 15:27:17 -0500
commit979b6d89766ed573bca6a6e902193c4cad502909 (patch)
treee8e429e2f87b3f4d939bfa343937b733aedc7bc8 /arch/ia64
parent9e12dd5fce1c676e709625bd2f55dc83664c3c93 (diff)
TTY: simserial, use only one copy of async flags
The same as for amiserial. Use only one instance of the flags. Also remove them from async_struct now. Nobody else uses them. 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')
-rw-r--r--arch/ia64/hp/sim/simserial.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index 8f68972b015f..a08a53f033b4 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -46,7 +46,7 @@
46 46
47#define NR_PORTS 1 /* only one port for now */ 47#define NR_PORTS 1 /* only one port for now */
48 48
49#define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? IRQF_SHARED : IRQF_DISABLED) 49#define IRQ_T(state) ((state->flags & ASYNC_SHARE_IRQ) ? IRQF_SHARED : IRQF_DISABLED)
50 50
51static char *serial_name = "SimSerial driver"; 51static char *serial_name = "SimSerial driver";
52static char *serial_version = "0.6"; 52static char *serial_version = "0.6";
@@ -455,12 +455,11 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
455static void shutdown(struct async_struct * info) 455static void shutdown(struct async_struct * info)
456{ 456{
457 unsigned long flags; 457 unsigned long flags;
458 struct serial_state *state; 458 struct serial_state *state = info->state;
459 int retval; 459 int retval;
460 460
461 if (!(info->flags & ASYNC_INITIALIZED)) return; 461 if (!(state->flags & ASYNC_INITIALIZED))
462 462 return;
463 state = info->state;
464 463
465#ifdef SIMSERIAL_DEBUG 464#ifdef SIMSERIAL_DEBUG
466 printk("Shutting down serial port %d (irq %d)....", info->line, 465 printk("Shutting down serial port %d (irq %d)....", info->line,
@@ -487,7 +486,8 @@ static void shutdown(struct async_struct * info)
487 if (IRQ_ports[state->irq]) { 486 if (IRQ_ports[state->irq]) {
488 free_irq(state->irq, NULL); 487 free_irq(state->irq, NULL);
489 retval = request_irq(state->irq, rs_interrupt_single, 488 retval = request_irq(state->irq, rs_interrupt_single,
490 IRQ_T(info), "serial", NULL); 489 IRQ_T(state), "serial",
490 NULL);
491 491
492 if (retval) 492 if (retval)
493 printk(KERN_ERR "serial shutdown: request_irq: error %d" 493 printk(KERN_ERR "serial shutdown: request_irq: error %d"
@@ -503,7 +503,7 @@ static void shutdown(struct async_struct * info)
503 503
504 if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags); 504 if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags);
505 505
506 info->flags &= ~ASYNC_INITIALIZED; 506 state->flags &= ~ASYNC_INITIALIZED;
507 } 507 }
508 local_irq_restore(flags); 508 local_irq_restore(flags);
509} 509}
@@ -560,7 +560,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
560 local_irq_restore(flags); 560 local_irq_restore(flags);
561 return; 561 return;
562 } 562 }
563 info->flags |= ASYNC_CLOSING; 563 state->flags |= ASYNC_CLOSING;
564 local_irq_restore(flags); 564 local_irq_restore(flags);
565 565
566 /* 566 /*
@@ -576,7 +576,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
576 schedule_timeout_interruptible(info->close_delay); 576 schedule_timeout_interruptible(info->close_delay);
577 wake_up_interruptible(&info->open_wait); 577 wake_up_interruptible(&info->open_wait);
578 } 578 }
579 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 579 state->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
580 wake_up_interruptible(&info->close_wait); 580 wake_up_interruptible(&info->close_wait);
581} 581}
582 582
@@ -600,15 +600,13 @@ static void rs_hangup(struct tty_struct *tty)
600 printk("rs_hangup: called\n"); 600 printk("rs_hangup: called\n");
601#endif 601#endif
602 602
603 state = info->state;
604
605 rs_flush_buffer(tty); 603 rs_flush_buffer(tty);
606 if (info->flags & ASYNC_CLOSING) 604 if (state->flags & ASYNC_CLOSING)
607 return; 605 return;
608 shutdown(info); 606 shutdown(info);
609 607
610 state->count = 0; 608 state->count = 0;
611 info->flags &= ~ASYNC_NORMAL_ACTIVE; 609 state->flags &= ~ASYNC_NORMAL_ACTIVE;
612 info->tty = NULL; 610 info->tty = NULL;
613 wake_up_interruptible(&info->open_wait); 611 wake_up_interruptible(&info->open_wait);
614} 612}
@@ -633,7 +631,6 @@ static int get_async_struct(int line, struct async_struct **ret_info)
633 init_waitqueue_head(&info->open_wait); 631 init_waitqueue_head(&info->open_wait);
634 init_waitqueue_head(&info->close_wait); 632 init_waitqueue_head(&info->close_wait);
635 info->port = sstate->port; 633 info->port = sstate->port;
636 info->flags = sstate->flags;
637 info->xmit_fifo_size = sstate->xmit_fifo_size; 634 info->xmit_fifo_size = sstate->xmit_fifo_size;
638 info->line = line; 635 info->line = line;
639 info->state = sstate; 636 info->state = sstate;
@@ -661,7 +658,7 @@ startup(struct async_struct *info)
661 658
662 local_irq_save(flags); 659 local_irq_save(flags);
663 660
664 if (info->flags & ASYNC_INITIALIZED) { 661 if (state->flags & ASYNC_INITIALIZED) {
665 free_page(page); 662 free_page(page);
666 goto errout; 663 goto errout;
667 } 664 }
@@ -691,7 +688,8 @@ startup(struct async_struct *info)
691 } else 688 } else
692 handler = rs_interrupt_single; 689 handler = rs_interrupt_single;
693 690
694 retval = request_irq(state->irq, handler, IRQ_T(info), "simserial", NULL); 691 retval = request_irq(state->irq, handler, IRQ_T(state),
692 "simserial", NULL);
695 if (retval) 693 if (retval)
696 goto errout; 694 goto errout;
697 } 695 }
@@ -721,17 +719,17 @@ startup(struct async_struct *info)
721 * Set up the tty->alt_speed kludge 719 * Set up the tty->alt_speed kludge
722 */ 720 */
723 if (info->tty) { 721 if (info->tty) {
724 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 722 if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
725 info->tty->alt_speed = 57600; 723 info->tty->alt_speed = 57600;
726 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 724 if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
727 info->tty->alt_speed = 115200; 725 info->tty->alt_speed = 115200;
728 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 726 if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
729 info->tty->alt_speed = 230400; 727 info->tty->alt_speed = 230400;
730 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 728 if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
731 info->tty->alt_speed = 460800; 729 info->tty->alt_speed = 460800;
732 } 730 }
733 731
734 info->flags |= ASYNC_INITIALIZED; 732 state->flags |= ASYNC_INITIALIZED;
735 local_irq_restore(flags); 733 local_irq_restore(flags);
736 return 0; 734 return 0;
737 735
@@ -762,7 +760,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
762#ifdef SIMSERIAL_DEBUG 760#ifdef SIMSERIAL_DEBUG
763 printk("rs_open %s, count = %d\n", tty->name, info->state->count); 761 printk("rs_open %s, count = %d\n", tty->name, info->state->count);
764#endif 762#endif
765 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 763 info->tty->low_latency = (info->state->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
766 764
767 if (!tmp_buf) { 765 if (!tmp_buf) {
768 page = get_zeroed_page(GFP_KERNEL); 766 page = get_zeroed_page(GFP_KERNEL);
@@ -778,11 +776,11 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
778 * If the port is the middle of closing, bail out now 776 * If the port is the middle of closing, bail out now
779 */ 777 */
780 if (tty_hung_up_p(filp) || 778 if (tty_hung_up_p(filp) ||
781 (info->flags & ASYNC_CLOSING)) { 779 (info->state->flags & ASYNC_CLOSING)) {
782 if (info->flags & ASYNC_CLOSING) 780 if (info->state->flags & ASYNC_CLOSING)
783 interruptible_sleep_on(&info->close_wait); 781 interruptible_sleep_on(&info->close_wait);
784#ifdef SERIAL_DO_RESTART 782#ifdef SERIAL_DO_RESTART
785 return ((info->flags & ASYNC_HUP_NOTIFY) ? 783 return ((info->state->flags & ASYNC_HUP_NOTIFY) ?
786 -EAGAIN : -ERESTARTSYS); 784 -EAGAIN : -ERESTARTSYS);
787#else 785#else
788 return -EAGAIN; 786 return -EAGAIN;