Added more spinlocks to TX_PROC
authorTom Knot <tomasknot@gmail.com>
Wed, 27 Jun 2018 15:37:58 +0000 (17:37 +0200)
committerTom Knot <tomasknot@gmail.com>
Wed, 27 Jun 2018 15:37:58 +0000 (17:37 +0200)
modules/unipi/src/unipi_spi.c
modules/unipi/src/unipi_uart.c
version.txt

index 9277b197da76a1ba191ec6c96013d0d301549b59..ac0b13a108d55f2df29cbc57ad792cb63326eb47 100644 (file)
@@ -1315,7 +1315,7 @@ reg1001: %x, reg1002: %x, reg1003: %x, reg1004: %x\n",
 #if NEURONSPI_DETAILED_DEBUG > 0
                printk(KERN_DEBUG "NEURONSPI: UART registration 1\n");
 #endif
-               n_spi->uart_buf = kzalloc(NEURONSPI_FIFO_SIZE, GFP_KERNEL);
+               n_spi->uart_buf = kzalloc(NEURONSPI_FIFO_SIZE, GFP_ATOMIC);
                neuronspi_uart_probe(spi, n_spi->neuron_index);
 #if NEURONSPI_DETAILED_DEBUG > 0
                printk(KERN_DEBUG "NEURONSPI: UART PROBE MCTRL:%d\n", neuronspi_spi_uart_get_cflag(spi, 0));
index 7e19bb3091cb023e8b3f101333bfaa425d7e150b..26d2d31282b6d7dba6d5a79434f6a4fe28c89c94 100644 (file)
@@ -317,12 +317,15 @@ void neuronspi_uart_handle_tx(struct neuronspi_port *port)
                return;
        }
 
+       spin_lock_irqsave(&port->port.lock, flags);
        if (uart_circ_empty(xmit) || uart_tx_stopped(&port->port)) {
+               spin_unlock_irqrestore(&port->port.lock, flags);
                spin_lock_irqsave(&port->tx_lock, flags);
                port->tx_work_count--;
                spin_unlock_irqrestore(&port->tx_lock, flags);
                return;
        }
+       spin_unlock_irqrestore(&port->port.lock, flags);
 
        /* Get length of data pending in circular buffer */
        spin_lock_irqsave(&port->port.lock, flags);
@@ -373,11 +376,11 @@ void neuronspi_uart_handle_tx(struct neuronspi_port *port)
        port->tx_work_count--;
        spin_unlock_irqrestore(&port->tx_lock, flags);
 
+       spin_lock_irqsave(&port->port.lock, flags);
        if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) {
-               spin_lock_irqsave(&port->port.lock, flags);
                uart_write_wakeup(&port->port);
-               spin_unlock_irqrestore(&port->port.lock, flags);
        }
+       spin_unlock_irqrestore(&port->port.lock, flags);
 }
 
 void neuronspi_uart_handle_irq(struct neuronspi_uart_data *uart_data, u32 portno)
index 658478cc83eaaabfffca6591c17f9a1dfdfba76e..89d990824299768cb3de58d93d11a496e7b62747 100644 (file)
@@ -1 +1 @@
-Repository:neuron-kernel ActiveBranch:[uart_timeout] PrecedingRelease:v.0.12 PrecedingRevision:68(b7675a2) LatestCommit:Wed Jun 27 17:06:39 CEST 2018
+Repository:neuron-kernel ActiveBranch:[uart_timeout] PrecedingRelease:v.0.12 PrecedingRevision:69(77704e8) LatestCommit:Wed Jun 27 17:37:58 CEST 2018