Skip to content
This repository has been archived by the owner on Mar 27, 2022. It is now read-only.

Commit

Permalink
Fix for kernel 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
gordboy committed Mar 18, 2020
1 parent 08f31ca commit 49e98ff
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Only supports 8812AU chipset.

Works fine with 5.3.11 kernel. Source now builds with no warnings or errors.
Works fine with 5.6.rc5 kernel. Source now builds with no warnings or errors.

Added (cosmeticly edited) original Realtek_Changelog.txt, this README.md and dkms.conf.

Expand Down
113 changes: 96 additions & 17 deletions os_dep/linux/rtw_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand All @@ -247,14 +271,15 @@ 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,
.llseek = seq_lseek,
.release = single_release,
.write = rtw_drv_proc_write,
};
#endif

int rtw_drv_proc_init(void)
{
Expand All @@ -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;

Expand Down Expand Up @@ -4158,7 +4183,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,
Expand All @@ -4167,14 +4209,15 @@ 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,
.llseek = seq_lseek,
.release = single_release,
.write = rtw_adapter_proc_write,
};
#endif

int proc_get_odm_adaptivity(struct seq_file *m, void *v)
{
Expand Down Expand Up @@ -4327,7 +4370,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,
Expand All @@ -4336,14 +4396,15 @@ 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,
.llseek = seq_lseek,
.release = single_release,
.write = rtw_odm_proc_write,
};
#endif

struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev)
{
Expand Down Expand Up @@ -4372,9 +4433,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;

Expand Down Expand Up @@ -4468,7 +4529,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,
Expand All @@ -4477,14 +4555,15 @@ 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,
.llseek = seq_lseek,
.release = single_release,
.write = rtw_mcc_proc_write,
};
#endif

struct proc_dir_entry *rtw_mcc_proc_init(struct net_device *dev)
{
Expand Down Expand Up @@ -4513,9 +4592,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;

Expand Down Expand Up @@ -4578,9 +4657,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;

Expand Down

0 comments on commit 49e98ff

Please sign in to comment.