Fix compilation warnings in rtc-unipi.c
authorMiroslav Ondra <ondra@faster.cz>
Sat, 6 Feb 2021 13:08:15 +0000 (14:08 +0100)
committerMiroslav Ondra <ondra@faster.cz>
Sat, 6 Feb 2021 13:08:15 +0000 (14:08 +0100)
modules/rtc-unipi/rtc-unipi.c
modules/unipi/src/unipi_spi.c

index 51b6f19c11d7c81f8be963383fc617f4db986bf0..ba11839d2d4f212a87383d0fb85d043f357ea01f 100644 (file)
@@ -496,6 +496,17 @@ 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)
+    struct nvmem_config nvmem_cfg = {
+               .name = "rtc_unipi_nvram",
+               .word_size = 1,
+               .stride = 1,
+               .size = MCP794XX_NVRAM_SIZE,
+               .reg_read = rtc_unipi_nvram_read,
+               .reg_write = rtc_unipi_nvram_write,
+               .priv = rtc_unipi,
+    };
+#endif
 
        rtc_unipi = devm_kzalloc(&client->dev, sizeof(struct rtc_unipi), GFP_KERNEL);
        if (!rtc_unipi)
@@ -650,7 +661,6 @@ read_rtc:
        }
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,17,0)
-       /*if (chip->nvram_size) {*/
                rtc_unipi->nvmem_cfg.name = "rtc_unipi_nvram";
                rtc_unipi->nvmem_cfg.word_size = 1;
                rtc_unipi->nvmem_cfg.stride = 1;
@@ -661,18 +671,7 @@ read_rtc:
 
                rtc_unipi->rtc->nvmem_config = &rtc_unipi->nvmem_cfg;
                rtc_unipi->rtc->nvram_old_abi = true;
-       /*}*/
 #else
-           struct nvmem_config nvmem_cfg = {
-               .name = "rtc_unipi_nvram",
-               .word_size = 1,
-               .stride = 1,
-               .size = MCP794XX_NVRAM_SIZE,
-               .reg_read = rtc_unipi_nvram_read,
-               .reg_write = rtc_unipi_nvram_write,
-               .priv = rtc_unipi,
-           };
-
            rtc_unipi->rtc->nvram_old_abi = true;
            rtc_nvmem_register(rtc_unipi->rtc, &nvmem_cfg);
 
index 959e4317e2e1477769adf7bb6ebfdf604fda9a7c..7a350af5af0fc5d63d737dcbb2e1a5b4b4c4426e 100644 (file)
@@ -71,7 +71,9 @@ struct task_struct *neuronspi_invalidate_thread;
 
 static u8 neuronspi_probe_count = 0;
 static struct spinlock *neuronspi_probe_spinlock;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0)
 static struct sched_param neuronspi_sched_param = { .sched_priority = MAX_RT_PRIO / 2 };
+#endif
 
 struct neuronspi_char_driver neuronspi_cdrv =
 {
@@ -1217,7 +1219,9 @@ 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;