From f4acdf8c42c3ea27cee8f195a1aabf1f100a4c6e Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Sun, 27 Dec 2020 14:55:43 +0100 Subject: [PATCH] lantiq: ltq-vdsl-mei: add kernel 5.10 compatiblity proc_create_data() expects a struct of type proc_ops. Signed-off-by: Mathias Kresin --- .../ltq-vdsl-mei/patches/100-compat.patch | 76 +++++++++++++++++-- .../patches/101_no-date-time.patch | 2 +- 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/package/kernel/lantiq/ltq-vdsl-mei/patches/100-compat.patch b/package/kernel/lantiq/ltq-vdsl-mei/patches/100-compat.patch index e9584098ee..75e1500171 100644 --- a/package/kernel/lantiq/ltq-vdsl-mei/patches/100-compat.patch +++ b/package/kernel/lantiq/ltq-vdsl-mei/patches/100-compat.patch @@ -43,7 +43,45 @@ #ifdef MODULE #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) MODULE_PARM(major_number, "b"); -@@ -2174,9 +2178,11 @@ static int MEI_module_init (void) +@@ -1479,7 +1483,11 @@ struct proc_entry { + char name[32]; + proc_rd_callback_t rd; + proc_wr_callback_t wr; ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0)) + struct file_operations ops; ++#else ++ struct proc_ops ops; ++#endif + int entity; + }; + +@@ -1869,6 +1877,7 @@ static int mei_proc_single_open(struct i + static void mei_proc_entry_create(struct proc_dir_entry *parent_node, + struct proc_entry *proc_entry) + { ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0)) + memset(&proc_entry->ops, 0, sizeof(struct file_operations)); + proc_entry->ops.owner = THIS_MODULE; + +@@ -1879,6 +1888,17 @@ static void mei_proc_entry_create(struct + proc_entry->ops.llseek = seq_lseek; + if (proc_entry->wr) + proc_entry->ops.write = proc_entry->wr; ++#else ++ memset(&proc_entry->ops, 0, sizeof(struct proc_ops)); ++ ++ proc_entry->ops.proc_open = mei_proc_single_open; ++ proc_entry->ops.proc_release = single_release; ++ ++ proc_entry->ops.proc_read = seq_read; ++ proc_entry->ops.proc_lseek = seq_lseek; ++ if (proc_entry->wr) ++ proc_entry->ops.proc_write = proc_entry->wr; ++#endif + + proc_create_data(proc_entry->name, + (S_IFREG | S_IRUGO), +@@ -2174,9 +2194,11 @@ static int MEI_module_init (void) return (result); } @@ -55,7 +93,7 @@ return 0; } -@@ -2304,6 +2310,10 @@ static void MEI_module_exit (void) +@@ -2304,6 +2326,10 @@ static void MEI_module_exit (void) #else unregister_chrdev ( major_number , DRV_MEI_NAME ); @@ -66,7 +104,7 @@ #endif #if CONFIG_PROC_FS -@@ -2388,9 +2398,11 @@ static void MEI_module_exit (void) +@@ -2388,9 +2414,11 @@ static void MEI_module_exit (void) ("MEI_DRV: Chipset Basic Exit failed" MEI_DRV_CRLF)); } @@ -78,7 +116,7 @@ #if (MEI_SUPPORT_DEBUG_LOGGER == 1) if (nl_debug_sock) -@@ -2514,6 +2526,10 @@ static int MEI_InitModuleRegCharDev(cons +@@ -2514,6 +2542,10 @@ static int MEI_InitModuleRegCharDev(cons ("Using major number %d" MEI_DRV_CRLF, major_number)); } @@ -89,7 +127,7 @@ return 0; #endif /* CONFIG_DEVFS_FS */ } -@@ -2563,21 +2579,32 @@ static int MEI_InitModuleBasics(void) +@@ -2563,21 +2595,32 @@ static int MEI_InitModuleBasics(void) } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) @@ -122,7 +160,7 @@ return 0; } -@@ -2905,11 +2932,15 @@ IFX_int32_t MEI_IoctlInitDevice( +@@ -2905,11 +2948,15 @@ IFX_int32_t MEI_IoctlInitDevice( pMeiDev->eModePoll = e_MEI_DEV_ACCESS_MODE_IRQ; pMeiDev->intMask = ME_ARC2ME_INTERRUPT_UNMASK_ALL; @@ -366,3 +404,29 @@ } #endif +--- a/src/drv_mei_cpe_linux_proc_config.c ++++ b/src/drv_mei_cpe_linux_proc_config.c +@@ -1039,6 +1039,7 @@ static int mei_proc_single_open(struct i + return single_open(file, mei_seq_single_show, PDE_DATA(inode)); + } + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0)) + static struct file_operations proc_ops = { + .owner = THIS_MODULE, + .open = mei_proc_single_open, +@@ -1047,6 +1048,15 @@ static struct file_operations proc_ops = + .llseek = seq_lseek, + .write = MEI_ProcWriteConfig + }; ++#else ++static struct proc_ops proc_ops = { ++ .proc_open = mei_proc_single_open, ++ .proc_release = single_release, ++ .proc_read = seq_read, ++ .proc_lseek = seq_lseek, ++ .proc_write = MEI_ProcWriteConfig ++}; ++#endif + + /** + Create an read/write proc entry for configuration. diff --git a/package/kernel/lantiq/ltq-vdsl-mei/patches/101_no-date-time.patch b/package/kernel/lantiq/ltq-vdsl-mei/patches/101_no-date-time.patch index 2cb22d4a8a..055797ad4d 100644 --- a/package/kernel/lantiq/ltq-vdsl-mei/patches/101_no-date-time.patch +++ b/package/kernel/lantiq/ltq-vdsl-mei/patches/101_no-date-time.patch @@ -1,6 +1,6 @@ --- a/src/drv_mei_cpe_linux.c +++ b/src/drv_mei_cpe_linux.c -@@ -1499,8 +1499,8 @@ struct proc_entry { +@@ -1503,8 +1503,8 @@ struct proc_entry { static void MEI_GetVersionProc(struct seq_file *s) { seq_printf(s, "%s" MEI_DRV_CRLF, &MEI_WHATVERSION[4]);