aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-09-10 15:06:34 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-24 00:19:35 -0400
commit136d5258b2bc4ffae99cb69874a76624c26fbfad (patch)
tree1699143576355e462091a5701b2814dc1d2d1d71 /drivers/tty
parentc545b66c6922b002b5fe224a6eaec58c913650b5 (diff)
tty: Move and rename send_prio_char() as tty_send_xchar()
Relocate the file-scope function, send_prio_char(), as a global helper tty_send_xchar(). Remove the global declarations for tty_write_lock()/tty_write_unlock(), as these are file-scope only now. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/tty_io.c33
-rw-r--r--drivers/tty/tty_ioctl.c33
2 files changed, 33 insertions, 33 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index c249ff1d51ce..2f6f9b5e4891 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1023,14 +1023,14 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count,
1023 return i; 1023 return i;
1024} 1024}
1025 1025
1026void tty_write_unlock(struct tty_struct *tty) 1026static void tty_write_unlock(struct tty_struct *tty)
1027 __releases(&tty->atomic_write_lock) 1027 __releases(&tty->atomic_write_lock)
1028{ 1028{
1029 mutex_unlock(&tty->atomic_write_lock); 1029 mutex_unlock(&tty->atomic_write_lock);
1030 wake_up_interruptible_poll(&tty->write_wait, POLLOUT); 1030 wake_up_interruptible_poll(&tty->write_wait, POLLOUT);
1031} 1031}
1032 1032
1033int tty_write_lock(struct tty_struct *tty, int ndelay) 1033static int tty_write_lock(struct tty_struct *tty, int ndelay)
1034 __acquires(&tty->atomic_write_lock) 1034 __acquires(&tty->atomic_write_lock)
1035{ 1035{
1036 if (!mutex_trylock(&tty->atomic_write_lock)) { 1036 if (!mutex_trylock(&tty->atomic_write_lock)) {
@@ -1217,6 +1217,35 @@ ssize_t redirected_tty_write(struct file *file, const char __user *buf,
1217 return tty_write(file, buf, count, ppos); 1217 return tty_write(file, buf, count, ppos);
1218} 1218}
1219 1219
1220/**
1221 * tty_send_xchar - send priority character
1222 *
1223 * Send a high priority character to the tty even if stopped
1224 *
1225 * Locking: none for xchar method, write ordering for write method.
1226 */
1227
1228int tty_send_xchar(struct tty_struct *tty, char ch)
1229{
1230 int was_stopped = tty->stopped;
1231
1232 if (tty->ops->send_xchar) {
1233 tty->ops->send_xchar(tty, ch);
1234 return 0;
1235 }
1236
1237 if (tty_write_lock(tty, 0) < 0)
1238 return -ERESTARTSYS;
1239
1240 if (was_stopped)
1241 start_tty(tty);
1242 tty->ops->write(tty, &ch, 1);
1243 if (was_stopped)
1244 stop_tty(tty);
1245 tty_write_unlock(tty);
1246 return 0;
1247}
1248
1220static char ptychar[] = "pqrstuvwxyzabcde"; 1249static char ptychar[] = "pqrstuvwxyzabcde";
1221 1250
1222/** 1251/**
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index dcf5c0af7de9..ad9120d1c0f1 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -912,35 +912,6 @@ static int set_ltchars(struct tty_struct *tty, struct ltchars __user *ltchars)
912#endif 912#endif
913 913
914/** 914/**
915 * send_prio_char - send priority character
916 *
917 * Send a high priority character to the tty even if stopped
918 *
919 * Locking: none for xchar method, write ordering for write method.
920 */
921
922static int send_prio_char(struct tty_struct *tty, char ch)
923{
924 int was_stopped = tty->stopped;
925
926 if (tty->ops->send_xchar) {
927 tty->ops->send_xchar(tty, ch);
928 return 0;
929 }
930
931 if (tty_write_lock(tty, 0) < 0)
932 return -ERESTARTSYS;
933
934 if (was_stopped)
935 start_tty(tty);
936 tty->ops->write(tty, &ch, 1);
937 if (was_stopped)
938 stop_tty(tty);
939 tty_write_unlock(tty);
940 return 0;
941}
942
943/**
944 * tty_change_softcar - carrier change ioctl helper 915 * tty_change_softcar - carrier change ioctl helper
945 * @tty: tty to update 916 * @tty: tty to update
946 * @arg: enable/disable CLOCAL 917 * @arg: enable/disable CLOCAL
@@ -1194,11 +1165,11 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
1194 break; 1165 break;
1195 case TCIOFF: 1166 case TCIOFF:
1196 if (STOP_CHAR(tty) != __DISABLED_CHAR) 1167 if (STOP_CHAR(tty) != __DISABLED_CHAR)
1197 return send_prio_char(tty, STOP_CHAR(tty)); 1168 return tty_send_xchar(tty, STOP_CHAR(tty));
1198 break; 1169 break;
1199 case TCION: 1170 case TCION:
1200 if (START_CHAR(tty) != __DISABLED_CHAR) 1171 if (START_CHAR(tty) != __DISABLED_CHAR)
1201 return send_prio_char(tty, START_CHAR(tty)); 1172 return tty_send_xchar(tty, START_CHAR(tty));
1202 break; 1173 break;
1203 default: 1174 default:
1204 return -EINVAL; 1175 return -EINVAL;