- Changed module description to be more accurate
authorTom Knot <tomasknot@gmail.com>
Wed, 27 Jun 2018 16:15:18 +0000 (18:15 +0200)
committerTom Knot <tomasknot@gmail.com>
Wed, 27 Jun 2018 16:15:18 +0000 (18:15 +0200)
- Removed unnecessary counting of work invocation (work is only allowed to be queued once)
- Removed superfluous flags declaration

modules/unipi/src/unipi_common.h
modules/unipi/src/unipi_spi.c
modules/unipi/src/unipi_sysfs.c
modules/unipi/src/unipi_uart.c
version.txt

index bf367d8a39c7b15c5f322fa27fda1df1faaa0fc7..281e6b7d70c81135a35874fdc295d45dd8eeb802 100644 (file)
@@ -120,9 +120,6 @@ struct neuronspi_port
        struct kthread_work                     tx_work;
        struct kthread_work                     rx_work;
        struct kthread_work                     irq_work;
-       struct spinlock                         tx_counter_lock;
-       struct spinlock                         tx_lock;
-       u8                                                      tx_work_count;
        u32                                                     flags;
        u8                                                      ier_clear;
        u8                                                      buf[NEURONSPI_FIFO_SIZE];
index ac0b13a108d55f2df29cbc57ad792cb63326eb47..8a463fe6af6b2dc17eaf6ddc395df2cf8a4644c6 100644 (file)
@@ -1577,4 +1577,4 @@ module_exit(neuronspi_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Tomas Knot <knot@faster.cz>");
-MODULE_DESCRIPTION("UniPi Neuron driver");
+MODULE_DESCRIPTION("UniPi PLC Driver");
index 5824e98d6854428cfbda0f30e0b9799aa16a0fb2..4c9bd584fe4a6cfe18a8707621eeb651bdcece45 100644 (file)
@@ -973,7 +973,6 @@ static ssize_t neuronspi_spi_gpio_show_do_count(struct device *dev, struct devic
 static ssize_t neuronspi_spi_gpio_show_di_count(struct device *dev, struct device_attribute *attr, char *buf)
 {
        ssize_t ret = 0;
-       unsigned long flags;
        struct neuronspi_di_driver *n_di;
        struct neuronspi_driver_data *n_spi;
        struct platform_device *plat = to_platform_device(dev);
index 26d2d31282b6d7dba6d5a79434f6a4fe28c89c94..029f430b72de308351dd4393cb9df8967dfd07a2 100644 (file)
@@ -311,18 +311,12 @@ void neuronspi_uart_handle_tx(struct neuronspi_port *port)
                port->port.icount.tx++;
                spin_unlock_irqrestore(&port->port.lock, flags);
                port->port.x_char = 0;
-               spin_lock_irqsave(&port->tx_lock, flags);
-               port->tx_work_count--;
-               spin_unlock_irqrestore(&port->tx_lock, flags);
                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);
@@ -331,7 +325,7 @@ void neuronspi_uart_handle_tx(struct neuronspi_port *port)
        spin_lock_irqsave(&port->port.lock, flags);
        to_send = uart_circ_chars_pending(xmit);
        spin_unlock_irqrestore(&port->port.lock, flags);
-       printk(KERN_INFO "NEURONSPI UART_HANDLE_TX A, to_send:%d, tx_work_count:%d\n", to_send, port->tx_work_count);
+       printk(KERN_INFO "NEURONSPI UART_HANDLE_TX A, to_send:%d\n", to_send);
        if (likely(to_send)) {
                /* Limit to size of (TX FIFO / 2) */
                max_txlen = NEURONSPI_FIFO_SIZE >> 2;
@@ -350,7 +344,7 @@ void neuronspi_uart_handle_tx(struct neuronspi_port *port)
                                xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
                                spin_unlock_irqrestore(&port->port.lock, flags);
                        }
-                       printk(KERN_INFO "NEURONSPI UART_HANDLE_TX B, to_send:%d, tx_work_count:%d\n", to_send_packet, port->tx_work_count);
+                       printk(KERN_INFO "NEURONSPI UART_HANDLE_TX B, to_send:%d\n", to_send_packet);
                        neuronspi_uart_fifo_write(port, to_send_packet);
                        to_send -= to_send_packet;
                }
@@ -368,13 +362,10 @@ void neuronspi_uart_handle_tx(struct neuronspi_port *port)
                        xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
                        spin_unlock_irqrestore(&port->port.lock, flags);
                }
-               printk(KERN_INFO "NEURONSPI UART_HANDLE_TX C, to_send:%d, tx_work_count:%d\n", to_send, port->tx_work_count);
+               printk(KERN_INFO "NEURONSPI UART_HANDLE_TX C, to_send:%d\n", to_send);
                neuronspi_uart_fifo_write(port, to_send);
 
        }
-       spin_lock_irqsave(&port->tx_lock, flags);
-       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) {
@@ -458,7 +449,6 @@ s32 neuronspi_uart_probe(struct spi_device* dev, u8 device_index)
                uart_data->p[i].port.rs485_config = neuronspi_uart_config_rs485;
                uart_data->p[i].port.ops        = &neuronspi_uart_ops;
                uart_data->p[i].port.line       = neuronspi_uart_alloc_line();
-               spin_lock_init(&uart_data->p[i].tx_counter_lock);
                spin_lock_init(&uart_data->p[i].port.lock);
                if (uart_data->p[i].port.line >= NEURONSPI_MAX_DEVS) {
                        ret = -ENOMEM;
@@ -590,20 +580,12 @@ void neuronspi_uart_rx_proc(struct kthread_work *ws)
 void neuronspi_uart_start_tx(struct uart_port *port)
 {
        struct neuronspi_port *n_port = to_neuronspi_port(port,port);
-       unsigned long flags;
 #if NEURONSPI_DETAILED_DEBUG > 0
        printk(KERN_INFO "NEURONSPI: Start TX\n");
 #endif
-       spin_lock_irqsave(&n_port->tx_lock, flags);
-       if (n_port->tx_work_count > NEURONSPI_MAX_TX_WORK) {
-               spin_unlock_irqrestore(&n_port->tx_lock, flags);
+       if (!kthread_queue_work(&n_port->parent->kworker, &n_port->tx_work)) {
                printk(KERN_INFO "NEURONSPI: TX WORK OVERFLOW\n");
-               return;
-       } else {
-               n_port->tx_work_count++;
        }
-       spin_unlock_irqrestore(&n_port->tx_lock, flags);
-       kthread_queue_work(&n_port->parent->kworker, &n_port->tx_work);
 }
 
 s32 neuronspi_uart_poll(void *data)
@@ -636,6 +618,7 @@ s32 neuronspi_uart_startup(struct uart_port *port)
                wake_up_process(d_data->poll_thread);
        } else if (d_data->no_irq) {
                d_data->poll_thread = kthread_create(neuronspi_uart_poll, (void *)d_data, "UART_poll_thread");
+               wake_up_process(d_data->poll_thread);
        }
        neuronspi_uart_power(port, 1);
        // TODO: /* Reset FIFOs*/
index 89d990824299768cb3de58d93d11a496e7b62747..0f1edc8543dd6c85c4920e216270e4338e57625d 100644 (file)
@@ -1 +1 @@
-Repository:neuron-kernel ActiveBranch:[uart_timeout] PrecedingRelease:v.0.12 PrecedingRevision:69(77704e8) LatestCommit:Wed Jun 27 17:37:58 CEST 2018
+Repository:neuron-kernel ActiveBranch:[uart_timeout] PrecedingRelease:v.0.12 PrecedingRevision:70(0561924) LatestCommit:Wed Jun 27 18:15:18 CEST 2018