- Removed debug prints
authorTom Knot <tomasknot@gmail.com>
Wed, 4 Jul 2018 12:56:22 +0000 (14:56 +0200)
committerTom Knot <tomasknot@gmail.com>
Wed, 4 Jul 2018 12:56:22 +0000 (14:56 +0200)
- Fixed division by zero

modules/unipi/src/unipi_spi.c
modules/unipi/src/unipi_sysfs.c
modules/unipi/src/unipi_tty.c
modules/unipi/src/unipi_uart.c
version.txt

index f65179d30924b851052bef115ba38cba693f8274..d143b02e3f0d37352d2edc41106ee5582c3acd1b 100644 (file)
@@ -635,7 +635,7 @@ void neuronspi_spi_iio_stm_ao_set_current(struct iio_dev *indio_dev, struct iio_
        u32 stm_v_inp_ref = 0;
        u32 stm_i_err = 0;
        u32 stm_i_off = 0;
-       u64 stm_true_val = 0;
+       u64 stm_true_val = val;
        u64 stm_true_ref = 0;
        regmap_read(n_spi->reg_map, n_spi->regstart_table->vref_int, &stm_v_int_ref);
        regmap_read(n_spi->reg_map, n_spi->regstart_table->vref_inp, &stm_v_inp_ref);
index 31862df5f45859c4ccf7ba01bab59fe1579ce99b..a3691a16c87beff5267229891b9c35822bb5869d 100644 (file)
@@ -200,7 +200,9 @@ static ssize_t neuronspi_spi_show_uart_timeout(struct device *dev, struct device
        struct neuronspi_driver_data *n_spi;
        struct platform_device *plat = to_platform_device(dev);
        n_spi = platform_get_drvdata(plat);
+#if NEURONSPI_DETAILED_DEBUG > 0
        printk(KERN_INFO "NEURONSPI: Index %d\n", n_spi->neuron_index);
+#endif
        spi = neuronspi_s_dev[n_spi->neuron_index];
        if (n_spi && n_spi->combination_id != 0xFF && n_spi->reg_map && n_spi->regstart_table->uart_conf_reg) {
                read_length = neuronspi_spi_compose_single_register_read(504, &inp_buf, &outp_buf);
@@ -224,7 +226,9 @@ static ssize_t neuronspi_spi_store_uart_timeout(struct device *dev, struct devic
        struct neuronspi_driver_data *n_spi;
        struct platform_device *plat = to_platform_device(dev);
        n_spi = platform_get_drvdata(plat);
+#if NEURONSPI_DETAILED_DEBUG > 0
        printk(KERN_INFO "NEURONSPI: Index %d\n", n_spi->neuron_index);
+#endif
        spi = neuronspi_s_dev[n_spi->neuron_index];
        err = kstrtouint(buf, 0, &val);
        if (err < 0) goto err_end;
@@ -1008,7 +1012,6 @@ static ssize_t neuronspi_iio_show_stm_ai_mode(struct device *dev, struct device_
        struct spi_device *spi = ai_data->parent;
        struct neuronspi_driver_data *n_spi = spi_get_drvdata(spi);
        regmap_read(n_spi->reg_map, n_spi->regstart_table->stm_ai_mode_reg + ai_data->index, &val);
-
        ret = scnprintf(buf, 255, "%d\n", val);
        return ret;
 }
@@ -1038,9 +1041,10 @@ static ssize_t neuronspi_iio_show_stm_ao_mode(struct device *dev, struct device_
        struct neuronspi_analog_data *ao_data = iio_priv(indio_dev);
        struct spi_device *spi = ao_data->parent;
        struct neuronspi_driver_data *n_spi = spi_get_drvdata(spi);
-
        regmap_read(n_spi->reg_map, n_spi->regstart_table->stm_ao_mode_reg + ao_data->index, &val);
+#if NEURONSPI_DETAILED_DEBUG > 0
        printk(KERN_INFO "NEURONSPI: Mode register %d set to %x", n_spi->regstart_table->stm_ao_mode_reg + ao_data->index, val);
+#endif
        ret = scnprintf(buf, 255, "%d\n", val);
        return ret;
 }
@@ -1056,7 +1060,9 @@ static ssize_t neuronspi_iio_store_stm_ao_mode(struct device *dev, struct device
        err = kstrtouint(buf, 0, &val);
        if (err < 0) goto err_end;
        if (n_spi && n_spi->combination_id != -1 && n_spi->reg_map) {
+#if NEURONSPI_DETAILED_DEBUG > 0
                printk(KERN_INFO "NEURONSPI: Mode register %d set to %x", n_spi->regstart_table->stm_ao_mode_reg + ao_data->index, val);
+#endif
                regmap_write(n_spi->reg_map, n_spi->regstart_table->stm_ao_mode_reg + ao_data->index, val);
        }
 err_end:
index 79f260d978888f489a1638fe81b4d65d6bab8e94..2179359f3071362e2b2dbb39fd338bf80f327bca 100644 (file)
@@ -25,7 +25,9 @@ struct tty_ldisc_ops neuronspi_tty_ldisc;
 int neuronspi_tty_init()
 {
        int err;
+#if NEURONSPI_DETAILED_DEBUG > 0
        printk(KERN_INFO "NEURONSPI TTY Init\n");
+#endif
        memset(&neuronspi_tty_ldisc, 0, sizeof(neuronspi_tty_ldisc));
        n_tty_inherit_ops(&neuronspi_tty_ldisc);
        neuronspi_tty_ldisc.magic                       = TTY_LDISC_MAGIC;
index 71562c423205a5b644203997ace9898c3c6ccc76..79827d5aed5de8ddff304decb8ed0b2cc3819eb8 100644 (file)
@@ -120,9 +120,9 @@ int neuronspi_uart_ioctl (struct uart_port *port, unsigned int ioctl_code, unsig
                return 1;
        }
        case 0x5481: {
-//#if NEURONSPI_DETAILED_DEBUG > 0
+#if NEURONSPI_DETAILED_DEBUG > 0
                printk(KERN_INFO "NEURONSPI: IOCTL 0x5481\n");
-//#endif
+#endif
                write_length = neuronspi_spi_compose_single_register_write(NEURONSPI_UART_TIMEOUT_REGISTER, &inp_buf, &outp_buf, (ioctl_arg * 1000000) / n_port->baud);
                printk(KERN_INFO "NEURONSPI: val_upper: %x, val_lower: %x", inp_buf[10], inp_buf[11]);
                neuronspi_spi_send_message(spi, inp_buf, outp_buf, write_length, n_spi->ideal_frequency, 25, 1, 0);
@@ -131,9 +131,9 @@ int neuronspi_uart_ioctl (struct uart_port *port, unsigned int ioctl_code, unsig
                return 0;
        }
        case 0x5480: {
-//#if NEURONSPI_DETAILED_DEBUG > 0
+#if NEURONSPI_DETAILED_DEBUG > 0
                printk(KERN_INFO "NEURONSPI: IOCTL 0x5480\n");
-//#endif
+#endif
                write_length = neuronspi_spi_compose_single_register_write(NEURONSPI_UART_TIMEOUT_REGISTER, &inp_buf, &outp_buf, ioctl_arg * 10);
                printk(KERN_INFO "NEURONSPI: val_upper: %x, val_lower: %x", inp_buf[10], inp_buf[11]);
                neuronspi_spi_send_message(spi, inp_buf, outp_buf, write_length, n_spi->ideal_frequency, 25, 1, 0);
@@ -158,9 +158,9 @@ void neuronspi_uart_set_termios(struct uart_port *port, struct ktermios *termios
                printk(KERN_INFO "NEURONSPI: c_iflag termios:%d\n", termios->c_iflag);
 #endif
        }
-//#if NEURONSPI_DETAILED_DEBUG > 0
+#if NEURONSPI_DETAILED_DEBUG > 0
        printk(KERN_DEBUG "NEURONSPI: TERMIOS Set, p:%d, c_cflag:%x\n", port->line, termios->c_cflag);
-//#endif
+#endif
        neuronspi_spi_uart_set_cflag(neuronspi_s_dev[n_port->dev_index], n_port->dev_port, termios->c_cflag);
        if (old && termios && (old->c_iflag & PARMRK) != (termios->c_iflag & PARMRK)) {
                neuronspi_uart_set_iflags(port, termios->c_iflag);
@@ -169,7 +169,6 @@ void neuronspi_uart_set_termios(struct uart_port *port, struct ktermios *termios
                }
        }
        if (old && termios && old->c_line != termios->c_line) {
-               printk(KERN_INFO "NEURONSPI: Line Discipline change\n");
                if (termios->c_line == N_PROFIBUS_FDL) {
 #if NEURONSPI_DETAILED_DEBUG > 0
                        printk(KERN_INFO "NEURONSPI: Line Discipline change\n");
@@ -205,14 +204,14 @@ void neuronspi_uart_fifo_read(struct uart_port *port, u32 rxlen)
        s32 i;
        struct neuronspi_port *s = to_neuronspi_port(port,port);
        struct neuronspi_driver_data *d_data = spi_get_drvdata(neuronspi_s_dev[s->dev_index]);
-//#if NEURONSPI_DETAILED_DEBUG > 2
+#if NEURONSPI_DETAILED_DEBUG > 2
        printk(KERN_INFO "NEURONSPI: FIFO Read len:%d\n", rxlen);
-//#endif
+#endif
     memcpy(s->buf, d_data->uart_buf, rxlen);
        for (i = 0; i < rxlen; i++) {
-//#if NEURONSPI_DETAILED_DEBUG > 2
+#if NEURONSPI_DETAILED_DEBUG > 2
                printk(KERN_INFO "NEURONSPI: UART Char Read: %x\n", d_data->uart_buf[i]);
-//#endif
+#endif
        }
 }
 
@@ -323,7 +322,9 @@ 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);
+#if NEURONSPI_DETAILED_DEBUG > 0
        printk(KERN_INFO "NEURONSPI UART_HANDLE_TX A, to_send:%d\n", to_send);
+#endif
        if (likely(to_send)) {
                /* Limit to size of (TX FIFO / 2) */
                max_txlen = NEURONSPI_FIFO_SIZE >> 2;
@@ -339,7 +340,9 @@ 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);
+#if NEURONSPI_DETAILED_DEBUG > 0
                        printk(KERN_INFO "NEURONSPI UART_HANDLE_TX B, to_send:%d\n", to_send_packet);
+#endif
                        neuronspi_uart_fifo_write(port, to_send_packet);
                        spin_lock_irqsave(&port->port.lock, flags);
                        to_send = uart_circ_chars_pending(xmit);
@@ -356,7 +359,9 @@ 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);
+#if NEURONSPI_DETAILED_DEBUG > 0
                printk(KERN_INFO "NEURONSPI UART_HANDLE_TX C, to_send:%d\n", to_send_packet);
+#endif
                neuronspi_uart_fifo_write(port, to_send_packet);
        }
 
@@ -450,7 +455,9 @@ s32 neuronspi_uart_probe(struct spi_device* dev, u8 device_index)
                kthread_init_work(&(uart_data->p[i].rx_work), neuronspi_uart_rx_proc);
                kthread_init_work(&(uart_data->p[i].irq_work), neuronspi_uart_ist);
                uart_add_one_port(driver_data->serial_driver, &uart_data->p[i].port);
+#if NEURONSPI_DETAILED_DEBUG > 0
                printk(KERN_INFO "NEURONSPI: Added UART port %d\n", i);
+#endif
        }
 
        // For ports on multiple SPI devices renumber the ports to correspond to SPI chip-select numbering
@@ -579,7 +586,9 @@ void neuronspi_uart_start_tx(struct uart_port *port)
        printk(KERN_INFO "NEURONSPI: Start TX\n");
 #endif
        if (!kthread_queue_work(&n_port->parent->kworker, &n_port->tx_work)) {
+#if NEURONSPI_DETAILED_DEBUG > 0
                printk(KERN_INFO "NEURONSPI: TX WORK OVERFLOW\n");
+#endif
        }
 }
 
index 024b8d69b88b55bc0499ef914b8e571fc055184c..62893fc23a9d616f2dfbb4ab0924c23d5f1b8cbe 100644 (file)
@@ -1 +1 @@
-Repository:neuron-kernel ActiveBranch:[uart_timeout] PrecedingRelease:v.0.12 PrecedingRevision:79(399f005) LatestCommit:Wed Jul 4 14:41:13 CEST 2018
+Repository:neuron-kernel ActiveBranch:[uart_timeout] PrecedingRelease:v.0.12 PrecedingRevision:80(7ebe7c2) LatestCommit:Wed Jul 4 14:56:23 CEST 2018