From 0b7db8fbf66e3e27e423e7fb0085ff1b799b4986 Mon Sep 17 00:00:00 2001 From: Miroslav Ondra Date: Sat, 6 Feb 2021 14:08:15 +0100 Subject: [PATCH] Fix compilation warnings in rtc-unipi.c --- modules/rtc-unipi/rtc-unipi.c | 23 +++++++++++------------ modules/unipi/src/unipi_spi.c | 4 ++++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/modules/rtc-unipi/rtc-unipi.c b/modules/rtc-unipi/rtc-unipi.c index 51b6f19..ba11839 100644 --- a/modules/rtc-unipi/rtc-unipi.c +++ b/modules/rtc-unipi/rtc-unipi.c @@ -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); diff --git a/modules/unipi/src/unipi_spi.c b/modules/unipi/src/unipi_spi.c index 959e431..7a350af 100644 --- a/modules/unipi/src/unipi_spi.c +++ b/modules/unipi/src/unipi_spi.c @@ -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; -- 2.34.1