aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tty_io.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-10-13 05:37:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 12:51:40 -0400
commit9e48565d217a8a96cc7577308ad41e9e4b806a62 (patch)
tree2ff5f745d72e0d33a93cdc51622f011f0031eb76 /drivers/char/tty_io.c
parente04957365b21066285557e42ffe16d8330d46c02 (diff)
tty: Split tty_port into its own file
Not much in it yet but this will grow a lot Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/tty_io.c')
-rw-r--r--drivers/char/tty_io.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 3a726936aa5b..732316899ca4 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1139,42 +1139,6 @@ ssize_t redirected_tty_write(struct file *file, const char __user *buf,
1139 return tty_write(file, buf, count, ppos); 1139 return tty_write(file, buf, count, ppos);
1140} 1140}
1141 1141
1142void tty_port_init(struct tty_port *port)
1143{
1144 memset(port, 0, sizeof(*port));
1145 init_waitqueue_head(&port->open_wait);
1146 init_waitqueue_head(&port->close_wait);
1147 mutex_init(&port->mutex);
1148 port->close_delay = (50 * HZ) / 100;
1149 port->closing_wait = (3000 * HZ) / 100;
1150}
1151EXPORT_SYMBOL(tty_port_init);
1152
1153int tty_port_alloc_xmit_buf(struct tty_port *port)
1154{
1155 /* We may sleep in get_zeroed_page() */
1156 mutex_lock(&port->mutex);
1157 if (port->xmit_buf == NULL)
1158 port->xmit_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL);
1159 mutex_unlock(&port->mutex);
1160 if (port->xmit_buf == NULL)
1161 return -ENOMEM;
1162 return 0;
1163}
1164EXPORT_SYMBOL(tty_port_alloc_xmit_buf);
1165
1166void tty_port_free_xmit_buf(struct tty_port *port)
1167{
1168 mutex_lock(&port->mutex);
1169 if (port->xmit_buf != NULL) {
1170 free_page((unsigned long)port->xmit_buf);
1171 port->xmit_buf = NULL;
1172 }
1173 mutex_unlock(&port->mutex);
1174}
1175EXPORT_SYMBOL(tty_port_free_xmit_buf);
1176
1177
1178static char ptychar[] = "pqrstuvwxyzabcde"; 1142static char ptychar[] = "pqrstuvwxyzabcde";
1179 1143
1180/** 1144/**