diff options
Diffstat (limited to 'drivers/tty/serial/sunzilog.c')
-rw-r--r-- | drivers/tty/serial/sunzilog.c | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index aef4fab957c3..27669ff3d446 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c | |||
@@ -323,17 +323,15 @@ static void sunzilog_kbdms_receive_chars(struct uart_sunzilog_port *up, | |||
323 | } | 323 | } |
324 | } | 324 | } |
325 | 325 | ||
326 | static struct tty_struct * | 326 | static struct tty_port * |
327 | sunzilog_receive_chars(struct uart_sunzilog_port *up, | 327 | sunzilog_receive_chars(struct uart_sunzilog_port *up, |
328 | struct zilog_channel __iomem *channel) | 328 | struct zilog_channel __iomem *channel) |
329 | { | 329 | { |
330 | struct tty_struct *tty; | 330 | struct tty_port *port = NULL; |
331 | unsigned char ch, r1, flag; | 331 | unsigned char ch, r1, flag; |
332 | 332 | ||
333 | tty = NULL; | 333 | if (up->port.state != NULL) /* Unopened serial console */ |
334 | if (up->port.state != NULL && /* Unopened serial console */ | 334 | port = &up->port.state->port; |
335 | up->port.state->port.tty != NULL) /* Keyboard || mouse */ | ||
336 | tty = up->port.state->port.tty; | ||
337 | 335 | ||
338 | for (;;) { | 336 | for (;;) { |
339 | 337 | ||
@@ -366,11 +364,6 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up, | |||
366 | continue; | 364 | continue; |
367 | } | 365 | } |
368 | 366 | ||
369 | if (tty == NULL) { | ||
370 | uart_handle_sysrq_char(&up->port, ch); | ||
371 | continue; | ||
372 | } | ||
373 | |||
374 | /* A real serial line, record the character and status. */ | 367 | /* A real serial line, record the character and status. */ |
375 | flag = TTY_NORMAL; | 368 | flag = TTY_NORMAL; |
376 | up->port.icount.rx++; | 369 | up->port.icount.rx++; |
@@ -400,13 +393,13 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up, | |||
400 | 393 | ||
401 | if (up->port.ignore_status_mask == 0xff || | 394 | if (up->port.ignore_status_mask == 0xff || |
402 | (r1 & up->port.ignore_status_mask) == 0) { | 395 | (r1 & up->port.ignore_status_mask) == 0) { |
403 | tty_insert_flip_char(tty, ch, flag); | 396 | tty_insert_flip_char(port, ch, flag); |
404 | } | 397 | } |
405 | if (r1 & Rx_OVR) | 398 | if (r1 & Rx_OVR) |
406 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 399 | tty_insert_flip_char(port, 0, TTY_OVERRUN); |
407 | } | 400 | } |
408 | 401 | ||
409 | return tty; | 402 | return port; |
410 | } | 403 | } |
411 | 404 | ||
412 | static void sunzilog_status_handle(struct uart_sunzilog_port *up, | 405 | static void sunzilog_status_handle(struct uart_sunzilog_port *up, |
@@ -539,21 +532,21 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id) | |||
539 | while (up) { | 532 | while (up) { |
540 | struct zilog_channel __iomem *channel | 533 | struct zilog_channel __iomem *channel |
541 | = ZILOG_CHANNEL_FROM_PORT(&up->port); | 534 | = ZILOG_CHANNEL_FROM_PORT(&up->port); |
542 | struct tty_struct *tty; | 535 | struct tty_port *port; |
543 | unsigned char r3; | 536 | unsigned char r3; |
544 | 537 | ||
545 | spin_lock(&up->port.lock); | 538 | spin_lock(&up->port.lock); |
546 | r3 = read_zsreg(channel, R3); | 539 | r3 = read_zsreg(channel, R3); |
547 | 540 | ||
548 | /* Channel A */ | 541 | /* Channel A */ |
549 | tty = NULL; | 542 | port = NULL; |
550 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { | 543 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { |
551 | writeb(RES_H_IUS, &channel->control); | 544 | writeb(RES_H_IUS, &channel->control); |
552 | ZSDELAY(); | 545 | ZSDELAY(); |
553 | ZS_WSYNC(channel); | 546 | ZS_WSYNC(channel); |
554 | 547 | ||
555 | if (r3 & CHARxIP) | 548 | if (r3 & CHARxIP) |
556 | tty = sunzilog_receive_chars(up, channel); | 549 | port = sunzilog_receive_chars(up, channel); |
557 | if (r3 & CHAEXT) | 550 | if (r3 & CHAEXT) |
558 | sunzilog_status_handle(up, channel); | 551 | sunzilog_status_handle(up, channel); |
559 | if (r3 & CHATxIP) | 552 | if (r3 & CHATxIP) |
@@ -561,22 +554,22 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id) | |||
561 | } | 554 | } |
562 | spin_unlock(&up->port.lock); | 555 | spin_unlock(&up->port.lock); |
563 | 556 | ||
564 | if (tty) | 557 | if (port) |
565 | tty_flip_buffer_push(tty); | 558 | tty_flip_buffer_push(port); |
566 | 559 | ||
567 | /* Channel B */ | 560 | /* Channel B */ |
568 | up = up->next; | 561 | up = up->next; |
569 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | 562 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); |
570 | 563 | ||
571 | spin_lock(&up->port.lock); | 564 | spin_lock(&up->port.lock); |
572 | tty = NULL; | 565 | port = NULL; |
573 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { | 566 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { |
574 | writeb(RES_H_IUS, &channel->control); | 567 | writeb(RES_H_IUS, &channel->control); |
575 | ZSDELAY(); | 568 | ZSDELAY(); |
576 | ZS_WSYNC(channel); | 569 | ZS_WSYNC(channel); |
577 | 570 | ||
578 | if (r3 & CHBRxIP) | 571 | if (r3 & CHBRxIP) |
579 | tty = sunzilog_receive_chars(up, channel); | 572 | port = sunzilog_receive_chars(up, channel); |
580 | if (r3 & CHBEXT) | 573 | if (r3 & CHBEXT) |
581 | sunzilog_status_handle(up, channel); | 574 | sunzilog_status_handle(up, channel); |
582 | if (r3 & CHBTxIP) | 575 | if (r3 & CHBTxIP) |
@@ -584,8 +577,8 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id) | |||
584 | } | 577 | } |
585 | spin_unlock(&up->port.lock); | 578 | spin_unlock(&up->port.lock); |
586 | 579 | ||
587 | if (tty) | 580 | if (port) |
588 | tty_flip_buffer_push(tty); | 581 | tty_flip_buffer_push(port); |
589 | 582 | ||
590 | up = up->next; | 583 | up = up->next; |
591 | } | 584 | } |