aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/nozomi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/nozomi.c')
-rw-r--r--drivers/tty/nozomi.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index fd0a98524d51..b1aecc7bb32a 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -364,8 +364,6 @@ struct port {
364 u8 toggle_ul; 364 u8 toggle_ul;
365 u16 token_dl; 365 u16 token_dl;
366 366
367 /* mutex to ensure one access patch to this port */
368 struct mutex tty_sem;
369 wait_queue_head_t tty_wait; 367 wait_queue_head_t tty_wait;
370 struct async_icount tty_icount; 368 struct async_icount tty_icount;
371 369
@@ -1431,8 +1429,8 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,
1431 } 1429 }
1432 1430
1433 for (i = PORT_MDM; i < MAX_PORT; i++) { 1431 for (i = PORT_MDM; i < MAX_PORT; i++) {
1434 if (kfifo_alloc(&dc->port[i].fifo_ul, 1432 if (kfifo_alloc(&dc->port[i].fifo_ul, FIFO_BUFFER_SIZE_UL,
1435 FIFO_BUFFER_SIZE_UL, GFP_ATOMIC)) { 1433 GFP_KERNEL)) {
1436 dev_err(&pdev->dev, 1434 dev_err(&pdev->dev,
1437 "Could not allocate kfifo buffer\n"); 1435 "Could not allocate kfifo buffer\n");
1438 ret = -ENOMEM; 1436 ret = -ENOMEM;
@@ -1474,7 +1472,6 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,
1474 struct device *tty_dev; 1472 struct device *tty_dev;
1475 struct port *port = &dc->port[i]; 1473 struct port *port = &dc->port[i];
1476 port->dc = dc; 1474 port->dc = dc;
1477 mutex_init(&port->tty_sem);
1478 tty_port_init(&port->port); 1475 tty_port_init(&port->port);
1479 port->port.ops = &noz_tty_port_ops; 1476 port->port.ops = &noz_tty_port_ops;
1480 tty_dev = tty_register_device(ntty_driver, dc->index_start + i, 1477 tty_dev = tty_register_device(ntty_driver, dc->index_start + i,
@@ -1688,13 +1685,6 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,
1688 if (!dc || !port) 1685 if (!dc || !port)
1689 return -ENODEV; 1686 return -ENODEV;
1690 1687
1691 mutex_lock(&port->tty_sem);
1692
1693 if (unlikely(!port->port.count)) {
1694 DBG1(" ");
1695 goto exit;
1696 }
1697
1698 rval = kfifo_in(&port->fifo_ul, (unsigned char *)buffer, count); 1688 rval = kfifo_in(&port->fifo_ul, (unsigned char *)buffer, count);
1699 1689
1700 /* notify card */ 1690 /* notify card */
@@ -1719,7 +1709,6 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,
1719 spin_unlock_irqrestore(&dc->spin_mutex, flags); 1709 spin_unlock_irqrestore(&dc->spin_mutex, flags);
1720 1710
1721exit: 1711exit:
1722 mutex_unlock(&port->tty_sem);
1723 return rval; 1712 return rval;
1724} 1713}
1725 1714
@@ -1738,12 +1727,9 @@ static int ntty_write_room(struct tty_struct *tty)
1738 int room = 4096; 1727 int room = 4096;
1739 const struct nozomi *dc = get_dc_by_tty(tty); 1728 const struct nozomi *dc = get_dc_by_tty(tty);
1740 1729
1741 if (dc) { 1730 if (dc)
1742 mutex_lock(&port->tty_sem); 1731 room = kfifo_avail(&port->fifo_ul);
1743 if (port->port.count) 1732
1744 room = kfifo_avail(&port->fifo_ul);
1745 mutex_unlock(&port->tty_sem);
1746 }
1747 return room; 1733 return room;
1748} 1734}
1749 1735
@@ -1889,11 +1875,6 @@ static s32 ntty_chars_in_buffer(struct tty_struct *tty)
1889 goto exit_in_buffer; 1875 goto exit_in_buffer;
1890 } 1876 }
1891 1877
1892 if (unlikely(!port->port.count)) {
1893 dev_err(&dc->pdev->dev, "No tty open?\n");
1894 goto exit_in_buffer;
1895 }
1896
1897 rval = kfifo_len(&port->fifo_ul); 1878 rval = kfifo_len(&port->fifo_ul);
1898 1879
1899exit_in_buffer: 1880exit_in_buffer: