rtl8188eu: Add new device and fix build for kernel 5.6

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
fiadosau 2020-03-03 23:59:05 +03:00 committed by Larry Finger
parent f86165a975
commit 8078d7b180
2 changed files with 69 additions and 2 deletions

View file

@ -52,12 +52,19 @@ inline struct proc_dir_entry *rtw_proc_create_dir(const char *name, struct proc_
return entry; 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 *fops, void * data)
#else
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) const struct file_operations *fops, void * data)
#endif
{ {
struct proc_dir_entry *entry; 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, fops, data);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26))
entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUGO, parent, fops, data); entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUGO, parent, fops, data);
#else #else
entry = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUGO, parent); entry = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUGO, parent);
@ -203,6 +210,15 @@ 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 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,
};
#else
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,
@ -211,7 +227,17 @@ static const struct file_operations rtw_drv_proc_seq_fops = {
.release = seq_release, .release = seq_release,
.write = rtw_drv_proc_write, .write = rtw_drv_proc_write,
}; };
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
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,
};
#else
static const struct file_operations rtw_drv_proc_sseq_fops = { static const struct file_operations rtw_drv_proc_sseq_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = rtw_drv_proc_open, .open = rtw_drv_proc_open,
@ -220,6 +246,7 @@ 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,
}; };
#endif
int rtw_drv_proc_init(void) int rtw_drv_proc_init(void)
{ {
@ -2516,6 +2543,15 @@ 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 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,
};
#else
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,
@ -2524,7 +2560,17 @@ static const struct file_operations rtw_adapter_proc_seq_fops = {
.release = seq_release, .release = seq_release,
.write = rtw_adapter_proc_write, .write = rtw_adapter_proc_write,
}; };
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
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,
};
#else
static const struct file_operations rtw_adapter_proc_sseq_fops = { static const struct file_operations rtw_adapter_proc_sseq_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = rtw_adapter_proc_open, .open = rtw_adapter_proc_open,
@ -2533,7 +2579,7 @@ 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,
}; };
#endif
static int proc_get_odm_force_igi_lb(struct seq_file *m, void *v) static int proc_get_odm_force_igi_lb(struct seq_file *m, void *v)
{ {
@ -2815,6 +2861,15 @@ 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 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,
};
#else
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,
@ -2823,7 +2878,17 @@ static const struct file_operations rtw_odm_proc_seq_fops = {
.release = seq_release, .release = seq_release,
.write = rtw_odm_proc_write, .write = rtw_odm_proc_write,
}; };
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
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,
};
#else
static const struct file_operations rtw_odm_proc_sseq_fops = { static const struct file_operations rtw_odm_proc_sseq_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = rtw_odm_proc_open, .open = rtw_odm_proc_open,
@ -2832,6 +2897,7 @@ 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,
}; };
#endif
static struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev) static struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev)
{ {

View file

@ -123,6 +123,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
{USB_DEVICE(0x056E, 0x4008), .driver_info = RTL8188E}, /* Elecom WDC-150SU2M */ {USB_DEVICE(0x056E, 0x4008), .driver_info = RTL8188E}, /* Elecom WDC-150SU2M */
{USB_DEVICE(0x2357, 0x010c), .driver_info = RTL8188E}, /* TP-Link TL-WN722N v2 */ {USB_DEVICE(0x2357, 0x010c), .driver_info = RTL8188E}, /* TP-Link TL-WN722N v2 */
{USB_DEVICE(0x2357, 0x0111), .driver_info = RTL8188E}, /* TP-Link TL-WN727N v5.21 */ {USB_DEVICE(0x2357, 0x0111), .driver_info = RTL8188E}, /* TP-Link TL-WN727N v5.21 */
{USB_DEVICE(0x2C4E, 0x0102), .driver_info = RTL8188E}, /* MERCUSYS MW150US v2 */
{} /* Terminating entry */ {} /* Terminating entry */
}; };