From: Miroslav Ondra Date: Sat, 6 Feb 2021 13:15:21 +0000 (+0100) Subject: Clean the code X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=ce4cde00fa379aa5183e3e33fbf0aa172d979555;p=graphit%2Funipi-kernel.git Clean the code --- diff --git a/modules/rtc-unipi/rtc-unipi.c b/modules/rtc-unipi/rtc-unipi.c index ba11839..45aaa43 100644 --- a/modules/rtc-unipi/rtc-unipi.c +++ b/modules/rtc-unipi/rtc-unipi.c @@ -496,7 +496,8 @@ static int rtc_unipi_probe(struct i2c_client *client, /*struct rtc_unipi_platform_data *pdata = dev_get_platdata(&client->dev);*/ struct rtc_time tm; unsigned long timestamp; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,17,0) +#else struct nvmem_config nvmem_cfg = { .name = "rtc_unipi_nvram", .word_size = 1, diff --git a/modules/unipi/src/unipi_spi.c b/modules/unipi/src/unipi_spi.c index 7a350af..0b829b1 100644 --- a/modules/unipi/src/unipi_spi.c +++ b/modules/unipi/src/unipi_spi.c @@ -1219,9 +1219,6 @@ s32 neuronspi_spi_probe(struct spi_device *spi) u32 probe_always_succeeds = 0; u32 always_create_uart = 0; struct kthread_worker *worker; -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) - struct sched_param rt_param = { .sched_priority = MAX_RT_PRIO - 1 }; -#endif unsigned long flags; @@ -1316,7 +1313,7 @@ s32 neuronspi_spi_probe(struct spi_device *spi) no_irq = 1; printk(KERN_INFO "UNIPISPI: DUMMY UniPi Board at CS%d (nspi%d) assigned. Uarts:%d, uses freq. %d Hz\n", spi->chip_select, n_spi->neuron_index, uart_count, n_spi->ideal_frequency); - + } else { ret = -ENODEV; kfree(n_spi); @@ -1324,13 +1321,6 @@ s32 neuronspi_spi_probe(struct spi_device *spi) return ret; } - // Set rt priority to spi controller - //dev_info(&ctlr->dev, "will run message pump with realtime priority\n"); -#if 0 - /* replaced by spi->master->rt = 1 */ - if (spi->controller->kworker_task) - sched_setscheduler(spi->controller->kworker_task, SCHED_FIFO, &rt_param); -#endif if (spi->controller->set_cs != unipi_spi_set_cs) { unipi_spi_master_set_cs = spi->controller->set_cs; unipi_spi_master_flag = spi->controller->flags; @@ -1340,7 +1330,7 @@ s32 neuronspi_spi_probe(struct spi_device *spi) if (gpio_is_valid(spi->cs_gpio)) { spi->cs_gpio = -spi->cs_gpio; } - + // Prepare worker for interrupt, LEDs, UARTs worker = kthread_create_worker(0, "unipispi%d", n_spi->neuron_index); if (IS_ERR(worker)) {