aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/istallion.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/istallion.c')
-rw-r--r--drivers/char/istallion.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 4b10770fa937..c4682f9e34bb 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -151,7 +151,7 @@ static char *stli_drvversion = "5.6.0";
151static char *stli_serialname = "ttyE"; 151static char *stli_serialname = "ttyE";
152 152
153static struct tty_driver *stli_serial; 153static struct tty_driver *stli_serial;
154 154static const struct tty_port_operations stli_port_ops;
155 155
156#define STLI_TXBUFSIZE 4096 156#define STLI_TXBUFSIZE 4096
157 157
@@ -1183,6 +1183,12 @@ static int stli_setport(struct tty_struct *tty)
1183 1183
1184/*****************************************************************************/ 1184/*****************************************************************************/
1185 1185
1186static int stli_carrier_raised(struct tty_port *port)
1187{
1188 struct stliport *portp = container_of(port, struct stliport, port);
1189 return (portp->sigs & TIOCM_CD) ? 1 : 0;
1190}
1191
1186/* 1192/*
1187 * Possibly need to wait for carrier (DCD signal) to come high. Say 1193 * Possibly need to wait for carrier (DCD signal) to come high. Say
1188 * maybe because if we are clocal then we don't need to wait... 1194 * maybe because if we are clocal then we don't need to wait...
@@ -1193,6 +1199,7 @@ static int stli_waitcarrier(struct tty_struct *tty, struct stlibrd *brdp,
1193{ 1199{
1194 unsigned long flags; 1200 unsigned long flags;
1195 int rc, doclocal; 1201 int rc, doclocal;
1202 struct tty_port *port = &portp->port;
1196 1203
1197 rc = 0; 1204 rc = 0;
1198 doclocal = 0; 1205 doclocal = 0;
@@ -1203,7 +1210,7 @@ static int stli_waitcarrier(struct tty_struct *tty, struct stlibrd *brdp,
1203 spin_lock_irqsave(&stli_lock, flags); 1210 spin_lock_irqsave(&stli_lock, flags);
1204 portp->openwaitcnt++; 1211 portp->openwaitcnt++;
1205 if (! tty_hung_up_p(filp)) 1212 if (! tty_hung_up_p(filp))
1206 portp->port.count--; 1213 port->count--;
1207 spin_unlock_irqrestore(&stli_lock, flags); 1214 spin_unlock_irqrestore(&stli_lock, flags);
1208 1215
1209 for (;;) { 1216 for (;;) {
@@ -1212,27 +1219,27 @@ static int stli_waitcarrier(struct tty_struct *tty, struct stlibrd *brdp,
1212 &portp->asig, sizeof(asysigs_t), 0)) < 0) 1219 &portp->asig, sizeof(asysigs_t), 0)) < 0)
1213 break; 1220 break;
1214 if (tty_hung_up_p(filp) || 1221 if (tty_hung_up_p(filp) ||
1215 ((portp->port.flags & ASYNC_INITIALIZED) == 0)) { 1222 ((port->flags & ASYNC_INITIALIZED) == 0)) {
1216 if (portp->port.flags & ASYNC_HUP_NOTIFY) 1223 if (port->flags & ASYNC_HUP_NOTIFY)
1217 rc = -EBUSY; 1224 rc = -EBUSY;
1218 else 1225 else
1219 rc = -ERESTARTSYS; 1226 rc = -ERESTARTSYS;
1220 break; 1227 break;
1221 } 1228 }
1222 if (((portp->port.flags & ASYNC_CLOSING) == 0) && 1229 if (((port->flags & ASYNC_CLOSING) == 0) &&
1223 (doclocal || (portp->sigs & TIOCM_CD))) { 1230 (doclocal || tty_port_carrier_raised(port))) {
1224 break; 1231 break;
1225 } 1232 }
1226 if (signal_pending(current)) { 1233 if (signal_pending(current)) {
1227 rc = -ERESTARTSYS; 1234 rc = -ERESTARTSYS;
1228 break; 1235 break;
1229 } 1236 }
1230 interruptible_sleep_on(&portp->port.open_wait); 1237 interruptible_sleep_on(&port->open_wait);
1231 } 1238 }
1232 1239
1233 spin_lock_irqsave(&stli_lock, flags); 1240 spin_lock_irqsave(&stli_lock, flags);
1234 if (! tty_hung_up_p(filp)) 1241 if (! tty_hung_up_p(filp))
1235 portp->port.count++; 1242 port->count++;
1236 portp->openwaitcnt--; 1243 portp->openwaitcnt--;
1237 spin_unlock_irqrestore(&stli_lock, flags); 1244 spin_unlock_irqrestore(&stli_lock, flags);
1238 1245
@@ -2696,6 +2703,7 @@ static int stli_initports(struct stlibrd *brdp)
2696 continue; 2703 continue;
2697 } 2704 }
2698 tty_port_init(&portp->port); 2705 tty_port_init(&portp->port);
2706 portp->port.ops = &stli_port_ops;
2699 portp->magic = STLI_PORTMAGIC; 2707 portp->magic = STLI_PORTMAGIC;
2700 portp->portnr = i; 2708 portp->portnr = i;
2701 portp->brdnr = brdp->brdnr; 2709 portp->brdnr = brdp->brdnr;
@@ -4518,6 +4526,10 @@ static const struct tty_operations stli_ops = {
4518 .tiocmset = stli_tiocmset, 4526 .tiocmset = stli_tiocmset,
4519}; 4527};
4520 4528
4529static const struct tty_port_operations stli_port_ops = {
4530 .carrier_raised = stli_carrier_raised,
4531};
4532
4521/*****************************************************************************/ 4533/*****************************************************************************/
4522/* 4534/*
4523 * Loadable module initialization stuff. 4535 * Loadable module initialization stuff.