Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95180
b: refs/heads/master
c: 1c2630c
h: refs/heads/master
v: v3
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Apr 30, 2008
1 parent 911f0a9 commit 2d8d417
Show file tree
Hide file tree
Showing 2 changed files with 28 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: 0ee9cbb3c705903db9c258047d9ce87096e6a1a1
refs/heads/master: 1c2630ccf922b7ea2c54c184243d4fb2bd2cf3c6
33 changes: 27 additions & 6 deletions trunk/drivers/char/tty_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,32 @@ static int send_prio_char(struct tty_struct *tty, char ch)
return 0;
}

/**
* tty_change_softcar - carrier change ioctl helper
* @tty: tty to update
* @arg: enable/disable CLOCAL
*
* Perform a change to the CLOCAL state and call into the driver
* layer to make it visible. All done with the termios mutex
*/

static int tty_change_softcar(struct tty_struct *tty, int arg)
{
int ret = 0;
int bit = arg ? CLOCAL : 0;
struct ktermios old = *tty->termios;

mutex_lock(&tty->termios_mutex);
tty->termios->c_cflag &= ~CLOCAL;
tty->termios->c_cflag |= bit;
if (tty->driver->set_termios)
tty->driver->set_termios(tty, &old);
if ((tty->termios->c_cflag & CLOCAL) != bit)
ret = -EINVAL;
mutex_unlock(&tty->termios_mutex);
return ret;
}

/**
* tty_mode_ioctl - mode related ioctls
* @tty: tty for the ioctl
Expand Down Expand Up @@ -865,12 +891,7 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
case TIOCSSOFTCAR:
if (get_user(arg, (unsigned int __user *) arg))
return -EFAULT;
mutex_lock(&tty->termios_mutex);
tty->termios->c_cflag =
((tty->termios->c_cflag & ~CLOCAL) |
(arg ? CLOCAL : 0));
mutex_unlock(&tty->termios_mutex);
return 0;
return tty_change_softcar(tty, arg);
default:
return -ENOIOCTLCMD;
}
Expand Down

0 comments on commit 2d8d417

Please sign in to comment.