aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/con3215.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-04-11 05:14:59 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-13 13:56:12 -0400
commit86b26007a37d81e7aca242bb5b649473f8f81297 (patch)
treec2d26c2408db7f2244ffcf0e53b3bc0f0042cece /drivers/s390/char/con3215.c
parent8dd360f042387aed5e2472d2246b677b7703274f (diff)
TTY: con3215, use tty from tty_port
Obtain tty_struct only once in ISR and pass it down to raw3215_next_io. Other than that, we just use the tty with raised reference. And set it properly in open and close. 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/char/con3215.c')
-rw-r--r--drivers/s390/char/con3215.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index f7bc23baf540..e928e0408001 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -83,7 +83,6 @@ struct raw3215_info {
83 int head; /* first free byte in output buffer */ 83 int head; /* first free byte in output buffer */
84 int count; /* number of bytes in output buffer */ 84 int count; /* number of bytes in output buffer */
85 int written; /* number of bytes in write requests */ 85 int written; /* number of bytes in write requests */
86 struct tty_struct *tty; /* pointer to tty structure if present */
87 struct raw3215_req *queued_read; /* pointer to queued read requests */ 86 struct raw3215_req *queued_read; /* pointer to queued read requests */
88 struct raw3215_req *queued_write;/* pointer to queued write requests */ 87 struct raw3215_req *queued_write;/* pointer to queued write requests */
89 struct tasklet_struct tlet; /* tasklet to invoke tty_wakeup */ 88 struct tasklet_struct tlet; /* tasklet to invoke tty_wakeup */
@@ -343,11 +342,11 @@ static void raw3215_wakeup(unsigned long data)
343/* 342/*
344 * Try to start the next IO and wake up processes waiting on the tty. 343 * Try to start the next IO and wake up processes waiting on the tty.
345 */ 344 */
346static void raw3215_next_io(struct raw3215_info *raw) 345static void raw3215_next_io(struct raw3215_info *raw, struct tty_struct *tty)
347{ 346{
348 raw3215_mk_write_req(raw); 347 raw3215_mk_write_req(raw);
349 raw3215_try_io(raw); 348 raw3215_try_io(raw);
350 if (raw->tty && RAW3215_BUFFER_SIZE - raw->count >= RAW3215_MIN_SPACE) 349 if (tty && RAW3215_BUFFER_SIZE - raw->count >= RAW3215_MIN_SPACE)
351 tasklet_schedule(&raw->tlet); 350 tasklet_schedule(&raw->tlet);
352} 351}
353 352
@@ -365,10 +364,11 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
365 364
366 raw = dev_get_drvdata(&cdev->dev); 365 raw = dev_get_drvdata(&cdev->dev);
367 req = (struct raw3215_req *) intparm; 366 req = (struct raw3215_req *) intparm;
367 tty = tty_port_tty_get(&raw->port);
368 cstat = irb->scsw.cmd.cstat; 368 cstat = irb->scsw.cmd.cstat;
369 dstat = irb->scsw.cmd.dstat; 369 dstat = irb->scsw.cmd.dstat;
370 if (cstat != 0) 370 if (cstat != 0)
371 raw3215_next_io(raw); 371 raw3215_next_io(raw, tty);
372 if (dstat & 0x01) { /* we got a unit exception */ 372 if (dstat & 0x01) { /* we got a unit exception */
373 dstat &= ~0x01; /* we can ignore it */ 373 dstat &= ~0x01; /* we can ignore it */
374 } 374 }
@@ -378,13 +378,13 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
378 break; 378 break;
379 /* Attention interrupt, someone hit the enter key */ 379 /* Attention interrupt, someone hit the enter key */
380 raw3215_mk_read_req(raw); 380 raw3215_mk_read_req(raw);
381 raw3215_next_io(raw); 381 raw3215_next_io(raw, tty);
382 break; 382 break;
383 case 0x08: 383 case 0x08:
384 case 0x0C: 384 case 0x0C:
385 /* Channel end interrupt. */ 385 /* Channel end interrupt. */
386 if ((raw = req->info) == NULL) 386 if ((raw = req->info) == NULL)
387 return; /* That shouldn't happen ... */ 387 goto put_tty; /* That shouldn't happen ... */
388 if (req->type == RAW3215_READ) { 388 if (req->type == RAW3215_READ) {
389 /* store residual count, then wait for device end */ 389 /* store residual count, then wait for device end */
390 req->residual = irb->scsw.cmd.count; 390 req->residual = irb->scsw.cmd.count;
@@ -394,11 +394,10 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
394 case 0x04: 394 case 0x04:
395 /* Device end interrupt. */ 395 /* Device end interrupt. */
396 if ((raw = req->info) == NULL) 396 if ((raw = req->info) == NULL)
397 return; /* That shouldn't happen ... */ 397 goto put_tty; /* That shouldn't happen ... */
398 if (req->type == RAW3215_READ && raw->tty != NULL) { 398 if (req->type == RAW3215_READ && tty != NULL) {
399 unsigned int cchar; 399 unsigned int cchar;
400 400
401 tty = raw->tty;
402 count = 160 - req->residual; 401 count = 160 - req->residual;
403 EBCASC(raw->inbuf, count); 402 EBCASC(raw->inbuf, count);
404 cchar = ctrlchar_handle(raw->inbuf, count, tty); 403 cchar = ctrlchar_handle(raw->inbuf, count, tty);
@@ -408,7 +407,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
408 407
409 case CTRLCHAR_CTRL: 408 case CTRLCHAR_CTRL:
410 tty_insert_flip_char(tty, cchar, TTY_NORMAL); 409 tty_insert_flip_char(tty, cchar, TTY_NORMAL);
411 tty_flip_buffer_push(raw->tty); 410 tty_flip_buffer_push(tty);
412 break; 411 break;
413 412
414 case CTRLCHAR_NONE: 413 case CTRLCHAR_NONE:
@@ -421,7 +420,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
421 } else 420 } else
422 count -= 2; 421 count -= 2;
423 tty_insert_flip_string(tty, raw->inbuf, count); 422 tty_insert_flip_string(tty, raw->inbuf, count);
424 tty_flip_buffer_push(raw->tty); 423 tty_flip_buffer_push(tty);
425 break; 424 break;
426 } 425 }
427 } else if (req->type == RAW3215_WRITE) { 426 } else if (req->type == RAW3215_WRITE) {
@@ -436,7 +435,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
436 raw->queued_read == NULL) { 435 raw->queued_read == NULL) {
437 wake_up_interruptible(&raw->empty_wait); 436 wake_up_interruptible(&raw->empty_wait);
438 } 437 }
439 raw3215_next_io(raw); 438 raw3215_next_io(raw, tty);
440 break; 439 break;
441 default: 440 default:
442 /* Strange interrupt, I'll do my best to clean up */ 441 /* Strange interrupt, I'll do my best to clean up */
@@ -448,9 +447,10 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
448 raw->flags &= ~RAW3215_WORKING; 447 raw->flags &= ~RAW3215_WORKING;
449 raw3215_free_req(req); 448 raw3215_free_req(req);
450 } 449 }
451 raw3215_next_io(raw); 450 raw3215_next_io(raw, tty);
452 } 451 }
453 return; 452put_tty:
453 tty_kref_put(tty);
454} 454}
455 455
456/* 456/*
@@ -946,7 +946,7 @@ static int tty3215_open(struct tty_struct *tty, struct file * filp)
946 return -ENODEV; 946 return -ENODEV;
947 947
948 tty->driver_data = raw; 948 tty->driver_data = raw;
949 raw->tty = tty; 949 tty_port_tty_set(&raw->port, tty);
950 950
951 tty->low_latency = 0; /* don't use bottom half for pushing chars */ 951 tty->low_latency = 0; /* don't use bottom half for pushing chars */
952 /* 952 /*
@@ -977,7 +977,7 @@ static void tty3215_close(struct tty_struct *tty, struct file * filp)
977 raw3215_shutdown(raw); 977 raw3215_shutdown(raw);
978 tasklet_kill(&raw->tlet); 978 tasklet_kill(&raw->tlet);
979 tty->closing = 0; 979 tty->closing = 0;
980 raw->tty = NULL; 980 tty_port_tty_set(&raw->port, NULL);
981} 981}
982 982
983/* 983/*