aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/n_gsm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 17:08:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 17:08:47 -0500
commitc6bd5bcc4983f1a2d2f87a3769bf309482ee8c04 (patch)
tree2ff9c4496dc2258d601a1bcd82040470704dae3b /drivers/tty/n_gsm.c
parent8966961b31c251b854169e9886394c2a20f2cea7 (diff)
parentb0ab02361167faa82198b783a8d555eb6f58901c (diff)
Merge tag 'tty-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull TTY/Serial merge from Greg Kroah-Hartman: "Here's the big tty/serial tree set of changes for 3.8-rc1. Contained in here is a bunch more reworks of the tty port layer from Jiri and bugfixes from Alan, along with a number of other tty and serial driver updates by the various driver authors. Also, Jiri has been coerced^Wconvinced to be the co-maintainer of the TTY layer, which is much appreciated by me. All of these have been in the linux-next tree for a while. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" Fixed up some trivial conflicts in the staging tree, due to the fwserial driver having come in both ways (but fixed up a bit in the serial tree), and the ioctl handling in the dgrp driver having been done slightly differently (staging tree got that one right, and removed both TIOCGSOFTCAR and TIOCSSOFTCAR). * tag 'tty-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (146 commits) staging: sb105x: fix potential NULL pointer dereference in mp_chars_in_buffer() staging/fwserial: Remove superfluous free staging/fwserial: Use WARN_ONCE when port table is corrupted staging/fwserial: Destruct embedded tty_port on teardown staging/fwserial: Fix build breakage when !CONFIG_BUG staging: fwserial: Add TTY-over-Firewire serial driver drivers/tty/serial/serial_core.c: clean up HIGH_BITS_OFFSET usage staging: dgrp: dgrp_tty.c: Audit the return values of get/put_user() staging: dgrp: dgrp_tty.c: Remove the TIOCSSOFTCAR ioctl handler from dgrp driver serial: ifx6x60: Add modem power off function in the platform reboot process serial: mxs-auart: unmap the scatter list before we copy the data serial: mxs-auart: disable the Receive Timeout Interrupt when DMA is enabled serial: max310x: Setup missing "can_sleep" field for GPIO tty/serial: fix ifx6x60.c declaration warning serial: samsung: add devicetree properties for non-Exynos SoCs serial: samsung: fix potential soft lockup during uart write tty: vt: Remove redundant null check before kfree. tty/8250 Add check for pci_ioremap_bar failure tty/8250 Add support for Commtech's Fastcom Async-335 and Fastcom Async-PCIe cards tty/8250 Add XR17D15x devices to the exar_handle_irq override ...
Diffstat (limited to 'drivers/tty/n_gsm.c')
-rw-r--r--drivers/tty/n_gsm.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 1e8e8ce5595..dcc0430a49c 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -134,7 +134,6 @@ struct gsm_dlci {
134#define DLCI_OPENING 1 /* Sending SABM not seen UA */ 134#define DLCI_OPENING 1 /* Sending SABM not seen UA */
135#define DLCI_OPEN 2 /* SABM/UA complete */ 135#define DLCI_OPEN 2 /* SABM/UA complete */
136#define DLCI_CLOSING 3 /* Sending DISC not seen UA/DM */ 136#define DLCI_CLOSING 3 /* Sending DISC not seen UA/DM */
137 struct kref ref; /* freed from port or mux close */
138 struct mutex mutex; 137 struct mutex mutex;
139 138
140 /* Link layer */ 139 /* Link layer */
@@ -1635,7 +1634,6 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr)
1635 if (dlci == NULL) 1634 if (dlci == NULL)
1636 return NULL; 1635 return NULL;
1637 spin_lock_init(&dlci->lock); 1636 spin_lock_init(&dlci->lock);
1638 kref_init(&dlci->ref);
1639 mutex_init(&dlci->mutex); 1637 mutex_init(&dlci->mutex);
1640 dlci->fifo = &dlci->_fifo; 1638 dlci->fifo = &dlci->_fifo;
1641 if (kfifo_alloc(&dlci->_fifo, 4096, GFP_KERNEL) < 0) { 1639 if (kfifo_alloc(&dlci->_fifo, 4096, GFP_KERNEL) < 0) {
@@ -1669,9 +1667,9 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr)
1669 * 1667 *
1670 * Can sleep. 1668 * Can sleep.
1671 */ 1669 */
1672static void gsm_dlci_free(struct kref *ref) 1670static void gsm_dlci_free(struct tty_port *port)
1673{ 1671{
1674 struct gsm_dlci *dlci = container_of(ref, struct gsm_dlci, ref); 1672 struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port);
1675 1673
1676 del_timer_sync(&dlci->t1); 1674 del_timer_sync(&dlci->t1);
1677 dlci->gsm->dlci[dlci->addr] = NULL; 1675 dlci->gsm->dlci[dlci->addr] = NULL;
@@ -1683,12 +1681,12 @@ static void gsm_dlci_free(struct kref *ref)
1683 1681
1684static inline void dlci_get(struct gsm_dlci *dlci) 1682static inline void dlci_get(struct gsm_dlci *dlci)
1685{ 1683{
1686 kref_get(&dlci->ref); 1684 tty_port_get(&dlci->port);
1687} 1685}
1688 1686
1689static inline void dlci_put(struct gsm_dlci *dlci) 1687static inline void dlci_put(struct gsm_dlci *dlci)
1690{ 1688{
1691 kref_put(&dlci->ref, gsm_dlci_free); 1689 tty_port_put(&dlci->port);
1692} 1690}
1693 1691
1694/** 1692/**
@@ -2874,6 +2872,7 @@ static void gsm_dtr_rts(struct tty_port *port, int onoff)
2874static const struct tty_port_operations gsm_port_ops = { 2872static const struct tty_port_operations gsm_port_ops = {
2875 .carrier_raised = gsm_carrier_raised, 2873 .carrier_raised = gsm_carrier_raised,
2876 .dtr_rts = gsm_dtr_rts, 2874 .dtr_rts = gsm_dtr_rts,
2875 .destruct = gsm_dlci_free,
2877}; 2876};
2878 2877
2879static int gsmtty_install(struct tty_driver *driver, struct tty_struct *tty) 2878static int gsmtty_install(struct tty_driver *driver, struct tty_struct *tty)