aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/mxser.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/mxser.c')
-rw-r--r--drivers/char/mxser.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 95c9f54f3d30..d2692d443f7b 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -1011,6 +1011,7 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
1011 if (!info->ioaddr) 1011 if (!info->ioaddr)
1012 return -ENODEV; 1012 return -ENODEV;
1013 1013
1014 tty->driver_data = info;
1014 return tty_port_open(&info->port, tty, filp); 1015 return tty_port_open(&info->port, tty, filp);
1015} 1016}
1016 1017
@@ -1074,7 +1075,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1074 struct mxser_port *info = tty->driver_data; 1075 struct mxser_port *info = tty->driver_data;
1075 struct tty_port *port = &info->port; 1076 struct tty_port *port = &info->port;
1076 1077
1077 if (tty->index == MXSER_PORTS) 1078 if (tty->index == MXSER_PORTS || info == NULL)
1078 return; 1079 return;
1079 if (tty_port_close_start(port, tty, filp) == 0) 1080 if (tty_port_close_start(port, tty, filp) == 0)
1080 return; 1081 return;
@@ -1768,7 +1769,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
1768 int len, lsr; 1769 int len, lsr;
1769 1770
1770 len = mxser_chars_in_buffer(tty); 1771 len = mxser_chars_in_buffer(tty);
1771 spin_lock(&info->slock); 1772 spin_lock_irq(&info->slock);
1772 lsr = inb(info->ioaddr + UART_LSR) & UART_LSR_THRE; 1773 lsr = inb(info->ioaddr + UART_LSR) & UART_LSR_THRE;
1773 spin_unlock_irq(&info->slock); 1774 spin_unlock_irq(&info->slock);
1774 len += (lsr ? 0 : 1); 1775 len += (lsr ? 0 : 1);
@@ -1778,12 +1779,12 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
1778 case MOXA_ASPP_MON: { 1779 case MOXA_ASPP_MON: {
1779 int mcr, status; 1780 int mcr, status;
1780 1781
1781 spin_lock(&info->slock); 1782 spin_lock_irq(&info->slock);
1782 status = mxser_get_msr(info->ioaddr, 1, tty->index); 1783 status = mxser_get_msr(info->ioaddr, 1, tty->index);
1783 mxser_check_modem_status(tty, info, status); 1784 mxser_check_modem_status(tty, info, status);
1784 1785
1785 mcr = inb(info->ioaddr + UART_MCR); 1786 mcr = inb(info->ioaddr + UART_MCR);
1786 spin_unlock(&info->slock); 1787 spin_unlock_irq(&info->slock);
1787 1788
1788 if (mcr & MOXA_MUST_MCR_XON_FLAG) 1789 if (mcr & MOXA_MUST_MCR_XON_FLAG)
1789 info->mon_data.hold_reason &= ~NPPI_NOTIFY_XOFFHOLD; 1790 info->mon_data.hold_reason &= ~NPPI_NOTIFY_XOFFHOLD;