- Short refactoring
authorTom Knot <tomasknot@gmail.com>
Wed, 27 Jun 2018 12:46:16 +0000 (14:46 +0200)
committerTom Knot <tomasknot@gmail.com>
Wed, 27 Jun 2018 12:46:16 +0000 (14:46 +0200)
- UART TX log is marked order-wise

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

index 3b600413e3a0223a0fd755705290a3cc921348ee..bf367d8a39c7b15c5f322fa27fda1df1faaa0fc7 100644 (file)
@@ -283,9 +283,6 @@ extern struct spinlock* neuronspi_spi_w_spinlock;
 extern struct spi_device* neuronspi_s_dev[NEURONSPI_MAX_DEVS];
 extern struct task_struct *neuronspi_invalidate_thread;
 
-extern u8 neuronspi_spi_w_flag;
-extern u8 neuronspi_probe_count;
 extern int neuronspi_model_id;
-extern spinlock_t neuronspi_probe_spinlock;
 
 #endif /* MODULES_NEURON_SPI_SRC_UNIPI_COMMON_H_ */
index 9ce6769e0e4db3519047c78642d4984d62e7f611..17f4d3543a3350c5609d06f3d906a8242843cd4a 100644 (file)
@@ -62,16 +62,15 @@ struct neuronspi_char_driver neuronspi_cdrv =
 
 struct mutex neuronspi_master_mutex;
 struct mutex unipi_inv_speed_mutex;
-struct spinlock *neuronspi_ldisc_spinlock;
 struct spinlock *neuronspi_spi_w_spinlock;
-u8 neuronspi_spi_w_flag = 1;
-u8 neuronspi_probe_count = 0;
 int neuronspi_model_id = -1;
-spinlock_t neuronspi_probe_spinlock;
 struct spi_device *neuronspi_s_dev[NEURONSPI_MAX_DEVS];
 struct task_struct *neuronspi_invalidate_thread;
 
-struct sched_param neuronspi_sched_param = { .sched_priority = MAX_RT_PRIO / 2 };
+static u8 neuronspi_spi_w_flag = 1;
+static u8 neuronspi_probe_count = 0;
+static struct spinlock *neuronspi_probe_spinlock;
+static struct sched_param neuronspi_sched_param = { .sched_priority = MAX_RT_PRIO / 2 };
 
 /************************
  * Non-static Functions *
@@ -902,9 +901,9 @@ s32 neuronspi_spi_probe(struct spi_device *spi)
        s32 ret, i, no_irq = 0;
        u8 uart_count = 0;
        n_spi = kzalloc(sizeof *n_spi, GFP_ATOMIC);
-       spin_lock(&neuronspi_probe_spinlock);
+       spin_lock(neuronspi_probe_spinlock);
        neuronspi_probe_count++;
-       spin_unlock(&neuronspi_probe_spinlock);
+       spin_unlock(neuronspi_probe_spinlock);
        if (!n_spi)
                return -ENOMEM;
        printk(KERN_INFO "NEURONSPI: Neuronspi Probe Started\n");
@@ -1110,13 +1109,13 @@ reg1001: %x, reg1002: %x, reg1003: %x, reg1004: %x\n",
 #if NEURONSPI_DETAILED_DEBUG > 0
        printk(KERN_DEBUG "NEURONSPI: CHIP SELECT %d\n", spi->chip_select);
 #endif
-       spin_lock(&neuronspi_probe_spinlock);
+       spin_lock(neuronspi_probe_spinlock);
        neuronspi_s_dev[n_spi->neuron_index] = spi;
        spi_set_drvdata(neuronspi_s_dev[n_spi->neuron_index], n_spi);
        if (neuronspi_probe_count == NEURONSPI_MAX_DEVS) {
                neuronspi_model_id = neuronspi_find_model_id(neuronspi_probe_count);
        }
-       spin_unlock(&neuronspi_probe_spinlock);
+       spin_unlock(neuronspi_probe_spinlock);
        if (neuronspi_model_id != -1) {
                printk(KERN_INFO "NEURONSPI: Detected Neuron board combination corresponding to %s\n", NEURONSPI_MODELTABLE[neuronspi_model_id].model_name);
        }
@@ -1524,6 +1523,8 @@ static s32 __init neuronspi_init(void)
        s32 ret = 0;
        neuronspi_spi_w_spinlock = kzalloc(sizeof(struct spinlock), GFP_ATOMIC);
        spin_lock_init(neuronspi_spi_w_spinlock);
+       neuronspi_probe_spinlock = kzalloc(sizeof(struct spinlock), GFP_ATOMIC);
+       spin_lock_init(neuronspi_probe_spinlock);
        mutex_init(&neuronspi_master_mutex);
        mutex_init(&unipi_inv_speed_mutex);
        memset(&neuronspi_s_dev, 0, sizeof(neuronspi_s_dev));
index c2db95e25e467584928105969dbda8e3dc7a2edf..18b6300fa2b40a74d0a2afb2608a82abda3405a0 100644 (file)
@@ -27,11 +27,11 @@ struct neuronspi_uart_data* neuronspi_uart_glob_data;
 unsigned long neuronspi_lines;
 struct uart_driver* neuronspi_uart;
 
-struct sched_param neuronspi_sched_param = { .sched_priority = MAX_RT_PRIO / 2 };
+static struct sched_param neuronspi_sched_param = { .sched_priority = MAX_RT_PRIO / 2 };
 
-/************************
- * Non-static Functions *
- ************************/
+/********************
+ * Static Functions *
+ ********************/
 
 static void neuronspi_uart_set_iflags(struct uart_port *port, int to)
 {
@@ -52,6 +52,10 @@ static void neuronspi_uart_set_iflags(struct uart_port *port, int to)
        kfree(outp_buf);
 }
 
+/************************
+ * Non-static Functions *
+ ************************/
+
 void neuronspi_uart_set_ldisc(struct uart_port *port, struct ktermios *kterm)
 {
        u8 *inp_buf, *outp_buf;
@@ -317,7 +321,7 @@ void neuronspi_uart_handle_tx(struct neuronspi_port *port)
 
        /* Get length of data pending in circular buffer */
        to_send = uart_circ_chars_pending(xmit);
-       printk(KERN_INFO "NEURONSPI UART_HANDLE_TX, 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, tx_work_count:%d\n", to_send, port->tx_work_count);
        if (likely(to_send)) {
                /* Limit to size of (TX FIFO / 2) */
                max_txlen = NEURONSPI_FIFO_SIZE >> 1;
@@ -332,7 +336,7 @@ void neuronspi_uart_handle_tx(struct neuronspi_port *port)
                                port->buf[i] = xmit->buf[xmit->tail];
                                xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
                        }
-                       printk(KERN_INFO "NEURONSPI UART_HANDLE_TX, 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, tx_work_count:%d\n", to_send_packet, port->tx_work_count);
                        neuronspi_uart_fifo_write(port, to_send_packet);
                        to_send -= to_send_packet;
                }
@@ -346,7 +350,7 @@ void neuronspi_uart_handle_tx(struct neuronspi_port *port)
                        port->buf[i] = xmit->buf[xmit->tail];
                        xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
                }
-               printk(KERN_INFO "NEURONSPI UART_HANDLE_TX, 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, tx_work_count:%d\n", to_send, port->tx_work_count);
                neuronspi_uart_fifo_write(port, to_send);
 
        }
index bbe62ae29099c4fc8d58098268336c4cb58eb684..6d85040f842aea90a3161ac5d0a60e70923a492d 100644 (file)
@@ -1 +1 @@
-Repository:neuron-kernel ActiveBranch:[uart_timeout] PrecedingRelease:v.0.12 PrecedingRevision:62(349a4cf) LatestCommit:Wed Jun 27 14:19:09 CEST 2018
+Repository:neuron-kernel ActiveBranch:[uart_timeout] PrecedingRelease:v.0.12 PrecedingRevision:63(e86884a) LatestCommit:Wed Jun 27 14:46:16 CEST 2018