diff options
Diffstat (limited to 'drivers/tty/moxa.c')
-rw-r--r-- | drivers/tty/moxa.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c index 35b0c38590e..ba679ce0a77 100644 --- a/drivers/tty/moxa.c +++ b/drivers/tty/moxa.c | |||
@@ -371,7 +371,7 @@ static int moxa_ioctl(struct tty_struct *tty, | |||
371 | tmp.cflag = p->cflag; | 371 | tmp.cflag = p->cflag; |
372 | else | 372 | else |
373 | tmp.cflag = ttyp->termios->c_cflag; | 373 | tmp.cflag = ttyp->termios->c_cflag; |
374 | tty_kref_put(tty); | 374 | tty_kref_put(ttyp); |
375 | copy: | 375 | copy: |
376 | if (copy_to_user(argm, &tmp, sizeof(tmp))) | 376 | if (copy_to_user(argm, &tmp, sizeof(tmp))) |
377 | return -EFAULT; | 377 | return -EFAULT; |
@@ -1129,7 +1129,6 @@ static void moxa_shutdown(struct tty_port *port) | |||
1129 | struct moxa_port *ch = container_of(port, struct moxa_port, port); | 1129 | struct moxa_port *ch = container_of(port, struct moxa_port, port); |
1130 | MoxaPortDisable(ch); | 1130 | MoxaPortDisable(ch); |
1131 | MoxaPortFlushData(ch, 2); | 1131 | MoxaPortFlushData(ch, 2); |
1132 | clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); | ||
1133 | } | 1132 | } |
1134 | 1133 | ||
1135 | static int moxa_carrier_raised(struct tty_port *port) | 1134 | static int moxa_carrier_raised(struct tty_port *port) |
@@ -1155,7 +1154,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp) | |||
1155 | struct moxa_board_conf *brd; | 1154 | struct moxa_board_conf *brd; |
1156 | struct moxa_port *ch; | 1155 | struct moxa_port *ch; |
1157 | int port; | 1156 | int port; |
1158 | int retval; | ||
1159 | 1157 | ||
1160 | port = tty->index; | 1158 | port = tty->index; |
1161 | if (port == MAX_PORTS) { | 1159 | if (port == MAX_PORTS) { |
@@ -1190,10 +1188,7 @@ static int moxa_open(struct tty_struct *tty, struct file *filp) | |||
1190 | mutex_unlock(&ch->port.mutex); | 1188 | mutex_unlock(&ch->port.mutex); |
1191 | mutex_unlock(&moxa_openlock); | 1189 | mutex_unlock(&moxa_openlock); |
1192 | 1190 | ||
1193 | retval = tty_port_block_til_ready(&ch->port, tty, filp); | 1191 | return tty_port_block_til_ready(&ch->port, tty, filp); |
1194 | if (retval == 0) | ||
1195 | set_bit(ASYNCB_NORMAL_ACTIVE, &ch->port.flags); | ||
1196 | return retval; | ||
1197 | } | 1192 | } |
1198 | 1193 | ||
1199 | static void moxa_close(struct tty_struct *tty, struct file *filp) | 1194 | static void moxa_close(struct tty_struct *tty, struct file *filp) |
@@ -1207,14 +1202,15 @@ static int moxa_write(struct tty_struct *tty, | |||
1207 | const unsigned char *buf, int count) | 1202 | const unsigned char *buf, int count) |
1208 | { | 1203 | { |
1209 | struct moxa_port *ch = tty->driver_data; | 1204 | struct moxa_port *ch = tty->driver_data; |
1205 | unsigned long flags; | ||
1210 | int len; | 1206 | int len; |
1211 | 1207 | ||
1212 | if (ch == NULL) | 1208 | if (ch == NULL) |
1213 | return 0; | 1209 | return 0; |
1214 | 1210 | ||
1215 | spin_lock_bh(&moxa_lock); | 1211 | spin_lock_irqsave(&moxa_lock, flags); |
1216 | len = MoxaPortWriteData(tty, buf, count); | 1212 | len = MoxaPortWriteData(tty, buf, count); |
1217 | spin_unlock_bh(&moxa_lock); | 1213 | spin_unlock_irqrestore(&moxa_lock, flags); |
1218 | 1214 | ||
1219 | set_bit(LOWWAIT, &ch->statusflags); | 1215 | set_bit(LOWWAIT, &ch->statusflags); |
1220 | return len; | 1216 | return len; |
@@ -1281,10 +1277,8 @@ static int moxa_tiocmset(struct tty_struct *tty, | |||
1281 | unsigned int set, unsigned int clear) | 1277 | unsigned int set, unsigned int clear) |
1282 | { | 1278 | { |
1283 | struct moxa_port *ch; | 1279 | struct moxa_port *ch; |
1284 | int port; | ||
1285 | int dtr, rts; | 1280 | int dtr, rts; |
1286 | 1281 | ||
1287 | port = tty->index; | ||
1288 | mutex_lock(&moxa_openlock); | 1282 | mutex_lock(&moxa_openlock); |
1289 | ch = tty->driver_data; | 1283 | ch = tty->driver_data; |
1290 | if (!ch) { | 1284 | if (!ch) { |
@@ -1756,11 +1750,9 @@ static int MoxaPortSetTermio(struct moxa_port *port, struct ktermios *termio, | |||
1756 | speed_t baud) | 1750 | speed_t baud) |
1757 | { | 1751 | { |
1758 | void __iomem *ofsAddr; | 1752 | void __iomem *ofsAddr; |
1759 | tcflag_t cflag; | ||
1760 | tcflag_t mode = 0; | 1753 | tcflag_t mode = 0; |
1761 | 1754 | ||
1762 | ofsAddr = port->tableAddr; | 1755 | ofsAddr = port->tableAddr; |
1763 | cflag = termio->c_cflag; /* termio->c_cflag */ | ||
1764 | 1756 | ||
1765 | mode = termio->c_cflag & CSIZE; | 1757 | mode = termio->c_cflag & CSIZE; |
1766 | if (mode == CS5) | 1758 | if (mode == CS5) |