tty/module.c
branchstable-1.5
changeset 2661 39280d5a3321
parent 2518 e5640f5e10a2
equal deleted inserted replaced
2658:7690a5df7539 2661:39280d5a3321
   335 
   335 
   336     /* Push received data into TTY core. */
   336     /* Push received data into TTY core. */
   337     to_recv = ec_tty_rx_size(tty);
   337     to_recv = ec_tty_rx_size(tty);
   338     if (to_recv && tty->tty) {
   338     if (to_recv && tty->tty) {
   339         unsigned char *cbuf;
   339         unsigned char *cbuf;
       
   340 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
       
   341         int space = tty_prepare_flip_string(tty->tty->port, &cbuf, to_recv);
       
   342 #else
   340         int space = tty_prepare_flip_string(tty->tty, &cbuf, to_recv);
   343         int space = tty_prepare_flip_string(tty->tty, &cbuf, to_recv);
       
   344 #endif
   341 
   345 
   342         if (space < to_recv) {
   346         if (space < to_recv) {
   343             printk(KERN_WARNING PFX "Insufficient space to_recv=%d space=%d\n",
   347             printk(KERN_WARNING PFX "Insufficient space to_recv=%d space=%d\n",
   344                     to_recv, space);
   348                     to_recv, space);
   345         }
   349         }
   360             for (i = 0; i < to_recv; i++) {
   364             for (i = 0; i < to_recv; i++) {
   361                 cbuf[i] = tty->rx_buffer[tty->rx_read_idx];
   365                 cbuf[i] = tty->rx_buffer[tty->rx_read_idx];
   362                 tty->rx_read_idx =
   366                 tty->rx_read_idx =
   363                     (tty->rx_read_idx + 1) % EC_TTY_RX_BUFFER_SIZE;
   367                     (tty->rx_read_idx + 1) % EC_TTY_RX_BUFFER_SIZE;
   364             }
   368             }
       
   369 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
       
   370             tty_flip_buffer_push(tty->tty->port);
       
   371 #else
   365             tty_flip_buffer_push(tty->tty);
   372             tty_flip_buffer_push(tty->tty);
       
   373 #endif
   366         }
   374         }
   367     }
   375     }
   368 
   376 
   369     tty->timer.expires += 1;
   377     tty->timer.expires += 1;
   370     add_timer(&tty->timer);
   378     add_timer(&tty->timer);