TTY: switch tty_flip_buffer_push
[firefly-linux-kernel-4.4.55.git] / drivers / tty / synclink.c
index 9e071f6985f690a0c6638481327a9e8af606d8ab..555fdc0ed0f1f647aee3f538df0ab128b1f95199 100644 (file)
@@ -291,8 +291,7 @@ struct mgsl_struct {
        bool lcr_mem_requested;
 
        u32 misc_ctrl_value;
-       char flag_buf[MAX_ASYNC_BUFFER_SIZE];
-       char char_buf[MAX_ASYNC_BUFFER_SIZE];   
+       char *flag_buf;
        bool drop_rts_on_tx_done;
 
        bool loopmode_insert_requested;
@@ -1440,7 +1439,6 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info )
        u16 status;
        int work = 0;
        unsigned char DataByte;
-       struct tty_struct *tty = info->port.tty;
        struct  mgsl_icount *icount = &info->icount;
        
        if ( debug_level >= DEBUG_LEVEL_ISR )   
@@ -1502,19 +1500,19 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info )
                        if (status & RXSTATUS_BREAK_RECEIVED) {
                                flag = TTY_BREAK;
                                if (info->port.flags & ASYNC_SAK)
-                                       do_SAK(tty);
+                                       do_SAK(info->port.tty);
                        } else if (status & RXSTATUS_PARITY_ERROR)
                                flag = TTY_PARITY;
                        else if (status & RXSTATUS_FRAMING_ERROR)
                                flag = TTY_FRAME;
                }       /* end of if (error) */
-               tty_insert_flip_char(tty, DataByte, flag);
+               tty_insert_flip_char(&info->port, DataByte, flag);
                if (status & RXSTATUS_OVERRUN) {
                        /* Overrun is special, since it's
                         * reported immediately, and doesn't
                         * affect the current character
                         */
-                       work += tty_insert_flip_char(tty, 0, TTY_OVERRUN);
+                       work += tty_insert_flip_char(&info->port, 0, TTY_OVERRUN);
                }
        }
 
@@ -1525,7 +1523,7 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info )
        }
                        
        if(work)
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&info->port);
 }
 
 /* mgsl_isr_misc()
@@ -3416,7 +3414,7 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
                goto cleanup;
        }
        
-       info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+       info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
        spin_lock_irqsave(&info->netlock, flags);
        if (info->netcount) {
@@ -3898,7 +3896,13 @@ static int mgsl_alloc_intermediate_rxbuffer_memory(struct mgsl_struct *info)
        info->intermediate_rxbuffer = kmalloc(info->max_frame_size, GFP_KERNEL | GFP_DMA);
        if ( info->intermediate_rxbuffer == NULL )
                return -ENOMEM;
-
+       /* unused flag buffer to satisfy receive_buf calling interface */
+       info->flag_buf = kzalloc(info->max_frame_size, GFP_KERNEL);
+       if (!info->flag_buf) {
+               kfree(info->intermediate_rxbuffer);
+               info->intermediate_rxbuffer = NULL;
+               return -ENOMEM;
+       }
        return 0;
 
 }      /* end of mgsl_alloc_intermediate_rxbuffer_memory() */
@@ -3917,6 +3921,8 @@ static void mgsl_free_intermediate_rxbuffer_memory(struct mgsl_struct *info)
 {
        kfree(info->intermediate_rxbuffer);
        info->intermediate_rxbuffer = NULL;
+       kfree(info->flag_buf);
+       info->flag_buf = NULL;
 
 }      /* end of mgsl_free_intermediate_rxbuffer_memory() */