add proc_ops for kernel 5.6

This commit is contained in:
Carlos Garces 2020-04-26 13:24:18 +02:00
parent d3c6644e10
commit 02e23dbf71

View File

@ -62,7 +62,12 @@ inline struct proc_dir_entry *rtw_proc_create_dir(const char *name, struct proc_
}
inline struct proc_dir_entry *rtw_proc_create_entry(const char *name, struct proc_dir_entry *parent,
const struct file_operations *fops, void * data)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
const struct file_operations *fops,
#else
const struct proc_ops *fops,
#endif
void * data)
{
struct proc_dir_entry *entry;
@ -238,6 +243,7 @@ static ssize_t rtw_drv_proc_write(struct file *file, const char __user *buffer,
return -EROFS;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
static const struct file_operations rtw_drv_proc_seq_fops = {
.owner = THIS_MODULE,
.open = rtw_drv_proc_open,
@ -255,6 +261,23 @@ static const struct file_operations rtw_drv_proc_sseq_fops = {
.release = single_release,
.write = rtw_drv_proc_write,
};
#else
static const struct proc_ops rtw_drv_proc_seq_fops = {
.proc_open = rtw_drv_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = seq_release,
.proc_write = rtw_drv_proc_write,
};
static const struct proc_ops rtw_drv_proc_sseq_fops = {
.proc_open = rtw_drv_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = rtw_drv_proc_write,
};
#endif
int rtw_drv_proc_init(void)
{
@ -4146,6 +4169,7 @@ static ssize_t rtw_adapter_proc_write(struct file *file, const char __user *buff
return -EROFS;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
static const struct file_operations rtw_adapter_proc_seq_fops = {
.owner = THIS_MODULE,
.open = rtw_adapter_proc_open,
@ -4163,6 +4187,23 @@ static const struct file_operations rtw_adapter_proc_sseq_fops = {
.release = single_release,
.write = rtw_adapter_proc_write,
};
#else
static const struct proc_ops rtw_adapter_proc_seq_fops = {
.proc_open = rtw_adapter_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = seq_release,
.proc_write = rtw_adapter_proc_write,
};
static const struct proc_ops rtw_adapter_proc_sseq_fops = {
.proc_open = rtw_adapter_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = rtw_adapter_proc_write,
};
#endif
int proc_get_odm_adaptivity(struct seq_file *m, void *v)
{
@ -4315,6 +4356,7 @@ static ssize_t rtw_odm_proc_write(struct file *file, const char __user *buffer,
return -EROFS;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
static const struct file_operations rtw_odm_proc_seq_fops = {
.owner = THIS_MODULE,
.open = rtw_odm_proc_open,
@ -4332,6 +4374,23 @@ static const struct file_operations rtw_odm_proc_sseq_fops = {
.release = single_release,
.write = rtw_odm_proc_write,
};
#else
static const struct proc_ops rtw_odm_proc_seq_fops = {
.proc_open = rtw_odm_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = seq_release,
.proc_write = rtw_odm_proc_write,
};
static const struct proc_ops rtw_odm_proc_sseq_fops = {
.proc_open = rtw_odm_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = rtw_odm_proc_write,
};
#endif
struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev)
{
@ -4456,6 +4515,7 @@ static ssize_t rtw_mcc_proc_write(struct file *file, const char __user *buffer,
return -EROFS;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
static const struct file_operations rtw_mcc_proc_seq_fops = {
.owner = THIS_MODULE,
.open = rtw_mcc_proc_open,
@ -4473,6 +4533,25 @@ static const struct file_operations rtw_mcc_proc_sseq_fops = {
.release = single_release,
.write = rtw_mcc_proc_write,
};
#else
static const struct proc_ops rtw_mcc_proc_seq_fops = {
.proc_owner = THIS_MODULE,
.proc_open = rtw_mcc_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = seq_release,
.proc_write = rtw_mcc_proc_write,
};
static const struct proc_ops rtw_mcc_proc_sseq_fops = {
.proc_owner = THIS_MODULE,
.proc_open = rtw_mcc_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = rtw_mcc_proc_write,
};
#endif
struct proc_dir_entry *rtw_mcc_proc_init(struct net_device *dev)
{