1
0
mirror of https://github.com/aircrack-ng/rtl8812au.git synced 2024-11-22 13:24:36 +00:00

Add kernel v5.6 support

This commit is contained in:
kimocoder 2020-03-08 06:16:31 +00:00
parent 1bf08b78b1
commit 19398a4630

View File

@ -61,12 +61,19 @@ inline struct proc_dir_entry *rtw_proc_create_dir(const char *name, struct proc_
return entry;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
inline struct proc_dir_entry *rtw_proc_create_entry(const char *name, struct proc_dir_entry *parent,
const struct proc_ops *pops, void * data)
#else
inline struct proc_dir_entry *rtw_proc_create_entry(const char *name, struct proc_dir_entry *parent,
const struct file_operations *fops, void * data)
#endif
{
struct proc_dir_entry *entry;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUGO, parent, pops, data);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26))
entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUGO, parent, fops, data);
#else
entry = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUGO, parent);
@ -238,7 +245,24 @@ static ssize_t rtw_drv_proc_write(struct file *file, const char __user *buffer,
return -EROFS;
}
static const struct file_operations rtw_drv_proc_seq_fops = {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
static const struct proc_ops rtw_drv_proc_seq_ops = {
.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_ops = {
.proc_open = rtw_drv_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = rtw_drv_proc_write,
};
#else
static const struct file_operations rtw_drv_proc_seq_ops = {
.owner = THIS_MODULE,
.open = rtw_drv_proc_open,
.read = seq_read,
@ -247,7 +271,7 @@ static const struct file_operations rtw_drv_proc_seq_fops = {
.write = rtw_drv_proc_write,
};
static const struct file_operations rtw_drv_proc_sseq_fops = {
static const struct file_operations rtw_drv_proc_sseq_ops = {
.owner = THIS_MODULE,
.open = rtw_drv_proc_open,
.read = seq_read,
@ -255,6 +279,7 @@ static const struct file_operations rtw_drv_proc_sseq_fops = {
.release = single_release,
.write = rtw_drv_proc_write,
};
#endif
int rtw_drv_proc_init(void)
{
@ -276,9 +301,9 @@ int rtw_drv_proc_init(void)
for (i = 0; i < drv_proc_hdls_num; i++) {
if (drv_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SEQ)
entry = rtw_proc_create_entry(drv_proc_hdls[i].name, rtw_proc, &rtw_drv_proc_seq_fops, (void *)i);
entry = rtw_proc_create_entry(drv_proc_hdls[i].name, rtw_proc, &rtw_drv_proc_seq_ops, (void *)i);
else if (drv_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SSEQ)
entry = rtw_proc_create_entry(drv_proc_hdls[i].name, rtw_proc, &rtw_drv_proc_sseq_fops, (void *)i);
entry = rtw_proc_create_entry(drv_proc_hdls[i].name, rtw_proc, &rtw_drv_proc_sseq_ops, (void *)i);
else
entry = NULL;
@ -3633,7 +3658,7 @@ static void tpt_mode_default(struct _ADAPTER *adapter)
dvobj->scan_deny = _FALSE;
/* 2. back to original LPS mode */
#ifdef CONFIG_LPS
#ifdef CONFIG_LPS
rtw_pm_set_lps(adapter, adapter->registrypriv.power_mgnt);
#endif
@ -3648,7 +3673,7 @@ static void rtw_tpt_mode(struct _ADAPTER *adapter)
if (dvobj->tpt_mode > 0) {
/* when enable each tpt mode
/* when enable each tpt mode
1. scan deny
2. disable LPS */
@ -4162,7 +4187,24 @@ static ssize_t rtw_adapter_proc_write(struct file *file, const char __user *buff
return -EROFS;
}
static const struct file_operations rtw_adapter_proc_seq_fops = {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
static const struct proc_ops rtw_adapter_proc_seq_ops = {
.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_ops = {
.proc_open = rtw_adapter_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = rtw_adapter_proc_write,
};
#else
static const struct file_operations rtw_adapter_proc_seq_ops = {
.owner = THIS_MODULE,
.open = rtw_adapter_proc_open,
.read = seq_read,
@ -4171,7 +4213,7 @@ static const struct file_operations rtw_adapter_proc_seq_fops = {
.write = rtw_adapter_proc_write,
};
static const struct file_operations rtw_adapter_proc_sseq_fops = {
static const struct file_operations rtw_adapter_proc_sseq_ops = {
.owner = THIS_MODULE,
.open = rtw_adapter_proc_open,
.read = seq_read,
@ -4179,6 +4221,7 @@ static const struct file_operations rtw_adapter_proc_sseq_fops = {
.release = single_release,
.write = rtw_adapter_proc_write,
};
#endif
int proc_get_odm_adaptivity(struct seq_file *m, void *v)
{
@ -4331,7 +4374,24 @@ static ssize_t rtw_odm_proc_write(struct file *file, const char __user *buffer,
return -EROFS;
}
static const struct file_operations rtw_odm_proc_seq_fops = {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
static const struct proc_ops rtw_odm_proc_seq_ops = {
.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_ops = {
.proc_open = rtw_odm_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = rtw_odm_proc_write,
};
#else
static const struct file_operations rtw_odm_proc_seq_ops = {
.owner = THIS_MODULE,
.open = rtw_odm_proc_open,
.read = seq_read,
@ -4340,7 +4400,7 @@ static const struct file_operations rtw_odm_proc_seq_fops = {
.write = rtw_odm_proc_write,
};
static const struct file_operations rtw_odm_proc_sseq_fops = {
static const struct file_operations rtw_odm_proc_sseq_ops = {
.owner = THIS_MODULE,
.open = rtw_odm_proc_open,
.read = seq_read,
@ -4348,6 +4408,7 @@ static const struct file_operations rtw_odm_proc_sseq_fops = {
.release = single_release,
.write = rtw_odm_proc_write,
};
#endif
struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev)
{
@ -4376,9 +4437,9 @@ struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev)
for (i = 0; i < odm_proc_hdls_num; i++) {
if (odm_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SEQ)
entry = rtw_proc_create_entry(odm_proc_hdls[i].name, dir_odm, &rtw_odm_proc_seq_fops, (void *)i);
entry = rtw_proc_create_entry(odm_proc_hdls[i].name, dir_odm, &rtw_odm_proc_seq_ops, (void *)i);
else if (odm_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SSEQ)
entry = rtw_proc_create_entry(odm_proc_hdls[i].name, dir_odm, &rtw_odm_proc_sseq_fops, (void *)i);
entry = rtw_proc_create_entry(odm_proc_hdls[i].name, dir_odm, &rtw_odm_proc_sseq_ops, (void *)i);
else
entry = NULL;
@ -4472,7 +4533,24 @@ static ssize_t rtw_mcc_proc_write(struct file *file, const char __user *buffer,
return -EROFS;
}
static const struct file_operations rtw_mcc_proc_seq_fops = {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
static const struct proc_ops rtw_mcc_proc_seq_ops = {
.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 file_operations rtw_mcc_proc_sseq_ops = {
.proc_open = rtw_mcc_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
.proc_write = rtw_mcc_proc_write,
};
#else
static const struct file_operations rtw_mcc_proc_seq_ops = {
.owner = THIS_MODULE,
.open = rtw_mcc_proc_open,
.read = seq_read,
@ -4481,7 +4559,7 @@ static const struct file_operations rtw_mcc_proc_seq_fops = {
.write = rtw_mcc_proc_write,
};
static const struct file_operations rtw_mcc_proc_sseq_fops = {
static const struct file_operations rtw_mcc_proc_sseq_ops = {
.owner = THIS_MODULE,
.open = rtw_mcc_proc_open,
.read = seq_read,
@ -4489,6 +4567,7 @@ static const struct file_operations rtw_mcc_proc_sseq_fops = {
.release = single_release,
.write = rtw_mcc_proc_write,
};
#endif
struct proc_dir_entry *rtw_mcc_proc_init(struct net_device *dev)
{
@ -4517,9 +4596,9 @@ struct proc_dir_entry *rtw_mcc_proc_init(struct net_device *dev)
for (i = 0; i < mcc_proc_hdls_num; i++) {
if (mcc_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SEQ)
entry = rtw_proc_create_entry(mcc_proc_hdls[i].name, dir_mcc, &rtw_mcc_proc_seq_fops, (void *)i);
entry = rtw_proc_create_entry(mcc_proc_hdls[i].name, dir_mcc, &rtw_mcc_proc_seq_ops, (void *)i);
else if (mcc_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SSEQ)
entry = rtw_proc_create_entry(mcc_proc_hdls[i].name, dir_mcc, &rtw_mcc_proc_sseq_fops, (void *)i);
entry = rtw_proc_create_entry(mcc_proc_hdls[i].name, dir_mcc, &rtw_mcc_proc_sseq_ops, (void *)i);
else
entry = NULL;
@ -4582,9 +4661,9 @@ struct proc_dir_entry *rtw_adapter_proc_init(struct net_device *dev)
for (i = 0; i < adapter_proc_hdls_num; i++) {
if (adapter_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SEQ)
entry = rtw_proc_create_entry(adapter_proc_hdls[i].name, dir_dev, &rtw_adapter_proc_seq_fops, (void *)i);
entry = rtw_proc_create_entry(adapter_proc_hdls[i].name, dir_dev, &rtw_adapter_proc_seq_ops, (void *)i);
else if (adapter_proc_hdls[i].type == RTW_PROC_HDL_TYPE_SSEQ)
entry = rtw_proc_create_entry(adapter_proc_hdls[i].name, dir_dev, &rtw_adapter_proc_sseq_fops, (void *)i);
entry = rtw_proc_create_entry(adapter_proc_hdls[i].name, dir_dev, &rtw_adapter_proc_sseq_ops, (void *)i);
else
entry = NULL;