lantiq: ltq-vdsl-mei: add kernel 5.10 compatiblity

proc_create_data() expects a struct of type proc_ops.

Signed-off-by: Mathias Kresin <dev@kresin.me>
This commit is contained in:
Mathias Kresin 2020-12-27 14:55:43 +01:00
parent 3bad9b0e87
commit f4acdf8c42
2 changed files with 71 additions and 7 deletions

View File

@ -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.

View File

@ -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]);