diff options
author | Alan Cox <alan@redhat.com> | 2008-07-16 16:56:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-20 20:12:37 -0400 |
commit | 8fb06c771399b8d51d724756411108e9abe2a85a (patch) | |
tree | 8f1bfa4d03c545def4968141420c727074d89da2 /drivers/char/synclinkmp.c | |
parent | f8ae47641611fcdf175ab8bbe89054731b16971d (diff) |
synclink: use tty_port
Switch the synclink ports to use the new tty_port structure
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/synclinkmp.c')
-rw-r--r-- | drivers/char/synclinkmp.c | 203 |
1 files changed, 98 insertions, 105 deletions
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 5341b5aaf8bc..5b5b292d046b 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -151,18 +151,15 @@ struct _input_signal_events { | |||
151 | typedef struct _synclinkmp_info { | 151 | typedef struct _synclinkmp_info { |
152 | void *if_ptr; /* General purpose pointer (used by SPPP) */ | 152 | void *if_ptr; /* General purpose pointer (used by SPPP) */ |
153 | int magic; | 153 | int magic; |
154 | int flags; | 154 | struct tty_port port; |
155 | int count; /* count of opens */ | ||
156 | int line; | 155 | int line; |
157 | unsigned short close_delay; | 156 | unsigned short close_delay; |
158 | unsigned short closing_wait; /* time to wait before closing */ | 157 | unsigned short closing_wait; /* time to wait before closing */ |
159 | 158 | ||
160 | struct mgsl_icount icount; | 159 | struct mgsl_icount icount; |
161 | 160 | ||
162 | struct tty_struct *tty; | ||
163 | int timeout; | 161 | int timeout; |
164 | int x_char; /* xon/xoff character */ | 162 | int x_char; /* xon/xoff character */ |
165 | int blocked_open; /* # of blocked opens */ | ||
166 | u16 read_status_mask1; /* break detection (SR1 indications) */ | 163 | u16 read_status_mask1; /* break detection (SR1 indications) */ |
167 | u16 read_status_mask2; /* parity/framing/overun (SR2 indications) */ | 164 | u16 read_status_mask2; /* parity/framing/overun (SR2 indications) */ |
168 | unsigned char ignore_status_mask1; /* break detection (SR1 indications) */ | 165 | unsigned char ignore_status_mask1; /* break detection (SR1 indications) */ |
@@ -172,9 +169,6 @@ typedef struct _synclinkmp_info { | |||
172 | int tx_get; | 169 | int tx_get; |
173 | int tx_count; | 170 | int tx_count; |
174 | 171 | ||
175 | wait_queue_head_t open_wait; | ||
176 | wait_queue_head_t close_wait; | ||
177 | |||
178 | wait_queue_head_t status_event_wait_q; | 172 | wait_queue_head_t status_event_wait_q; |
179 | wait_queue_head_t event_wait_q; | 173 | wait_queue_head_t event_wait_q; |
180 | struct timer_list tx_timer; /* HDLC transmit timeout timer */ | 174 | struct timer_list tx_timer; /* HDLC transmit timeout timer */ |
@@ -462,13 +456,13 @@ static int synclinkmp_device_count = 0; | |||
462 | * .text section address and breakpoint on module load. | 456 | * .text section address and breakpoint on module load. |
463 | * This is useful for use with gdb and add-symbol-file command. | 457 | * This is useful for use with gdb and add-symbol-file command. |
464 | */ | 458 | */ |
465 | static int break_on_load=0; | 459 | static int break_on_load = 0; |
466 | 460 | ||
467 | /* | 461 | /* |
468 | * Driver major number, defaults to zero to get auto | 462 | * Driver major number, defaults to zero to get auto |
469 | * assigned major number. May be forced as module parameter. | 463 | * assigned major number. May be forced as module parameter. |
470 | */ | 464 | */ |
471 | static int ttymajor=0; | 465 | static int ttymajor = 0; |
472 | 466 | ||
473 | /* | 467 | /* |
474 | * Array of user specified options for ISA adapters. | 468 | * Array of user specified options for ISA adapters. |
@@ -747,22 +741,22 @@ static int open(struct tty_struct *tty, struct file *filp) | |||
747 | } | 741 | } |
748 | 742 | ||
749 | tty->driver_data = info; | 743 | tty->driver_data = info; |
750 | info->tty = tty; | 744 | info->port.tty = tty; |
751 | 745 | ||
752 | if (debug_level >= DEBUG_LEVEL_INFO) | 746 | if (debug_level >= DEBUG_LEVEL_INFO) |
753 | printk("%s(%d):%s open(), old ref count = %d\n", | 747 | printk("%s(%d):%s open(), old ref count = %d\n", |
754 | __FILE__,__LINE__,tty->driver->name, info->count); | 748 | __FILE__,__LINE__,tty->driver->name, info->port.count); |
755 | 749 | ||
756 | /* If port is closing, signal caller to try again */ | 750 | /* If port is closing, signal caller to try again */ |
757 | if (tty_hung_up_p(filp) || info->flags & ASYNC_CLOSING){ | 751 | if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){ |
758 | if (info->flags & ASYNC_CLOSING) | 752 | if (info->port.flags & ASYNC_CLOSING) |
759 | interruptible_sleep_on(&info->close_wait); | 753 | interruptible_sleep_on(&info->port.close_wait); |
760 | retval = ((info->flags & ASYNC_HUP_NOTIFY) ? | 754 | retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ? |
761 | -EAGAIN : -ERESTARTSYS); | 755 | -EAGAIN : -ERESTARTSYS); |
762 | goto cleanup; | 756 | goto cleanup; |
763 | } | 757 | } |
764 | 758 | ||
765 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 759 | info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
766 | 760 | ||
767 | spin_lock_irqsave(&info->netlock, flags); | 761 | spin_lock_irqsave(&info->netlock, flags); |
768 | if (info->netcount) { | 762 | if (info->netcount) { |
@@ -770,10 +764,10 @@ static int open(struct tty_struct *tty, struct file *filp) | |||
770 | spin_unlock_irqrestore(&info->netlock, flags); | 764 | spin_unlock_irqrestore(&info->netlock, flags); |
771 | goto cleanup; | 765 | goto cleanup; |
772 | } | 766 | } |
773 | info->count++; | 767 | info->port.count++; |
774 | spin_unlock_irqrestore(&info->netlock, flags); | 768 | spin_unlock_irqrestore(&info->netlock, flags); |
775 | 769 | ||
776 | if (info->count == 1) { | 770 | if (info->port.count == 1) { |
777 | /* 1st open on this device, init hardware */ | 771 | /* 1st open on this device, init hardware */ |
778 | retval = startup(info); | 772 | retval = startup(info); |
779 | if (retval < 0) | 773 | if (retval < 0) |
@@ -796,9 +790,9 @@ static int open(struct tty_struct *tty, struct file *filp) | |||
796 | cleanup: | 790 | cleanup: |
797 | if (retval) { | 791 | if (retval) { |
798 | if (tty->count == 1) | 792 | if (tty->count == 1) |
799 | info->tty = NULL; /* tty layer will release tty struct */ | 793 | info->port.tty = NULL; /* tty layer will release tty struct */ |
800 | if(info->count) | 794 | if(info->port.count) |
801 | info->count--; | 795 | info->port.count--; |
802 | } | 796 | } |
803 | 797 | ||
804 | return retval; | 798 | return retval; |
@@ -816,33 +810,33 @@ static void close(struct tty_struct *tty, struct file *filp) | |||
816 | 810 | ||
817 | if (debug_level >= DEBUG_LEVEL_INFO) | 811 | if (debug_level >= DEBUG_LEVEL_INFO) |
818 | printk("%s(%d):%s close() entry, count=%d\n", | 812 | printk("%s(%d):%s close() entry, count=%d\n", |
819 | __FILE__,__LINE__, info->device_name, info->count); | 813 | __FILE__,__LINE__, info->device_name, info->port.count); |
820 | 814 | ||
821 | if (!info->count) | 815 | if (!info->port.count) |
822 | return; | 816 | return; |
823 | 817 | ||
824 | if (tty_hung_up_p(filp)) | 818 | if (tty_hung_up_p(filp)) |
825 | goto cleanup; | 819 | goto cleanup; |
826 | 820 | ||
827 | if ((tty->count == 1) && (info->count != 1)) { | 821 | if ((tty->count == 1) && (info->port.count != 1)) { |
828 | /* | 822 | /* |
829 | * tty->count is 1 and the tty structure will be freed. | 823 | * tty->count is 1 and the tty structure will be freed. |
830 | * info->count should be one in this case. | 824 | * info->port.count should be one in this case. |
831 | * if it's not, correct it so that the port is shutdown. | 825 | * if it's not, correct it so that the port is shutdown. |
832 | */ | 826 | */ |
833 | printk("%s(%d):%s close: bad refcount; tty->count is 1, " | 827 | printk("%s(%d):%s close: bad refcount; tty->count is 1, " |
834 | "info->count is %d\n", | 828 | "info->port.count is %d\n", |
835 | __FILE__,__LINE__, info->device_name, info->count); | 829 | __FILE__,__LINE__, info->device_name, info->port.count); |
836 | info->count = 1; | 830 | info->port.count = 1; |
837 | } | 831 | } |
838 | 832 | ||
839 | info->count--; | 833 | info->port.count--; |
840 | 834 | ||
841 | /* if at least one open remaining, leave hardware active */ | 835 | /* if at least one open remaining, leave hardware active */ |
842 | if (info->count) | 836 | if (info->port.count) |
843 | goto cleanup; | 837 | goto cleanup; |
844 | 838 | ||
845 | info->flags |= ASYNC_CLOSING; | 839 | info->port.flags |= ASYNC_CLOSING; |
846 | 840 | ||
847 | /* set tty->closing to notify line discipline to | 841 | /* set tty->closing to notify line discipline to |
848 | * only process XON/XOFF characters. Only the N_TTY | 842 | * only process XON/XOFF characters. Only the N_TTY |
@@ -859,7 +853,7 @@ static void close(struct tty_struct *tty, struct file *filp) | |||
859 | tty_wait_until_sent(tty, info->closing_wait); | 853 | tty_wait_until_sent(tty, info->closing_wait); |
860 | } | 854 | } |
861 | 855 | ||
862 | if (info->flags & ASYNC_INITIALIZED) | 856 | if (info->port.flags & ASYNC_INITIALIZED) |
863 | wait_until_sent(tty, info->timeout); | 857 | wait_until_sent(tty, info->timeout); |
864 | 858 | ||
865 | flush_buffer(tty); | 859 | flush_buffer(tty); |
@@ -869,23 +863,23 @@ static void close(struct tty_struct *tty, struct file *filp) | |||
869 | shutdown(info); | 863 | shutdown(info); |
870 | 864 | ||
871 | tty->closing = 0; | 865 | tty->closing = 0; |
872 | info->tty = NULL; | 866 | info->port.tty = NULL; |
873 | 867 | ||
874 | if (info->blocked_open) { | 868 | if (info->port.blocked_open) { |
875 | if (info->close_delay) { | 869 | if (info->close_delay) { |
876 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); | 870 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); |
877 | } | 871 | } |
878 | wake_up_interruptible(&info->open_wait); | 872 | wake_up_interruptible(&info->port.open_wait); |
879 | } | 873 | } |
880 | 874 | ||
881 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 875 | info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
882 | 876 | ||
883 | wake_up_interruptible(&info->close_wait); | 877 | wake_up_interruptible(&info->port.close_wait); |
884 | 878 | ||
885 | cleanup: | 879 | cleanup: |
886 | if (debug_level >= DEBUG_LEVEL_INFO) | 880 | if (debug_level >= DEBUG_LEVEL_INFO) |
887 | printk("%s(%d):%s close() exit, count=%d\n", __FILE__,__LINE__, | 881 | printk("%s(%d):%s close() exit, count=%d\n", __FILE__,__LINE__, |
888 | tty->driver->name, info->count); | 882 | tty->driver->name, info->port.count); |
889 | } | 883 | } |
890 | 884 | ||
891 | /* Called by tty_hangup() when a hangup is signaled. | 885 | /* Called by tty_hangup() when a hangup is signaled. |
@@ -905,11 +899,11 @@ static void hangup(struct tty_struct *tty) | |||
905 | flush_buffer(tty); | 899 | flush_buffer(tty); |
906 | shutdown(info); | 900 | shutdown(info); |
907 | 901 | ||
908 | info->count = 0; | 902 | info->port.count = 0; |
909 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 903 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
910 | info->tty = NULL; | 904 | info->port.tty = NULL; |
911 | 905 | ||
912 | wake_up_interruptible(&info->open_wait); | 906 | wake_up_interruptible(&info->port.open_wait); |
913 | } | 907 | } |
914 | 908 | ||
915 | /* Set new termios settings | 909 | /* Set new termios settings |
@@ -1123,7 +1117,7 @@ static void wait_until_sent(struct tty_struct *tty, int timeout) | |||
1123 | 1117 | ||
1124 | lock_kernel(); | 1118 | lock_kernel(); |
1125 | 1119 | ||
1126 | if (!(info->flags & ASYNC_INITIALIZED)) | 1120 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
1127 | goto exit; | 1121 | goto exit; |
1128 | 1122 | ||
1129 | orig_jiffies = jiffies; | 1123 | orig_jiffies = jiffies; |
@@ -1636,7 +1630,7 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding, | |||
1636 | unsigned short new_crctype; | 1630 | unsigned short new_crctype; |
1637 | 1631 | ||
1638 | /* return error if TTY interface open */ | 1632 | /* return error if TTY interface open */ |
1639 | if (info->count) | 1633 | if (info->port.count) |
1640 | return -EBUSY; | 1634 | return -EBUSY; |
1641 | 1635 | ||
1642 | switch (encoding) | 1636 | switch (encoding) |
@@ -1733,7 +1727,7 @@ static int hdlcdev_open(struct net_device *dev) | |||
1733 | 1727 | ||
1734 | /* arbitrate between network and tty opens */ | 1728 | /* arbitrate between network and tty opens */ |
1735 | spin_lock_irqsave(&info->netlock, flags); | 1729 | spin_lock_irqsave(&info->netlock, flags); |
1736 | if (info->count != 0 || info->netcount != 0) { | 1730 | if (info->port.count != 0 || info->netcount != 0) { |
1737 | printk(KERN_WARNING "%s: hdlc_open returning busy\n", dev->name); | 1731 | printk(KERN_WARNING "%s: hdlc_open returning busy\n", dev->name); |
1738 | spin_unlock_irqrestore(&info->netlock, flags); | 1732 | spin_unlock_irqrestore(&info->netlock, flags); |
1739 | return -EBUSY; | 1733 | return -EBUSY; |
@@ -1819,7 +1813,7 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1819 | printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name); | 1813 | printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name); |
1820 | 1814 | ||
1821 | /* return error if TTY interface open */ | 1815 | /* return error if TTY interface open */ |
1822 | if (info->count) | 1816 | if (info->port.count) |
1823 | return -EBUSY; | 1817 | return -EBUSY; |
1824 | 1818 | ||
1825 | if (cmd != SIOCWANDEV) | 1819 | if (cmd != SIOCWANDEV) |
@@ -2128,7 +2122,7 @@ static void bh_receive(SLMP_INFO *info) | |||
2128 | 2122 | ||
2129 | static void bh_transmit(SLMP_INFO *info) | 2123 | static void bh_transmit(SLMP_INFO *info) |
2130 | { | 2124 | { |
2131 | struct tty_struct *tty = info->tty; | 2125 | struct tty_struct *tty = info->port.tty; |
2132 | 2126 | ||
2133 | if ( debug_level >= DEBUG_LEVEL_BH ) | 2127 | if ( debug_level >= DEBUG_LEVEL_BH ) |
2134 | printk( "%s(%d):%s bh_transmit() entry\n", | 2128 | printk( "%s(%d):%s bh_transmit() entry\n", |
@@ -2178,7 +2172,7 @@ static void isr_timer(SLMP_INFO * info) | |||
2178 | 2172 | ||
2179 | static void isr_rxint(SLMP_INFO * info) | 2173 | static void isr_rxint(SLMP_INFO * info) |
2180 | { | 2174 | { |
2181 | struct tty_struct *tty = info->tty; | 2175 | struct tty_struct *tty = info->port.tty; |
2182 | struct mgsl_icount *icount = &info->icount; | 2176 | struct mgsl_icount *icount = &info->icount; |
2183 | unsigned char status = read_reg(info, SR1) & info->ie1_value & (FLGD + IDLD + CDCD + BRKD); | 2177 | unsigned char status = read_reg(info, SR1) & info->ie1_value & (FLGD + IDLD + CDCD + BRKD); |
2184 | unsigned char status2 = read_reg(info, SR2) & info->ie2_value & OVRN; | 2178 | unsigned char status2 = read_reg(info, SR2) & info->ie2_value & OVRN; |
@@ -2205,7 +2199,7 @@ static void isr_rxint(SLMP_INFO * info) | |||
2205 | if (!(status & info->ignore_status_mask1)) { | 2199 | if (!(status & info->ignore_status_mask1)) { |
2206 | if (info->read_status_mask1 & BRKD) { | 2200 | if (info->read_status_mask1 & BRKD) { |
2207 | tty_insert_flip_char(tty, 0, TTY_BREAK); | 2201 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
2208 | if (info->flags & ASYNC_SAK) | 2202 | if (info->port.flags & ASYNC_SAK) |
2209 | do_SAK(tty); | 2203 | do_SAK(tty); |
2210 | } | 2204 | } |
2211 | } | 2205 | } |
@@ -2239,7 +2233,7 @@ static void isr_rxrdy(SLMP_INFO * info) | |||
2239 | { | 2233 | { |
2240 | u16 status; | 2234 | u16 status; |
2241 | unsigned char DataByte; | 2235 | unsigned char DataByte; |
2242 | struct tty_struct *tty = info->tty; | 2236 | struct tty_struct *tty = info->port.tty; |
2243 | struct mgsl_icount *icount = &info->icount; | 2237 | struct mgsl_icount *icount = &info->icount; |
2244 | 2238 | ||
2245 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2239 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
@@ -2352,7 +2346,7 @@ static void isr_txeom(SLMP_INFO * info, unsigned char status) | |||
2352 | else | 2346 | else |
2353 | #endif | 2347 | #endif |
2354 | { | 2348 | { |
2355 | if (info->tty && (info->tty->stopped || info->tty->hw_stopped)) { | 2349 | if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) { |
2356 | tx_stop(info); | 2350 | tx_stop(info); |
2357 | return; | 2351 | return; |
2358 | } | 2352 | } |
@@ -2407,7 +2401,7 @@ static void isr_txrdy(SLMP_INFO * info) | |||
2407 | return; | 2401 | return; |
2408 | } | 2402 | } |
2409 | 2403 | ||
2410 | if (info->tty && (info->tty->stopped || info->tty->hw_stopped)) { | 2404 | if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) { |
2411 | tx_stop(info); | 2405 | tx_stop(info); |
2412 | return; | 2406 | return; |
2413 | } | 2407 | } |
@@ -2554,29 +2548,29 @@ static void isr_io_pin( SLMP_INFO *info, u16 status ) | |||
2554 | wake_up_interruptible(&info->status_event_wait_q); | 2548 | wake_up_interruptible(&info->status_event_wait_q); |
2555 | wake_up_interruptible(&info->event_wait_q); | 2549 | wake_up_interruptible(&info->event_wait_q); |
2556 | 2550 | ||
2557 | if ( (info->flags & ASYNC_CHECK_CD) && | 2551 | if ( (info->port.flags & ASYNC_CHECK_CD) && |
2558 | (status & MISCSTATUS_DCD_LATCHED) ) { | 2552 | (status & MISCSTATUS_DCD_LATCHED) ) { |
2559 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2553 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
2560 | printk("%s CD now %s...", info->device_name, | 2554 | printk("%s CD now %s...", info->device_name, |
2561 | (status & SerialSignal_DCD) ? "on" : "off"); | 2555 | (status & SerialSignal_DCD) ? "on" : "off"); |
2562 | if (status & SerialSignal_DCD) | 2556 | if (status & SerialSignal_DCD) |
2563 | wake_up_interruptible(&info->open_wait); | 2557 | wake_up_interruptible(&info->port.open_wait); |
2564 | else { | 2558 | else { |
2565 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2559 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
2566 | printk("doing serial hangup..."); | 2560 | printk("doing serial hangup..."); |
2567 | if (info->tty) | 2561 | if (info->port.tty) |
2568 | tty_hangup(info->tty); | 2562 | tty_hangup(info->port.tty); |
2569 | } | 2563 | } |
2570 | } | 2564 | } |
2571 | 2565 | ||
2572 | if ( (info->flags & ASYNC_CTS_FLOW) && | 2566 | if ( (info->port.flags & ASYNC_CTS_FLOW) && |
2573 | (status & MISCSTATUS_CTS_LATCHED) ) { | 2567 | (status & MISCSTATUS_CTS_LATCHED) ) { |
2574 | if ( info->tty ) { | 2568 | if ( info->port.tty ) { |
2575 | if (info->tty->hw_stopped) { | 2569 | if (info->port.tty->hw_stopped) { |
2576 | if (status & SerialSignal_CTS) { | 2570 | if (status & SerialSignal_CTS) { |
2577 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2571 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
2578 | printk("CTS tx start..."); | 2572 | printk("CTS tx start..."); |
2579 | info->tty->hw_stopped = 0; | 2573 | info->port.tty->hw_stopped = 0; |
2580 | tx_start(info); | 2574 | tx_start(info); |
2581 | info->pending_bh |= BH_TRANSMIT; | 2575 | info->pending_bh |= BH_TRANSMIT; |
2582 | return; | 2576 | return; |
@@ -2585,7 +2579,7 @@ static void isr_io_pin( SLMP_INFO *info, u16 status ) | |||
2585 | if (!(status & SerialSignal_CTS)) { | 2579 | if (!(status & SerialSignal_CTS)) { |
2586 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2580 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
2587 | printk("CTS tx stop..."); | 2581 | printk("CTS tx stop..."); |
2588 | info->tty->hw_stopped = 1; | 2582 | info->port.tty->hw_stopped = 1; |
2589 | tx_stop(info); | 2583 | tx_stop(info); |
2590 | } | 2584 | } |
2591 | } | 2585 | } |
@@ -2701,7 +2695,7 @@ static irqreturn_t synclinkmp_interrupt(int dummy, void *dev_id) | |||
2701 | * do not request bottom half processing if the | 2695 | * do not request bottom half processing if the |
2702 | * device is not open in a normal mode. | 2696 | * device is not open in a normal mode. |
2703 | */ | 2697 | */ |
2704 | if ( port && (port->count || port->netcount) && | 2698 | if ( port && (port->port.count || port->netcount) && |
2705 | port->pending_bh && !port->bh_running && | 2699 | port->pending_bh && !port->bh_running && |
2706 | !port->bh_requested ) { | 2700 | !port->bh_requested ) { |
2707 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2701 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
@@ -2727,7 +2721,7 @@ static int startup(SLMP_INFO * info) | |||
2727 | if ( debug_level >= DEBUG_LEVEL_INFO ) | 2721 | if ( debug_level >= DEBUG_LEVEL_INFO ) |
2728 | printk("%s(%d):%s tx_releaseup()\n",__FILE__,__LINE__,info->device_name); | 2722 | printk("%s(%d):%s tx_releaseup()\n",__FILE__,__LINE__,info->device_name); |
2729 | 2723 | ||
2730 | if (info->flags & ASYNC_INITIALIZED) | 2724 | if (info->port.flags & ASYNC_INITIALIZED) |
2731 | return 0; | 2725 | return 0; |
2732 | 2726 | ||
2733 | if (!info->tx_buf) { | 2727 | if (!info->tx_buf) { |
@@ -2750,10 +2744,10 @@ static int startup(SLMP_INFO * info) | |||
2750 | 2744 | ||
2751 | mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10)); | 2745 | mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10)); |
2752 | 2746 | ||
2753 | if (info->tty) | 2747 | if (info->port.tty) |
2754 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 2748 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2755 | 2749 | ||
2756 | info->flags |= ASYNC_INITIALIZED; | 2750 | info->port.flags |= ASYNC_INITIALIZED; |
2757 | 2751 | ||
2758 | return 0; | 2752 | return 0; |
2759 | } | 2753 | } |
@@ -2764,7 +2758,7 @@ static void shutdown(SLMP_INFO * info) | |||
2764 | { | 2758 | { |
2765 | unsigned long flags; | 2759 | unsigned long flags; |
2766 | 2760 | ||
2767 | if (!(info->flags & ASYNC_INITIALIZED)) | 2761 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
2768 | return; | 2762 | return; |
2769 | 2763 | ||
2770 | if (debug_level >= DEBUG_LEVEL_INFO) | 2764 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -2786,17 +2780,17 @@ static void shutdown(SLMP_INFO * info) | |||
2786 | 2780 | ||
2787 | reset_port(info); | 2781 | reset_port(info); |
2788 | 2782 | ||
2789 | if (!info->tty || info->tty->termios->c_cflag & HUPCL) { | 2783 | if (!info->port.tty || info->port.tty->termios->c_cflag & HUPCL) { |
2790 | info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); | 2784 | info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); |
2791 | set_signals(info); | 2785 | set_signals(info); |
2792 | } | 2786 | } |
2793 | 2787 | ||
2794 | spin_unlock_irqrestore(&info->lock,flags); | 2788 | spin_unlock_irqrestore(&info->lock,flags); |
2795 | 2789 | ||
2796 | if (info->tty) | 2790 | if (info->port.tty) |
2797 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2791 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2798 | 2792 | ||
2799 | info->flags &= ~ASYNC_INITIALIZED; | 2793 | info->port.flags &= ~ASYNC_INITIALIZED; |
2800 | } | 2794 | } |
2801 | 2795 | ||
2802 | static void program_hw(SLMP_INFO *info) | 2796 | static void program_hw(SLMP_INFO *info) |
@@ -2827,7 +2821,7 @@ static void program_hw(SLMP_INFO *info) | |||
2827 | 2821 | ||
2828 | get_signals(info); | 2822 | get_signals(info); |
2829 | 2823 | ||
2830 | if (info->netcount || (info->tty && info->tty->termios->c_cflag & CREAD) ) | 2824 | if (info->netcount || (info->port.tty && info->port.tty->termios->c_cflag & CREAD) ) |
2831 | rx_start(info); | 2825 | rx_start(info); |
2832 | 2826 | ||
2833 | spin_unlock_irqrestore(&info->lock,flags); | 2827 | spin_unlock_irqrestore(&info->lock,flags); |
@@ -2840,14 +2834,14 @@ static void change_params(SLMP_INFO *info) | |||
2840 | unsigned cflag; | 2834 | unsigned cflag; |
2841 | int bits_per_char; | 2835 | int bits_per_char; |
2842 | 2836 | ||
2843 | if (!info->tty || !info->tty->termios) | 2837 | if (!info->port.tty || !info->port.tty->termios) |
2844 | return; | 2838 | return; |
2845 | 2839 | ||
2846 | if (debug_level >= DEBUG_LEVEL_INFO) | 2840 | if (debug_level >= DEBUG_LEVEL_INFO) |
2847 | printk("%s(%d):%s change_params()\n", | 2841 | printk("%s(%d):%s change_params()\n", |
2848 | __FILE__,__LINE__, info->device_name ); | 2842 | __FILE__,__LINE__, info->device_name ); |
2849 | 2843 | ||
2850 | cflag = info->tty->termios->c_cflag; | 2844 | cflag = info->port.tty->termios->c_cflag; |
2851 | 2845 | ||
2852 | /* if B0 rate (hangup) specified then negate DTR and RTS */ | 2846 | /* if B0 rate (hangup) specified then negate DTR and RTS */ |
2853 | /* otherwise assert DTR and RTS */ | 2847 | /* otherwise assert DTR and RTS */ |
@@ -2895,7 +2889,7 @@ static void change_params(SLMP_INFO *info) | |||
2895 | * current data rate. | 2889 | * current data rate. |
2896 | */ | 2890 | */ |
2897 | if (info->params.data_rate <= 460800) { | 2891 | if (info->params.data_rate <= 460800) { |
2898 | info->params.data_rate = tty_get_baud_rate(info->tty); | 2892 | info->params.data_rate = tty_get_baud_rate(info->port.tty); |
2899 | } | 2893 | } |
2900 | 2894 | ||
2901 | if ( info->params.data_rate ) { | 2895 | if ( info->params.data_rate ) { |
@@ -2905,30 +2899,30 @@ static void change_params(SLMP_INFO *info) | |||
2905 | info->timeout += HZ/50; /* Add .02 seconds of slop */ | 2899 | info->timeout += HZ/50; /* Add .02 seconds of slop */ |
2906 | 2900 | ||
2907 | if (cflag & CRTSCTS) | 2901 | if (cflag & CRTSCTS) |
2908 | info->flags |= ASYNC_CTS_FLOW; | 2902 | info->port.flags |= ASYNC_CTS_FLOW; |
2909 | else | 2903 | else |
2910 | info->flags &= ~ASYNC_CTS_FLOW; | 2904 | info->port.flags &= ~ASYNC_CTS_FLOW; |
2911 | 2905 | ||
2912 | if (cflag & CLOCAL) | 2906 | if (cflag & CLOCAL) |
2913 | info->flags &= ~ASYNC_CHECK_CD; | 2907 | info->port.flags &= ~ASYNC_CHECK_CD; |
2914 | else | 2908 | else |
2915 | info->flags |= ASYNC_CHECK_CD; | 2909 | info->port.flags |= ASYNC_CHECK_CD; |
2916 | 2910 | ||
2917 | /* process tty input control flags */ | 2911 | /* process tty input control flags */ |
2918 | 2912 | ||
2919 | info->read_status_mask2 = OVRN; | 2913 | info->read_status_mask2 = OVRN; |
2920 | if (I_INPCK(info->tty)) | 2914 | if (I_INPCK(info->port.tty)) |
2921 | info->read_status_mask2 |= PE | FRME; | 2915 | info->read_status_mask2 |= PE | FRME; |
2922 | if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) | 2916 | if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) |
2923 | info->read_status_mask1 |= BRKD; | 2917 | info->read_status_mask1 |= BRKD; |
2924 | if (I_IGNPAR(info->tty)) | 2918 | if (I_IGNPAR(info->port.tty)) |
2925 | info->ignore_status_mask2 |= PE | FRME; | 2919 | info->ignore_status_mask2 |= PE | FRME; |
2926 | if (I_IGNBRK(info->tty)) { | 2920 | if (I_IGNBRK(info->port.tty)) { |
2927 | info->ignore_status_mask1 |= BRKD; | 2921 | info->ignore_status_mask1 |= BRKD; |
2928 | /* If ignoring parity and break indicators, ignore | 2922 | /* If ignoring parity and break indicators, ignore |
2929 | * overruns too. (For real raw support). | 2923 | * overruns too. (For real raw support). |
2930 | */ | 2924 | */ |
2931 | if (I_IGNPAR(info->tty)) | 2925 | if (I_IGNPAR(info->port.tty)) |
2932 | info->ignore_status_mask2 |= OVRN; | 2926 | info->ignore_status_mask2 |= OVRN; |
2933 | } | 2927 | } |
2934 | 2928 | ||
@@ -3348,7 +3342,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3348 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ | 3342 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ |
3349 | /* nonblock mode is set or port is not enabled */ | 3343 | /* nonblock mode is set or port is not enabled */ |
3350 | /* just verify that callout device is not active */ | 3344 | /* just verify that callout device is not active */ |
3351 | info->flags |= ASYNC_NORMAL_ACTIVE; | 3345 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
3352 | return 0; | 3346 | return 0; |
3353 | } | 3347 | } |
3354 | 3348 | ||
@@ -3357,25 +3351,25 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3357 | 3351 | ||
3358 | /* Wait for carrier detect and the line to become | 3352 | /* Wait for carrier detect and the line to become |
3359 | * free (i.e., not in use by the callout). While we are in | 3353 | * free (i.e., not in use by the callout). While we are in |
3360 | * this loop, info->count is dropped by one, so that | 3354 | * this loop, info->port.count is dropped by one, so that |
3361 | * close() knows when to free things. We restore it upon | 3355 | * close() knows when to free things. We restore it upon |
3362 | * exit, either normal or abnormal. | 3356 | * exit, either normal or abnormal. |
3363 | */ | 3357 | */ |
3364 | 3358 | ||
3365 | retval = 0; | 3359 | retval = 0; |
3366 | add_wait_queue(&info->open_wait, &wait); | 3360 | add_wait_queue(&info->port.open_wait, &wait); |
3367 | 3361 | ||
3368 | if (debug_level >= DEBUG_LEVEL_INFO) | 3362 | if (debug_level >= DEBUG_LEVEL_INFO) |
3369 | printk("%s(%d):%s block_til_ready() before block, count=%d\n", | 3363 | printk("%s(%d):%s block_til_ready() before block, count=%d\n", |
3370 | __FILE__,__LINE__, tty->driver->name, info->count ); | 3364 | __FILE__,__LINE__, tty->driver->name, info->port.count ); |
3371 | 3365 | ||
3372 | spin_lock_irqsave(&info->lock, flags); | 3366 | spin_lock_irqsave(&info->lock, flags); |
3373 | if (!tty_hung_up_p(filp)) { | 3367 | if (!tty_hung_up_p(filp)) { |
3374 | extra_count = true; | 3368 | extra_count = true; |
3375 | info->count--; | 3369 | info->port.count--; |
3376 | } | 3370 | } |
3377 | spin_unlock_irqrestore(&info->lock, flags); | 3371 | spin_unlock_irqrestore(&info->lock, flags); |
3378 | info->blocked_open++; | 3372 | info->port.blocked_open++; |
3379 | 3373 | ||
3380 | while (1) { | 3374 | while (1) { |
3381 | if ((tty->termios->c_cflag & CBAUD)) { | 3375 | if ((tty->termios->c_cflag & CBAUD)) { |
@@ -3387,8 +3381,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3387 | 3381 | ||
3388 | set_current_state(TASK_INTERRUPTIBLE); | 3382 | set_current_state(TASK_INTERRUPTIBLE); |
3389 | 3383 | ||
3390 | if (tty_hung_up_p(filp) || !(info->flags & ASYNC_INITIALIZED)){ | 3384 | if (tty_hung_up_p(filp) || !(info->port.flags & ASYNC_INITIALIZED)){ |
3391 | retval = (info->flags & ASYNC_HUP_NOTIFY) ? | 3385 | retval = (info->port.flags & ASYNC_HUP_NOTIFY) ? |
3392 | -EAGAIN : -ERESTARTSYS; | 3386 | -EAGAIN : -ERESTARTSYS; |
3393 | break; | 3387 | break; |
3394 | } | 3388 | } |
@@ -3397,7 +3391,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3397 | get_signals(info); | 3391 | get_signals(info); |
3398 | spin_unlock_irqrestore(&info->lock,flags); | 3392 | spin_unlock_irqrestore(&info->lock,flags); |
3399 | 3393 | ||
3400 | if (!(info->flags & ASYNC_CLOSING) && | 3394 | if (!(info->port.flags & ASYNC_CLOSING) && |
3401 | (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) { | 3395 | (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) { |
3402 | break; | 3396 | break; |
3403 | } | 3397 | } |
@@ -3409,24 +3403,24 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3409 | 3403 | ||
3410 | if (debug_level >= DEBUG_LEVEL_INFO) | 3404 | if (debug_level >= DEBUG_LEVEL_INFO) |
3411 | printk("%s(%d):%s block_til_ready() count=%d\n", | 3405 | printk("%s(%d):%s block_til_ready() count=%d\n", |
3412 | __FILE__,__LINE__, tty->driver->name, info->count ); | 3406 | __FILE__,__LINE__, tty->driver->name, info->port.count ); |
3413 | 3407 | ||
3414 | schedule(); | 3408 | schedule(); |
3415 | } | 3409 | } |
3416 | 3410 | ||
3417 | set_current_state(TASK_RUNNING); | 3411 | set_current_state(TASK_RUNNING); |
3418 | remove_wait_queue(&info->open_wait, &wait); | 3412 | remove_wait_queue(&info->port.open_wait, &wait); |
3419 | 3413 | ||
3420 | if (extra_count) | 3414 | if (extra_count) |
3421 | info->count++; | 3415 | info->port.count++; |
3422 | info->blocked_open--; | 3416 | info->port.blocked_open--; |
3423 | 3417 | ||
3424 | if (debug_level >= DEBUG_LEVEL_INFO) | 3418 | if (debug_level >= DEBUG_LEVEL_INFO) |
3425 | printk("%s(%d):%s block_til_ready() after, count=%d\n", | 3419 | printk("%s(%d):%s block_til_ready() after, count=%d\n", |
3426 | __FILE__,__LINE__, tty->driver->name, info->count ); | 3420 | __FILE__,__LINE__, tty->driver->name, info->port.count ); |
3427 | 3421 | ||
3428 | if (!retval) | 3422 | if (!retval) |
3429 | info->flags |= ASYNC_NORMAL_ACTIVE; | 3423 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
3430 | 3424 | ||
3431 | return retval; | 3425 | return retval; |
3432 | } | 3426 | } |
@@ -3813,8 +3807,7 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev) | |||
3813 | info->max_frame_size = 4096; | 3807 | info->max_frame_size = 4096; |
3814 | info->close_delay = 5*HZ/10; | 3808 | info->close_delay = 5*HZ/10; |
3815 | info->closing_wait = 30*HZ; | 3809 | info->closing_wait = 30*HZ; |
3816 | init_waitqueue_head(&info->open_wait); | 3810 | tty_port_init(&info->port); |
3817 | init_waitqueue_head(&info->close_wait); | ||
3818 | init_waitqueue_head(&info->status_event_wait_q); | 3811 | init_waitqueue_head(&info->status_event_wait_q); |
3819 | init_waitqueue_head(&info->event_wait_q); | 3812 | init_waitqueue_head(&info->event_wait_q); |
3820 | spin_lock_init(&info->netlock); | 3813 | spin_lock_init(&info->netlock); |
@@ -4885,7 +4878,7 @@ static bool rx_get_frame(SLMP_INFO *info) | |||
4885 | unsigned int framesize = 0; | 4878 | unsigned int framesize = 0; |
4886 | bool ReturnCode = false; | 4879 | bool ReturnCode = false; |
4887 | unsigned long flags; | 4880 | unsigned long flags; |
4888 | struct tty_struct *tty = info->tty; | 4881 | struct tty_struct *tty = info->port.tty; |
4889 | unsigned char addr_field = 0xff; | 4882 | unsigned char addr_field = 0xff; |
4890 | SCADESC *desc; | 4883 | SCADESC *desc; |
4891 | SCADESC_EX *desc_ex; | 4884 | SCADESC_EX *desc_ex; |
@@ -5293,11 +5286,11 @@ static bool loopback_test(SLMP_INFO *info) | |||
5293 | bool rc = false; | 5286 | bool rc = false; |
5294 | unsigned long flags; | 5287 | unsigned long flags; |
5295 | 5288 | ||
5296 | struct tty_struct *oldtty = info->tty; | 5289 | struct tty_struct *oldtty = info->port.tty; |
5297 | u32 speed = info->params.clock_speed; | 5290 | u32 speed = info->params.clock_speed; |
5298 | 5291 | ||
5299 | info->params.clock_speed = 3686400; | 5292 | info->params.clock_speed = 3686400; |
5300 | info->tty = NULL; | 5293 | info->port.tty = NULL; |
5301 | 5294 | ||
5302 | /* assume failure */ | 5295 | /* assume failure */ |
5303 | info->init_error = DiagStatus_DmaFailure; | 5296 | info->init_error = DiagStatus_DmaFailure; |
@@ -5341,7 +5334,7 @@ static bool loopback_test(SLMP_INFO *info) | |||
5341 | spin_unlock_irqrestore(&info->lock,flags); | 5334 | spin_unlock_irqrestore(&info->lock,flags); |
5342 | 5335 | ||
5343 | info->params.clock_speed = speed; | 5336 | info->params.clock_speed = speed; |
5344 | info->tty = oldtty; | 5337 | info->port.tty = oldtty; |
5345 | 5338 | ||
5346 | return rc; | 5339 | return rc; |
5347 | } | 5340 | } |