aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/sunzilog.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2013-01-03 09:53:06 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-16 01:30:15 -0500
commit2e124b4a390ca85325fae75764bef92f0547fa25 (patch)
tree5519fbcdbe954e79b271ea6d31ac5a4dc754c4f5 /drivers/tty/serial/sunzilog.c
parentd6c53c0e9bd0a83f9f9ddbc9fd80141a54d83896 (diff)
TTY: switch tty_flip_buffer_push
Now, we start converting tty buffer functions to actually use tty_port. This will allow us to get rid of the need of tty in many call sites. Only tty_port will needed and hence no more tty_port_tty_get in those paths. Now, the one where most of tty_port_tty_get gets removed: tty_flip_buffer_push. IOW we also closed all the races in drivers not using tty_port_tty_get at all yet. Also we move tty_flip_buffer_push declaration from include/linux/tty.h to include/linux/tty_flip.h to all others while we are changing it anyway. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/sunzilog.c')
-rw-r--r--drivers/tty/serial/sunzilog.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index 4a11be3849f6..27669ff3d446 100644
--- a/drivers/tty/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
@@ -323,19 +323,15 @@ static void sunzilog_kbdms_receive_chars(struct uart_sunzilog_port *up,
323 } 323 }
324} 324}
325 325
326static struct tty_struct * 326static struct tty_port *
327sunzilog_receive_chars(struct uart_sunzilog_port *up, 327sunzilog_receive_chars(struct uart_sunzilog_port *up,
328 struct zilog_channel __iomem *channel) 328 struct zilog_channel __iomem *channel)
329{ 329{
330 struct tty_port *port = NULL; 330 struct tty_port *port = NULL;
331 struct tty_struct *tty;
332 unsigned char ch, r1, flag; 331 unsigned char ch, r1, flag;
333 332
334 tty = NULL; 333 if (up->port.state != NULL) /* Unopened serial console */
335 if (up->port.state != NULL) { /* Unopened serial console */
336 port = &up->port.state->port; 334 port = &up->port.state->port;
337 tty = port->tty; /* mouse => tty is NULL */
338 }
339 335
340 for (;;) { 336 for (;;) {
341 337
@@ -403,7 +399,7 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up,
403 tty_insert_flip_char(port, 0, TTY_OVERRUN); 399 tty_insert_flip_char(port, 0, TTY_OVERRUN);
404 } 400 }
405 401
406 return tty; 402 return port;
407} 403}
408 404
409static void sunzilog_status_handle(struct uart_sunzilog_port *up, 405static void sunzilog_status_handle(struct uart_sunzilog_port *up,
@@ -536,21 +532,21 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id)
536 while (up) { 532 while (up) {
537 struct zilog_channel __iomem *channel 533 struct zilog_channel __iomem *channel
538 = ZILOG_CHANNEL_FROM_PORT(&up->port); 534 = ZILOG_CHANNEL_FROM_PORT(&up->port);
539 struct tty_struct *tty; 535 struct tty_port *port;
540 unsigned char r3; 536 unsigned char r3;
541 537
542 spin_lock(&up->port.lock); 538 spin_lock(&up->port.lock);
543 r3 = read_zsreg(channel, R3); 539 r3 = read_zsreg(channel, R3);
544 540
545 /* Channel A */ 541 /* Channel A */
546 tty = NULL; 542 port = NULL;
547 if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { 543 if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
548 writeb(RES_H_IUS, &channel->control); 544 writeb(RES_H_IUS, &channel->control);
549 ZSDELAY(); 545 ZSDELAY();
550 ZS_WSYNC(channel); 546 ZS_WSYNC(channel);
551 547
552 if (r3 & CHARxIP) 548 if (r3 & CHARxIP)
553 tty = sunzilog_receive_chars(up, channel); 549 port = sunzilog_receive_chars(up, channel);
554 if (r3 & CHAEXT) 550 if (r3 & CHAEXT)
555 sunzilog_status_handle(up, channel); 551 sunzilog_status_handle(up, channel);
556 if (r3 & CHATxIP) 552 if (r3 & CHATxIP)
@@ -558,22 +554,22 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id)
558 } 554 }
559 spin_unlock(&up->port.lock); 555 spin_unlock(&up->port.lock);
560 556
561 if (tty) 557 if (port)
562 tty_flip_buffer_push(tty); 558 tty_flip_buffer_push(port);
563 559
564 /* Channel B */ 560 /* Channel B */
565 up = up->next; 561 up = up->next;
566 channel = ZILOG_CHANNEL_FROM_PORT(&up->port); 562 channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
567 563
568 spin_lock(&up->port.lock); 564 spin_lock(&up->port.lock);
569 tty = NULL; 565 port = NULL;
570 if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { 566 if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
571 writeb(RES_H_IUS, &channel->control); 567 writeb(RES_H_IUS, &channel->control);
572 ZSDELAY(); 568 ZSDELAY();
573 ZS_WSYNC(channel); 569 ZS_WSYNC(channel);
574 570
575 if (r3 & CHBRxIP) 571 if (r3 & CHBRxIP)
576 tty = sunzilog_receive_chars(up, channel); 572 port = sunzilog_receive_chars(up, channel);
577 if (r3 & CHBEXT) 573 if (r3 & CHBEXT)
578 sunzilog_status_handle(up, channel); 574 sunzilog_status_handle(up, channel);
579 if (r3 & CHBTxIP) 575 if (r3 & CHBTxIP)
@@ -581,8 +577,8 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id)
581 } 577 }
582 spin_unlock(&up->port.lock); 578 spin_unlock(&up->port.lock);
583 579
584 if (tty) 580 if (port)
585 tty_flip_buffer_push(tty); 581 tty_flip_buffer_push(port);
586 582
587 up = up->next; 583 up = up->next;
588 } 584 }