diff options
Diffstat (limited to 'drivers/tty/nozomi.c')
-rw-r--r-- | drivers/tty/nozomi.c | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c index a0c69ab04399..2dff19796157 100644 --- a/drivers/tty/nozomi.c +++ b/drivers/tty/nozomi.c | |||
@@ -827,15 +827,10 @@ static int receive_data(enum port_type index, struct nozomi *dc) | |||
827 | struct tty_struct *tty = tty_port_tty_get(&port->port); | 827 | struct tty_struct *tty = tty_port_tty_get(&port->port); |
828 | int i, ret; | 828 | int i, ret; |
829 | 829 | ||
830 | if (unlikely(!tty)) { | ||
831 | DBG1("tty not open for port: %d?", index); | ||
832 | return 1; | ||
833 | } | ||
834 | |||
835 | read_mem32((u32 *) &size, addr, 4); | 830 | read_mem32((u32 *) &size, addr, 4); |
836 | /* DBG1( "%d bytes port: %d", size, index); */ | 831 | /* DBG1( "%d bytes port: %d", size, index); */ |
837 | 832 | ||
838 | if (test_bit(TTY_THROTTLED, &tty->flags)) { | 833 | if (tty && test_bit(TTY_THROTTLED, &tty->flags)) { |
839 | DBG1("No room in tty, don't read data, don't ack interrupt, " | 834 | DBG1("No room in tty, don't read data, don't ack interrupt, " |
840 | "disable interrupt"); | 835 | "disable interrupt"); |
841 | 836 | ||
@@ -855,13 +850,14 @@ static int receive_data(enum port_type index, struct nozomi *dc) | |||
855 | read_mem32((u32 *) buf, addr + offset, RECEIVE_BUF_MAX); | 850 | read_mem32((u32 *) buf, addr + offset, RECEIVE_BUF_MAX); |
856 | 851 | ||
857 | if (size == 1) { | 852 | if (size == 1) { |
858 | tty_insert_flip_char(tty, buf[0], TTY_NORMAL); | 853 | tty_insert_flip_char(&port->port, buf[0], TTY_NORMAL); |
859 | size = 0; | 854 | size = 0; |
860 | } else if (size < RECEIVE_BUF_MAX) { | 855 | } else if (size < RECEIVE_BUF_MAX) { |
861 | size -= tty_insert_flip_string(tty, (char *) buf, size); | 856 | size -= tty_insert_flip_string(&port->port, |
857 | (char *)buf, size); | ||
862 | } else { | 858 | } else { |
863 | i = tty_insert_flip_string(tty, \ | 859 | i = tty_insert_flip_string(&port->port, |
864 | (char *) buf, RECEIVE_BUF_MAX); | 860 | (char *)buf, RECEIVE_BUF_MAX); |
865 | size -= i; | 861 | size -= i; |
866 | offset += i; | 862 | offset += i; |
867 | } | 863 | } |
@@ -1276,15 +1272,11 @@ static irqreturn_t interrupt_handler(int irq, void *dev_id) | |||
1276 | 1272 | ||
1277 | exit_handler: | 1273 | exit_handler: |
1278 | spin_unlock(&dc->spin_mutex); | 1274 | spin_unlock(&dc->spin_mutex); |
1279 | for (a = 0; a < NOZOMI_MAX_PORTS; a++) { | 1275 | |
1280 | struct tty_struct *tty; | 1276 | for (a = 0; a < NOZOMI_MAX_PORTS; a++) |
1281 | if (test_and_clear_bit(a, &dc->flip)) { | 1277 | if (test_and_clear_bit(a, &dc->flip)) |
1282 | tty = tty_port_tty_get(&dc->port[a].port); | 1278 | tty_flip_buffer_push(&dc->port[a].port); |
1283 | if (tty) | 1279 | |
1284 | tty_flip_buffer_push(tty); | ||
1285 | tty_kref_put(tty); | ||
1286 | } | ||
1287 | } | ||
1288 | return IRQ_HANDLED; | 1280 | return IRQ_HANDLED; |
1289 | none: | 1281 | none: |
1290 | spin_unlock(&dc->spin_mutex); | 1282 | spin_unlock(&dc->spin_mutex); |
@@ -1687,12 +1679,6 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer, | |||
1687 | 1679 | ||
1688 | rval = kfifo_in(&port->fifo_ul, (unsigned char *)buffer, count); | 1680 | rval = kfifo_in(&port->fifo_ul, (unsigned char *)buffer, count); |
1689 | 1681 | ||
1690 | /* notify card */ | ||
1691 | if (unlikely(dc == NULL)) { | ||
1692 | DBG1("No device context?"); | ||
1693 | goto exit; | ||
1694 | } | ||
1695 | |||
1696 | spin_lock_irqsave(&dc->spin_mutex, flags); | 1682 | spin_lock_irqsave(&dc->spin_mutex, flags); |
1697 | /* CTS is only valid on the modem channel */ | 1683 | /* CTS is only valid on the modem channel */ |
1698 | if (port == &(dc->port[PORT_MDM])) { | 1684 | if (port == &(dc->port[PORT_MDM])) { |
@@ -1708,7 +1694,6 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer, | |||
1708 | } | 1694 | } |
1709 | spin_unlock_irqrestore(&dc->spin_mutex, flags); | 1695 | spin_unlock_irqrestore(&dc->spin_mutex, flags); |
1710 | 1696 | ||
1711 | exit: | ||
1712 | return rval; | 1697 | return rval; |
1713 | } | 1698 | } |
1714 | 1699 | ||