aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-04-02 07:54:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-09 14:28:16 -0400
commit0ea63da2ffa54f6196405010379d56f0c8085b7e (patch)
treeda26d0e3806fd09127d93bb58400e6dd59da6bec /drivers/s390
parentfe2fc9ca5d7e5d9144a4039d89a6f1f8967d9263 (diff)
TTY: sclp_tty, add tty_port
tty_port will hold tty buffers in the future. So we need to have it even here. The only needed member here is tty, so let us store it in the structure now. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: linux390@de.ibm.com Cc: linux-s390@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/char/sclp_tty.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c
index 40a9d69c898e..e66a75b3822c 100644
--- a/drivers/s390/char/sclp_tty.c
+++ b/drivers/s390/char/sclp_tty.c
@@ -48,7 +48,7 @@ static struct sclp_buffer *sclp_ttybuf;
48/* Timer for delayed output of console messages. */ 48/* Timer for delayed output of console messages. */
49static struct timer_list sclp_tty_timer; 49static struct timer_list sclp_tty_timer;
50 50
51static struct tty_struct *sclp_tty; 51static struct tty_port sclp_port;
52static unsigned char sclp_tty_chars[SCLP_TTY_BUF_SIZE]; 52static unsigned char sclp_tty_chars[SCLP_TTY_BUF_SIZE];
53static unsigned short int sclp_tty_chars_count; 53static unsigned short int sclp_tty_chars_count;
54 54
@@ -64,7 +64,7 @@ static int sclp_tty_columns = 80;
64static int 64static int
65sclp_tty_open(struct tty_struct *tty, struct file *filp) 65sclp_tty_open(struct tty_struct *tty, struct file *filp)
66{ 66{
67 sclp_tty = tty; 67 tty_port_tty_set(&sclp_port, tty);
68 tty->driver_data = NULL; 68 tty->driver_data = NULL;
69 tty->low_latency = 0; 69 tty->low_latency = 0;
70 return 0; 70 return 0;
@@ -76,7 +76,7 @@ sclp_tty_close(struct tty_struct *tty, struct file *filp)
76{ 76{
77 if (tty->count > 1) 77 if (tty->count > 1)
78 return; 78 return;
79 sclp_tty = NULL; 79 tty_port_tty_set(&sclp_port, NULL);
80} 80}
81 81
82/* 82/*
@@ -108,6 +108,7 @@ sclp_tty_write_room (struct tty_struct *tty)
108static void 108static void
109sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc) 109sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc)
110{ 110{
111 struct tty_struct *tty;
111 unsigned long flags; 112 unsigned long flags;
112 void *page; 113 void *page;
113 114
@@ -126,8 +127,10 @@ sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc)
126 spin_unlock_irqrestore(&sclp_tty_lock, flags); 127 spin_unlock_irqrestore(&sclp_tty_lock, flags);
127 } while (buffer && sclp_emit_buffer(buffer, sclp_ttybuf_callback)); 128 } while (buffer && sclp_emit_buffer(buffer, sclp_ttybuf_callback));
128 /* check if the tty needs a wake up call */ 129 /* check if the tty needs a wake up call */
129 if (sclp_tty != NULL) { 130 tty = tty_port_tty_get(&sclp_port);
130 tty_wakeup(sclp_tty); 131 if (tty != NULL) {
132 tty_wakeup(tty);
133 tty_kref_put(tty);
131 } 134 }
132} 135}
133 136
@@ -326,21 +329,22 @@ sclp_tty_flush_buffer(struct tty_struct *tty)
326static void 329static void
327sclp_tty_input(unsigned char* buf, unsigned int count) 330sclp_tty_input(unsigned char* buf, unsigned int count)
328{ 331{
332 struct tty_struct *tty = tty_port_tty_get(&sclp_port);
329 unsigned int cchar; 333 unsigned int cchar;
330 334
331 /* 335 /*
332 * If this tty driver is currently closed 336 * If this tty driver is currently closed
333 * then throw the received input away. 337 * then throw the received input away.
334 */ 338 */
335 if (sclp_tty == NULL) 339 if (tty == NULL)
336 return; 340 return;
337 cchar = ctrlchar_handle(buf, count, sclp_tty); 341 cchar = ctrlchar_handle(buf, count, tty);
338 switch (cchar & CTRLCHAR_MASK) { 342 switch (cchar & CTRLCHAR_MASK) {
339 case CTRLCHAR_SYSRQ: 343 case CTRLCHAR_SYSRQ:
340 break; 344 break;
341 case CTRLCHAR_CTRL: 345 case CTRLCHAR_CTRL:
342 tty_insert_flip_char(sclp_tty, cchar, TTY_NORMAL); 346 tty_insert_flip_char(tty, cchar, TTY_NORMAL);
343 tty_flip_buffer_push(sclp_tty); 347 tty_flip_buffer_push(tty);
344 break; 348 break;
345 case CTRLCHAR_NONE: 349 case CTRLCHAR_NONE:
346 /* send (normal) input to line discipline */ 350 /* send (normal) input to line discipline */
@@ -348,13 +352,14 @@ sclp_tty_input(unsigned char* buf, unsigned int count)
348 (strncmp((const char *) buf + count - 2, "^n", 2) && 352 (strncmp((const char *) buf + count - 2, "^n", 2) &&
349 strncmp((const char *) buf + count - 2, "\252n", 2))) { 353 strncmp((const char *) buf + count - 2, "\252n", 2))) {
350 /* add the auto \n */ 354 /* add the auto \n */
351 tty_insert_flip_string(sclp_tty, buf, count); 355 tty_insert_flip_string(tty, buf, count);
352 tty_insert_flip_char(sclp_tty, '\n', TTY_NORMAL); 356 tty_insert_flip_char(tty, '\n', TTY_NORMAL);
353 } else 357 } else
354 tty_insert_flip_string(sclp_tty, buf, count - 2); 358 tty_insert_flip_string(tty, buf, count - 2);
355 tty_flip_buffer_push(sclp_tty); 359 tty_flip_buffer_push(tty);
356 break; 360 break;
357 } 361 }
362 tty_kref_put(tty);
358} 363}
359 364
360/* 365/*
@@ -543,7 +548,7 @@ sclp_tty_init(void)
543 sclp_tty_tolower = 1; 548 sclp_tty_tolower = 1;
544 } 549 }
545 sclp_tty_chars_count = 0; 550 sclp_tty_chars_count = 0;
546 sclp_tty = NULL; 551 tty_port_init(&sclp_port);
547 552
548 rc = sclp_register(&sclp_input_event); 553 rc = sclp_register(&sclp_input_event);
549 if (rc) { 554 if (rc) {