projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tty: add a helper for setting termios data from kernel side
[firefly-linux-kernel-4.4.55.git]
/
drivers
/
tty
/
tty_ioctl.c
diff --git
a/drivers/tty/tty_ioctl.c
b/drivers/tty/tty_ioctl.c
index 0c18899714593325fa4e51f3235ad5a23e9ed0c4..1a1135d580a24276418c58ba899b127514cd433a 100644
(file)
--- a/
drivers/tty/tty_ioctl.c
+++ b/
drivers/tty/tty_ioctl.c
@@
-486,7
+486,7
@@
int tty_termios_hw_change(struct ktermios *a, struct ktermios *b)
EXPORT_SYMBOL(tty_termios_hw_change);
/**
EXPORT_SYMBOL(tty_termios_hw_change);
/**
- *
change_termios
- update termios values
+ *
tty_set_termios
- update termios values
* @tty: tty to update
* @new_termios: desired new value
*
* @tty: tty to update
* @new_termios: desired new value
*
@@
-497,7
+497,7
@@
EXPORT_SYMBOL(tty_termios_hw_change);
* Locking: termios_mutex
*/
* Locking: termios_mutex
*/
-
static void change
_termios(struct tty_struct *tty, struct ktermios *new_termios)
+
int tty_set
_termios(struct tty_struct *tty, struct ktermios *new_termios)
{
struct ktermios old_termios;
struct tty_ldisc *ld;
{
struct ktermios old_termios;
struct tty_ldisc *ld;
@@
-553,7
+553,9
@@
static void change_termios(struct tty_struct *tty, struct ktermios *new_termios)
tty_ldisc_deref(ld);
}
mutex_unlock(&tty->termios_mutex);
tty_ldisc_deref(ld);
}
mutex_unlock(&tty->termios_mutex);
+ return 0;
}
}
+EXPORT_SYMBOL_GPL(tty_set_termios);
/**
* set_termios - set termios values for a tty
/**
* set_termios - set termios values for a tty
@@
-562,7
+564,7
@@
static void change_termios(struct tty_struct *tty, struct ktermios *new_termios)
* @opt: option information
*
* Helper function to prepare termios data and run necessary other
* @opt: option information
*
* Helper function to prepare termios data and run necessary other
- * functions before using
change
_termios to do the actual changes.
+ * functions before using
tty_set
_termios to do the actual changes.
*
* Locking:
* Called functions take ldisc and termios_mutex locks
*
* Locking:
* Called functions take ldisc and termios_mutex locks
@@
-620,7
+622,7
@@
static int set_termios(struct tty_struct *tty, void __user *arg, int opt)
return -EINTR;
}
return -EINTR;
}
-
change
_termios(tty, &tmp_termios);
+
tty_set
_termios(tty, &tmp_termios);
/* FIXME: Arguably if tmp_termios == tty->termios AND the
actual requested termios was not tmp_termios then we may
/* FIXME: Arguably if tmp_termios == tty->termios AND the
actual requested termios was not tmp_termios then we may
@@
-797,7
+799,7
@@
static int set_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb)
termios.c_ospeed);
#endif
mutex_unlock(&tty->termios_mutex);
termios.c_ospeed);
#endif
mutex_unlock(&tty->termios_mutex);
-
change
_termios(tty, &termios);
+
tty_set
_termios(tty, &termios);
return 0;
}
#endif
return 0;
}
#endif
@@
-951,6
+953,8
@@
int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
int ret = 0;
struct ktermios kterm;
int ret = 0;
struct ktermios kterm;
+ BUG_ON(file == NULL);
+
if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
tty->driver->subtype == PTY_TYPE_MASTER)
real_tty = tty->link;
if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
tty->driver->subtype == PTY_TYPE_MASTER)
real_tty = tty->link;