diff options
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/cyclades.c | 10 | ||||
-rw-r--r-- | drivers/tty/moxa.c | 19 | ||||
-rw-r--r-- | drivers/tty/n_gsm.c | 6 | ||||
-rw-r--r-- | drivers/tty/nozomi.c | 9 | ||||
-rw-r--r-- | drivers/tty/rocket.c | 7 | ||||
-rw-r--r-- | drivers/tty/serial/ifx6x60.c | 21 | ||||
-rw-r--r-- | drivers/tty/tty_port.c | 17 |
7 files changed, 32 insertions, 57 deletions
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c index 345bd0e0884e..33f83fee9fae 100644 --- a/drivers/tty/cyclades.c +++ b/drivers/tty/cyclades.c | |||
@@ -1124,14 +1124,8 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo) | |||
1124 | readl(&info->u.cyz.ch_ctrl->rs_status); | 1124 | readl(&info->u.cyz.ch_ctrl->rs_status); |
1125 | if (dcd & C_RS_DCD) | 1125 | if (dcd & C_RS_DCD) |
1126 | wake_up_interruptible(&info->port.open_wait); | 1126 | wake_up_interruptible(&info->port.open_wait); |
1127 | else { | 1127 | else |
1128 | struct tty_struct *tty; | 1128 | tty_port_tty_hangup(&info->port, false); |
1129 | tty = tty_port_tty_get(&info->port); | ||
1130 | if (tty) { | ||
1131 | tty_hangup(tty); | ||
1132 | tty_kref_put(tty); | ||
1133 | } | ||
1134 | } | ||
1135 | } | 1129 | } |
1136 | break; | 1130 | break; |
1137 | case C_CM_MCTS: | 1131 | case C_CM_MCTS: |
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c index adeac255e526..1deaca4674e4 100644 --- a/drivers/tty/moxa.c +++ b/drivers/tty/moxa.c | |||
@@ -913,16 +913,12 @@ static void moxa_board_deinit(struct moxa_board_conf *brd) | |||
913 | 913 | ||
914 | /* pci hot-un-plug support */ | 914 | /* pci hot-un-plug support */ |
915 | for (a = 0; a < brd->numPorts; a++) | 915 | for (a = 0; a < brd->numPorts; a++) |
916 | if (brd->ports[a].port.flags & ASYNC_INITIALIZED) { | 916 | if (brd->ports[a].port.flags & ASYNC_INITIALIZED) |
917 | struct tty_struct *tty = tty_port_tty_get( | 917 | tty_port_tty_hangup(&brd->ports[a].port, false); |
918 | &brd->ports[a].port); | 918 | |
919 | if (tty) { | ||
920 | tty_hangup(tty); | ||
921 | tty_kref_put(tty); | ||
922 | } | ||
923 | } | ||
924 | for (a = 0; a < MAX_PORTS_PER_BOARD; a++) | 919 | for (a = 0; a < MAX_PORTS_PER_BOARD; a++) |
925 | tty_port_destroy(&brd->ports[a].port); | 920 | tty_port_destroy(&brd->ports[a].port); |
921 | |||
926 | while (1) { | 922 | while (1) { |
927 | opened = 0; | 923 | opened = 0; |
928 | for (a = 0; a < brd->numPorts; a++) | 924 | for (a = 0; a < brd->numPorts; a++) |
@@ -1365,7 +1361,6 @@ static void moxa_hangup(struct tty_struct *tty) | |||
1365 | 1361 | ||
1366 | static void moxa_new_dcdstate(struct moxa_port *p, u8 dcd) | 1362 | static void moxa_new_dcdstate(struct moxa_port *p, u8 dcd) |
1367 | { | 1363 | { |
1368 | struct tty_struct *tty; | ||
1369 | unsigned long flags; | 1364 | unsigned long flags; |
1370 | dcd = !!dcd; | 1365 | dcd = !!dcd; |
1371 | 1366 | ||
@@ -1373,10 +1368,8 @@ static void moxa_new_dcdstate(struct moxa_port *p, u8 dcd) | |||
1373 | if (dcd != p->DCDState) { | 1368 | if (dcd != p->DCDState) { |
1374 | p->DCDState = dcd; | 1369 | p->DCDState = dcd; |
1375 | spin_unlock_irqrestore(&p->port.lock, flags); | 1370 | spin_unlock_irqrestore(&p->port.lock, flags); |
1376 | tty = tty_port_tty_get(&p->port); | 1371 | if (!dcd) |
1377 | if (tty && !C_CLOCAL(tty) && !dcd) | 1372 | tty_port_tty_hangup(&p->port, true); |
1378 | tty_hangup(tty); | ||
1379 | tty_kref_put(tty); | ||
1380 | } | 1373 | } |
1381 | else | 1374 | else |
1382 | spin_unlock_irqrestore(&p->port.lock, flags); | 1375 | spin_unlock_irqrestore(&p->port.lock, flags); |
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 4a43ef5d7962..74d9a0258d7c 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
@@ -1418,11 +1418,7 @@ static void gsm_dlci_close(struct gsm_dlci *dlci) | |||
1418 | pr_debug("DLCI %d goes closed.\n", dlci->addr); | 1418 | pr_debug("DLCI %d goes closed.\n", dlci->addr); |
1419 | dlci->state = DLCI_CLOSED; | 1419 | dlci->state = DLCI_CLOSED; |
1420 | if (dlci->addr != 0) { | 1420 | if (dlci->addr != 0) { |
1421 | struct tty_struct *tty = tty_port_tty_get(&dlci->port); | 1421 | tty_port_tty_hangup(&dlci->port, false); |
1422 | if (tty) { | ||
1423 | tty_hangup(tty); | ||
1424 | tty_kref_put(tty); | ||
1425 | } | ||
1426 | kfifo_reset(dlci->fifo); | 1422 | kfifo_reset(dlci->fifo); |
1427 | } else | 1423 | } else |
1428 | dlci->gsm->dead = 1; | 1424 | dlci->gsm->dead = 1; |
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c index 2e5bbdc09e1c..d6080c3831ef 100644 --- a/drivers/tty/nozomi.c +++ b/drivers/tty/nozomi.c | |||
@@ -1501,12 +1501,9 @@ static void tty_exit(struct nozomi *dc) | |||
1501 | 1501 | ||
1502 | DBG1(" "); | 1502 | DBG1(" "); |
1503 | 1503 | ||
1504 | for (i = 0; i < MAX_PORT; ++i) { | 1504 | for (i = 0; i < MAX_PORT; ++i) |
1505 | struct tty_struct *tty = tty_port_tty_get(&dc->port[i].port); | 1505 | tty_port_tty_hangup(&dc->port[i].port, false); |
1506 | if (tty && list_empty(&tty->hangup_work.entry)) | 1506 | |
1507 | tty_hangup(tty); | ||
1508 | tty_kref_put(tty); | ||
1509 | } | ||
1510 | /* Racy below - surely should wait for scheduled work to be done or | 1507 | /* Racy below - surely should wait for scheduled work to be done or |
1511 | complete off a hangup method ? */ | 1508 | complete off a hangup method ? */ |
1512 | while (dc->open_ttys) | 1509 | while (dc->open_ttys) |
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c index 1d270034bfc3..bbffd7a431e9 100644 --- a/drivers/tty/rocket.c +++ b/drivers/tty/rocket.c | |||
@@ -521,15 +521,10 @@ static void rp_handle_port(struct r_port *info) | |||
521 | (ChanStatus & CD_ACT) ? "on" : "off"); | 521 | (ChanStatus & CD_ACT) ? "on" : "off"); |
522 | #endif | 522 | #endif |
523 | if (!(ChanStatus & CD_ACT) && info->cd_status) { | 523 | if (!(ChanStatus & CD_ACT) && info->cd_status) { |
524 | struct tty_struct *tty; | ||
525 | #ifdef ROCKET_DEBUG_HANGUP | 524 | #ifdef ROCKET_DEBUG_HANGUP |
526 | printk(KERN_INFO "CD drop, calling hangup.\n"); | 525 | printk(KERN_INFO "CD drop, calling hangup.\n"); |
527 | #endif | 526 | #endif |
528 | tty = tty_port_tty_get(&info->port); | 527 | tty_port_tty_hangup(&info->port, false); |
529 | if (tty) { | ||
530 | tty_hangup(tty); | ||
531 | tty_kref_put(tty); | ||
532 | } | ||
533 | } | 528 | } |
534 | info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0; | 529 | info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0; |
535 | wake_up_interruptible(&info->port.open_wait); | 530 | wake_up_interruptible(&info->port.open_wait); |
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index d723d4193b90..2c77fed31a72 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c | |||
@@ -270,23 +270,6 @@ static void mrdy_assert(struct ifx_spi_device *ifx_dev) | |||
270 | } | 270 | } |
271 | 271 | ||
272 | /** | 272 | /** |
273 | * ifx_spi_hangup - hang up an IFX device | ||
274 | * @ifx_dev: our SPI device | ||
275 | * | ||
276 | * Hang up the tty attached to the IFX device if one is currently | ||
277 | * open. If not take no action | ||
278 | */ | ||
279 | static void ifx_spi_ttyhangup(struct ifx_spi_device *ifx_dev) | ||
280 | { | ||
281 | struct tty_port *pport = &ifx_dev->tty_port; | ||
282 | struct tty_struct *tty = tty_port_tty_get(pport); | ||
283 | if (tty) { | ||
284 | tty_hangup(tty); | ||
285 | tty_kref_put(tty); | ||
286 | } | ||
287 | } | ||
288 | |||
289 | /** | ||
290 | * ifx_spi_timeout - SPI timeout | 273 | * ifx_spi_timeout - SPI timeout |
291 | * @arg: our SPI device | 274 | * @arg: our SPI device |
292 | * | 275 | * |
@@ -298,7 +281,7 @@ static void ifx_spi_timeout(unsigned long arg) | |||
298 | struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *)arg; | 281 | struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *)arg; |
299 | 282 | ||
300 | dev_warn(&ifx_dev->spi_dev->dev, "*** SPI Timeout ***"); | 283 | dev_warn(&ifx_dev->spi_dev->dev, "*** SPI Timeout ***"); |
301 | ifx_spi_ttyhangup(ifx_dev); | 284 | tty_port_tty_hangup(&ifx_dev->tty_port, false); |
302 | mrdy_set_low(ifx_dev); | 285 | mrdy_set_low(ifx_dev); |
303 | clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); | 286 | clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); |
304 | } | 287 | } |
@@ -933,7 +916,7 @@ static irqreturn_t ifx_spi_reset_interrupt(int irq, void *dev) | |||
933 | set_bit(MR_INPROGRESS, &ifx_dev->mdm_reset_state); | 916 | set_bit(MR_INPROGRESS, &ifx_dev->mdm_reset_state); |
934 | if (!solreset) { | 917 | if (!solreset) { |
935 | /* unsolicited reset */ | 918 | /* unsolicited reset */ |
936 | ifx_spi_ttyhangup(ifx_dev); | 919 | tty_port_tty_hangup(&ifx_dev->tty_port, false); |
937 | } | 920 | } |
938 | } else { | 921 | } else { |
939 | /* exited reset */ | 922 | /* exited reset */ |
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 8bb757c62ee2..7f38eeaafac3 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c | |||
@@ -233,6 +233,23 @@ void tty_port_hangup(struct tty_port *port) | |||
233 | EXPORT_SYMBOL(tty_port_hangup); | 233 | EXPORT_SYMBOL(tty_port_hangup); |
234 | 234 | ||
235 | /** | 235 | /** |
236 | * tty_port_tty_hangup - helper to hang up a tty | ||
237 | * | ||
238 | * @port: tty port | ||
239 | * @check_clocal: hang only ttys with CLOCAL unset? | ||
240 | */ | ||
241 | void tty_port_tty_hangup(struct tty_port *port, bool check_clocal) | ||
242 | { | ||
243 | struct tty_struct *tty = tty_port_tty_get(port); | ||
244 | |||
245 | if (tty && (!check_clocal || !C_CLOCAL(tty))) { | ||
246 | tty_hangup(tty); | ||
247 | tty_kref_put(tty); | ||
248 | } | ||
249 | } | ||
250 | EXPORT_SYMBOL_GPL(tty_port_tty_hangup); | ||
251 | |||
252 | /** | ||
236 | * tty_port_tty_wakeup - helper to wake up a tty | 253 | * tty_port_tty_wakeup - helper to wake up a tty |
237 | * | 254 | * |
238 | * @port: tty port | 255 | * @port: tty port |