Commit ae677517 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

tty: Clean up tiocmset

Reverse the order of one test and it gets much more readable
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8fb06c77
...@@ -3515,15 +3515,15 @@ static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p ...@@ -3515,15 +3515,15 @@ static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p
static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd, static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd,
unsigned __user *p) unsigned __user *p)
{ {
int retval = -EINVAL; int retval;
if (tty->ops->tiocmset) {
unsigned int set, clear, val; unsigned int set, clear, val;
if (tty->ops->tiocmset == NULL)
return -EINVAL;
retval = get_user(val, p); retval = get_user(val, p);
if (retval) if (retval)
return retval; return retval;
set = clear = 0; set = clear = 0;
switch (cmd) { switch (cmd) {
case TIOCMBIS: case TIOCMBIS:
...@@ -3537,13 +3537,9 @@ static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int ...@@ -3537,13 +3537,9 @@ static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int
clear = ~val; clear = ~val;
break; break;
} }
set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP;
clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP;
return tty->ops->tiocmset(tty, file, set, clear);
retval = tty->ops->tiocmset(tty, file, set, clear);
}
return retval;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment