Merge pull request #175 from CGarces/fix_Warnings

Fix compilation warnings on kernels >=5.6
This commit is contained in:
Carlos Garcés 2020-04-26 13:44:11 +02:00 committed by GitHub
commit 357550005c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 81 additions and 10 deletions

View File

@ -1,23 +1,15 @@
EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS) EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS)
##################### Optimization Flags ########################## ##################### Optimization Flags ##########################
#EXTRA_CFLAGS += -O1
EXTRA_CFLAGS += -O2 EXTRA_CFLAGS += -O2
#EXTRA_CFLAGS += -O3
##################### Compile-time Warnings ####################### ##################### Compile-time Warnings #######################
#EXTRA_CFLAGS += -Wall
#EXTRA_CFLAGS += -Wextra
#EXTRA_CFLAGS += -Werror
#EXTRA_CFLAGS += -pedantic
#EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
#EXTRA_CFLAGS += -Wno-uninitialized
EXTRA_CFLAGS += -Wno-unused-variable EXTRA_CFLAGS += -Wno-unused-variable
EXTRA_CFLAGS += -Wno-unused-value EXTRA_CFLAGS += -Wno-unused-value
EXTRA_CFLAGS += -Wno-unused-label EXTRA_CFLAGS += -Wno-unused-label
EXTRA_CFLAGS += -Wno-unused-parameter EXTRA_CFLAGS += -Wno-unused-parameter
EXTRA_CFLAGS += -Wno-unused-function EXTRA_CFLAGS += -Wno-unused-function
EXTRA_CFLAGS += -Wno-unused EXTRA_CFLAGS += -Wno-unused
EXTRA_CFLAGS += -Wno-incompatible-pointer-types #EXTRA_CFLAGS += -Wno-incompatible-pointer-types
EXTRA_CFLAGS += -Wno-date-time EXTRA_CFLAGS += -Wno-date-time
GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc ) GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )

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, 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; 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; return -EROFS;
} }
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
static const struct file_operations rtw_drv_proc_seq_fops = { static const struct file_operations rtw_drv_proc_seq_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = rtw_drv_proc_open, .open = rtw_drv_proc_open,
@ -255,6 +261,23 @@ static const struct file_operations rtw_drv_proc_sseq_fops = {
.release = single_release, .release = single_release,
.write = rtw_drv_proc_write, .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) 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; return -EROFS;
} }
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
static const struct file_operations rtw_adapter_proc_seq_fops = { static const struct file_operations rtw_adapter_proc_seq_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = rtw_adapter_proc_open, .open = rtw_adapter_proc_open,
@ -4163,6 +4187,23 @@ static const struct file_operations rtw_adapter_proc_sseq_fops = {
.release = single_release, .release = single_release,
.write = rtw_adapter_proc_write, .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) 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; return -EROFS;
} }
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
static const struct file_operations rtw_odm_proc_seq_fops = { static const struct file_operations rtw_odm_proc_seq_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = rtw_odm_proc_open, .open = rtw_odm_proc_open,
@ -4332,6 +4374,23 @@ static const struct file_operations rtw_odm_proc_sseq_fops = {
.release = single_release, .release = single_release,
.write = rtw_odm_proc_write, .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) 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; return -EROFS;
} }
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
static const struct file_operations rtw_mcc_proc_seq_fops = { static const struct file_operations rtw_mcc_proc_seq_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = rtw_mcc_proc_open, .open = rtw_mcc_proc_open,
@ -4473,6 +4533,25 @@ static const struct file_operations rtw_mcc_proc_sseq_fops = {
.release = single_release, .release = single_release,
.write = rtw_mcc_proc_write, .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) struct proc_dir_entry *rtw_mcc_proc_init(struct net_device *dev)
{ {