diff options
Diffstat (limited to 'drivers/char/esp.c')
-rw-r--r-- | drivers/char/esp.c | 67 |
1 files changed, 27 insertions, 40 deletions
diff --git a/drivers/char/esp.c b/drivers/char/esp.c index 9f53d2fcc360..e469f641c728 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c | |||
@@ -345,26 +345,22 @@ static inline void receive_chars_pio(struct esp_struct *info, int num_bytes) | |||
345 | 345 | ||
346 | for (i = 0; i < num_bytes; i++) { | 346 | for (i = 0; i < num_bytes; i++) { |
347 | if (!(err_buf->data[i] & status_mask)) { | 347 | if (!(err_buf->data[i] & status_mask)) { |
348 | *(tty->flip.char_buf_ptr++) = pio_buf->data[i]; | 348 | int flag = 0; |
349 | 349 | ||
350 | if (err_buf->data[i] & 0x04) { | 350 | if (err_buf->data[i] & 0x04) { |
351 | *(tty->flip.flag_buf_ptr++) = TTY_BREAK; | 351 | flag = TTY_BREAK; |
352 | |||
353 | if (info->flags & ASYNC_SAK) | 352 | if (info->flags & ASYNC_SAK) |
354 | do_SAK(tty); | 353 | do_SAK(tty); |
355 | } | 354 | } |
356 | else if (err_buf->data[i] & 0x02) | 355 | else if (err_buf->data[i] & 0x02) |
357 | *(tty->flip.flag_buf_ptr++) = TTY_FRAME; | 356 | flag = TTY_FRAME; |
358 | else if (err_buf->data[i] & 0x01) | 357 | else if (err_buf->data[i] & 0x01) |
359 | *(tty->flip.flag_buf_ptr++) = TTY_PARITY; | 358 | flag = TTY_PARITY; |
360 | else | 359 | tty_insert_flip_char(tty, pio_buf->data[i], flag); |
361 | *(tty->flip.flag_buf_ptr++) = 0; | ||
362 | |||
363 | tty->flip.count++; | ||
364 | } | 360 | } |
365 | } | 361 | } |
366 | 362 | ||
367 | schedule_delayed_work(&tty->flip.work, 1); | 363 | schedule_delayed_work(&tty->buf.work, 1); |
368 | 364 | ||
369 | info->stat_flags &= ~ESP_STAT_RX_TIMEOUT; | 365 | info->stat_flags &= ~ESP_STAT_RX_TIMEOUT; |
370 | release_pio_buffer(pio_buf); | 366 | release_pio_buffer(pio_buf); |
@@ -397,7 +393,6 @@ static inline void receive_chars_dma_done(struct esp_struct *info, | |||
397 | int num_bytes; | 393 | int num_bytes; |
398 | unsigned long flags; | 394 | unsigned long flags; |
399 | 395 | ||
400 | |||
401 | flags=claim_dma_lock(); | 396 | flags=claim_dma_lock(); |
402 | disable_dma(dma); | 397 | disable_dma(dma); |
403 | clear_dma_ff(dma); | 398 | clear_dma_ff(dma); |
@@ -408,38 +403,31 @@ static inline void receive_chars_dma_done(struct esp_struct *info, | |||
408 | 403 | ||
409 | info->icount.rx += num_bytes; | 404 | info->icount.rx += num_bytes; |
410 | 405 | ||
411 | memcpy(tty->flip.char_buf_ptr, dma_buffer, num_bytes); | ||
412 | tty->flip.char_buf_ptr += num_bytes; | ||
413 | tty->flip.count += num_bytes; | ||
414 | memset(tty->flip.flag_buf_ptr, 0, num_bytes); | ||
415 | tty->flip.flag_buf_ptr += num_bytes; | ||
416 | |||
417 | if (num_bytes > 0) { | 406 | if (num_bytes > 0) { |
418 | tty->flip.flag_buf_ptr--; | 407 | tty_insert_flip_string(tty, dma_buffer, num_bytes - 1); |
419 | 408 | ||
420 | status &= (0x1c & info->read_status_mask); | 409 | status &= (0x1c & info->read_status_mask); |
410 | |||
411 | /* Is the status significant or do we throw the last byte ? */ | ||
412 | if (!(status & info->ignore_status_mask)) { | ||
413 | int statflag = 0; | ||
421 | 414 | ||
422 | if (status & info->ignore_status_mask) { | 415 | if (status & 0x10) { |
423 | tty->flip.count--; | 416 | statflag = TTY_BREAK; |
424 | tty->flip.char_buf_ptr--; | 417 | (info->icount.brk)++; |
425 | tty->flip.flag_buf_ptr--; | 418 | if (info->flags & ASYNC_SAK) |
426 | } else if (status & 0x10) { | 419 | do_SAK(tty); |
427 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 420 | } else if (status & 0x08) { |
428 | (info->icount.brk)++; | 421 | statflag = TTY_FRAME; |
429 | if (info->flags & ASYNC_SAK) | 422 | (info->icount.frame)++; |
430 | do_SAK(tty); | 423 | } |
431 | } else if (status & 0x08) { | 424 | else if (status & 0x04) { |
432 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 425 | statflag = TTY_PARITY; |
433 | (info->icount.frame)++; | 426 | (info->icount.parity)++; |
434 | } | 427 | } |
435 | else if (status & 0x04) { | 428 | tty_insert_flip_char(tty, dma_buffer[num_bytes - 1], statflag); |
436 | *tty->flip.flag_buf_ptr = TTY_PARITY; | ||
437 | (info->icount.parity)++; | ||
438 | } | 429 | } |
439 | 430 | schedule_delayed_work(&tty->buf.work, 1); | |
440 | tty->flip.flag_buf_ptr++; | ||
441 | |||
442 | schedule_delayed_work(&tty->flip.work, 1); | ||
443 | } | 431 | } |
444 | 432 | ||
445 | if (dma_bytes != num_bytes) { | 433 | if (dma_bytes != num_bytes) { |
@@ -693,8 +681,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id, | |||
693 | num_bytes = serial_in(info, UART_ESI_STAT1) << 8; | 681 | num_bytes = serial_in(info, UART_ESI_STAT1) << 8; |
694 | num_bytes |= serial_in(info, UART_ESI_STAT2); | 682 | num_bytes |= serial_in(info, UART_ESI_STAT2); |
695 | 683 | ||
696 | if (num_bytes > (TTY_FLIPBUF_SIZE - info->tty->flip.count)) | 684 | num_bytes = tty_buffer_request_room(info->tty, num_bytes); |
697 | num_bytes = TTY_FLIPBUF_SIZE - info->tty->flip.count; | ||
698 | 685 | ||
699 | if (num_bytes) { | 686 | if (num_bytes) { |
700 | if (dma_bytes || | 687 | if (dma_bytes || |