Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325635
b: refs/heads/master
c: 86176ed
h: refs/heads/master
i:
  325633: a7866c8
  325631: 5c660b6
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Aug 10, 2012
1 parent a65608b commit f2fa88e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3dd332c553996eec2593110b05abf8a4819b5c28
refs/heads/master: 86176ed905454e568539c77e0cba5759085830bb
30 changes: 24 additions & 6 deletions trunk/drivers/tty/n_gsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2868,14 +2868,14 @@ static const struct tty_port_operations gsm_port_ops = {
.dtr_rts = gsm_dtr_rts,
};


static int gsmtty_open(struct tty_struct *tty, struct file *filp)
static int gsmtty_install(struct tty_driver *driver, struct tty_struct *tty)
{
struct gsm_mux *gsm;
struct gsm_dlci *dlci;
struct tty_port *port;
unsigned int line = tty->index;
unsigned int mux = line >> 6;
bool alloc = false;
int ret;

line = line & 0x3F;

Expand All @@ -2890,13 +2890,30 @@ static int gsmtty_open(struct tty_struct *tty, struct file *filp)
if (gsm->dead)
return -EL2HLT;
dlci = gsm->dlci[line];
if (dlci == NULL)
if (dlci == NULL) {
alloc = true;
dlci = gsm_dlci_alloc(gsm, line);
}
if (dlci == NULL)
return -ENOMEM;
port = &dlci->port;
port->count++;
ret = tty_port_install(&dlci->port, driver, tty);
if (ret) {
if (alloc)
dlci_put(dlci);
return ret;
}

tty->driver_data = dlci;

return 0;
}

static int gsmtty_open(struct tty_struct *tty, struct file *filp)
{
struct gsm_dlci *dlci = tty->driver_data;
struct tty_port *port = &dlci->port;

port->count++;
dlci_get(dlci);
dlci_get(dlci->gsm->dlci[0]);
mux_get(dlci->gsm);
Expand Down Expand Up @@ -3085,6 +3102,7 @@ static int gsmtty_break_ctl(struct tty_struct *tty, int state)

/* Virtual ttys for the demux */
static const struct tty_operations gsmtty_ops = {
.install = gsmtty_install,
.open = gsmtty_open,
.close = gsmtty_close,
.write = gsmtty_write,
Expand Down

0 comments on commit f2fa88e

Please sign in to comment.