diff options
Diffstat (limited to 'drivers/serial/jsm/jsm_tty.c')
-rw-r--r-- | drivers/serial/jsm/jsm_tty.c | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c index 281f23a371b2..94ec66372508 100644 --- a/drivers/serial/jsm/jsm_tty.c +++ b/drivers/serial/jsm/jsm_tty.c | |||
@@ -500,13 +500,11 @@ void jsm_input(struct jsm_channel *ch) | |||
500 | { | 500 | { |
501 | struct jsm_board *bd; | 501 | struct jsm_board *bd; |
502 | struct tty_struct *tp; | 502 | struct tty_struct *tp; |
503 | struct tty_ldisc *ld; | ||
504 | u32 rmask; | 503 | u32 rmask; |
505 | u16 head; | 504 | u16 head; |
506 | u16 tail; | 505 | u16 tail; |
507 | int data_len; | 506 | int data_len; |
508 | unsigned long lock_flags; | 507 | unsigned long lock_flags; |
509 | int flip_len = 0; | ||
510 | int len = 0; | 508 | int len = 0; |
511 | int n = 0; | 509 | int n = 0; |
512 | int s = 0; | 510 | int s = 0; |
@@ -574,45 +572,13 @@ void jsm_input(struct jsm_channel *ch) | |||
574 | 572 | ||
575 | jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "start 2\n"); | 573 | jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "start 2\n"); |
576 | 574 | ||
577 | /* | 575 | if (data_len <= 0) { |
578 | * If the rxbuf is empty and we are not throttled, put as much | ||
579 | * as we can directly into the linux TTY buffer. | ||
580 | * | ||
581 | */ | ||
582 | flip_len = TTY_FLIPBUF_SIZE; | ||
583 | |||
584 | len = min(data_len, flip_len); | ||
585 | len = min(len, (N_TTY_BUF_SIZE - 1) - tp->read_cnt); | ||
586 | ld = tty_ldisc_ref(tp); | ||
587 | |||
588 | /* | ||
589 | * If we were unable to get a reference to the ld, | ||
590 | * don't flush our buffer, and act like the ld doesn't | ||
591 | * have any space to put the data right now. | ||
592 | */ | ||
593 | if (!ld) { | ||
594 | len = 0; | ||
595 | } else { | ||
596 | /* | ||
597 | * If ld doesn't have a pointer to a receive_buf function, | ||
598 | * flush the data, then act like the ld doesn't have any | ||
599 | * space to put the data right now. | ||
600 | */ | ||
601 | if (!ld->receive_buf) { | ||
602 | ch->ch_r_head = ch->ch_r_tail; | ||
603 | len = 0; | ||
604 | } | ||
605 | } | ||
606 | |||
607 | if (len <= 0) { | ||
608 | spin_unlock_irqrestore(&ch->ch_lock, lock_flags); | 576 | spin_unlock_irqrestore(&ch->ch_lock, lock_flags); |
609 | jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "jsm_input 1\n"); | 577 | jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "jsm_input 1\n"); |
610 | if (ld) | ||
611 | tty_ldisc_deref(ld); | ||
612 | return; | 578 | return; |
613 | } | 579 | } |
614 | 580 | ||
615 | len = tty_buffer_request_room(tp, len); | 581 | len = tty_buffer_request_room(tp, data_len); |
616 | n = len; | 582 | n = len; |
617 | 583 | ||
618 | /* | 584 | /* |
@@ -647,7 +613,7 @@ void jsm_input(struct jsm_channel *ch) | |||
647 | else if (*(ch->ch_equeue +tail +i) & UART_LSR_FE) | 613 | else if (*(ch->ch_equeue +tail +i) & UART_LSR_FE) |
648 | tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_FRAME); | 614 | tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_FRAME); |
649 | else | 615 | else |
650 | tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_NORMAL); | 616 | tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_NORMAL); |
651 | } | 617 | } |
652 | } else { | 618 | } else { |
653 | tty_insert_flip_string(tp, ch->ch_rqueue + tail, s) ; | 619 | tty_insert_flip_string(tp, ch->ch_rqueue + tail, s) ; |
@@ -666,9 +632,6 @@ void jsm_input(struct jsm_channel *ch) | |||
666 | /* Tell the tty layer its okay to "eat" the data now */ | 632 | /* Tell the tty layer its okay to "eat" the data now */ |
667 | tty_flip_buffer_push(tp); | 633 | tty_flip_buffer_push(tp); |
668 | 634 | ||
669 | if (ld) | ||
670 | tty_ldisc_deref(ld); | ||
671 | |||
672 | jsm_printk(IOCTL, INFO, &ch->ch_bd->pci_dev, "finish\n"); | 635 | jsm_printk(IOCTL, INFO, &ch->ch_bd->pci_dev, "finish\n"); |
673 | } | 636 | } |
674 | 637 | ||