From 4a837a3358ace6065512de510fd7ff921058342b Mon Sep 17 00:00:00 2001 From: Stefan Saraev Date: Mon, 1 Jul 2013 23:14:22 +0300 Subject: [PATCH] bcm_sta: add support for kernel 3.10 --- ...sta-010-add-support-for-linux-3.10.0.patch | 256 ++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100644 packages/linux-drivers/bcm_sta/patches/6.20.155.1/bcm_sta-010-add-support-for-linux-3.10.0.patch diff --git a/packages/linux-drivers/bcm_sta/patches/6.20.155.1/bcm_sta-010-add-support-for-linux-3.10.0.patch b/packages/linux-drivers/bcm_sta/patches/6.20.155.1/bcm_sta-010-add-support-for-linux-3.10.0.patch new file mode 100644 index 0000000000..e3b35a31c4 --- /dev/null +++ b/packages/linux-drivers/bcm_sta/patches/6.20.155.1/bcm_sta-010-add-support-for-linux-3.10.0.patch @@ -0,0 +1,256 @@ +diff --git a/x86-32/src/wl/sys/wl_linux.c b/x86-32/src/wl/sys/wl_linux.c +index 9ee69e1..409bda7 100644 +--- a/x86-32/src/wl/sys/wl_linux.c ++++ b/x86-32/src/wl/sys/wl_linux.c +@@ -2693,7 +2693,7 @@ wl_tkip_keyset(wl_info_t *wl, wsec_key_t *key) + void + wl_tkip_printstats(wl_info_t *wl, bool group_key) + { +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) + char debug_buf[512]; + int idx; + if (wl->tkipmodops) { +@@ -2855,6 +2855,7 @@ wl_linux_watchdog(void *ctx) + return 0; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) + static int + wl_proc_read(char *buffer, char **start, off_t offset, int length, int *eof, void *data) + { +@@ -2909,18 +2910,89 @@ wl_proc_write(struct file *filp, const char *buff, unsigned long length, void *d + return length; + } + ++#else ++ ++static int ++wl_proc_read(struct seq_file *seq, void *offset) ++{ ++ wl_info_t * wl = (wl_info_t *)seq->private; ++ int bcmerror, to_user; ++ ++ WL_LOCK(wl); ++ bcmerror = wlc_ioctl(wl->wlc, WLC_GET_MONITOR, &to_user, sizeof(int), NULL); ++ WL_UNLOCK(wl); ++ ++ seq_printf(seq, "%d\n", to_user); ++ return bcmerror; ++} ++ ++static ssize_t wl_proc_write(struct file *file, const char __user *buff, ++ size_t length, loff_t *ppos) ++{ ++ struct seq_file *seq = file->private_data; ++ wl_info_t * wl = (wl_info_t *)seq->private; ++ int bcmerror, from_user = 0; ++ ++ if (length != 1) { ++ WL_ERROR(("%s: Invalid data length\n", __FUNCTION__)); ++ return -EIO; ++ } ++ ++ if (copy_from_user(&from_user, buff, 1)) { ++ WL_ERROR(("%s: copy from user failed\n", __FUNCTION__)); ++ return -EFAULT; ++ } ++ ++ if (from_user >= 0x30) ++ from_user -= 0x30; ++ ++ WL_LOCK(wl); ++ bcmerror = wlc_ioctl(wl->wlc, WLC_SET_MONITOR, &from_user, sizeof(int), NULL); ++ WL_UNLOCK(wl); ++ ++ if (bcmerror < 0) { ++ WL_ERROR(("%s: SET_MONITOR failed with %d\n", __FUNCTION__, bcmerror)); ++ return -EIO; ++ } ++ *ppos += length; ++ return length; ++} ++ ++static int wl_proc_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, wl_proc_read, PDE_DATA(inode)); ++} ++ ++static const struct file_operations wl_proc_fops = { ++ .owner = THIS_MODULE, ++ .open = wl_proc_open, ++ .read = seq_read, ++ .write = wl_proc_write, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++#endif ++ + static int + wl_reg_proc_entry(wl_info_t *wl) + { + char tmp[32]; + sprintf(tmp, "%s%d", HYBRID_PROC, wl->pub->unit); +- if ((wl->proc_entry = create_proc_entry(tmp, 0644, NULL)) == NULL) { ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) ++ wl->proc_entry = create_proc_entry(tmp, 0644, NULL); ++ if (wl->proc_entry) { ++ wl->proc_entry->read_proc = wl_proc_read; ++ wl->proc_entry->write_proc = wl_proc_write; ++ wl->proc_entry->data = wl; ++ } ++#else ++ wl->proc_entry = proc_create_data(tmp, 0644, NULL, &wl_proc_fops, wl); ++#endif ++ if (!wl->proc_entry) { + WL_ERROR(("%s: create_proc_entry %s failed\n", __FUNCTION__, tmp)); + ASSERT(0); + return -1; + } +- wl->proc_entry->read_proc = wl_proc_read; +- wl->proc_entry->write_proc = wl_proc_write; +- wl->proc_entry->data = wl; + return 0; + } +diff --git a/x86-32/src/wl/sys/wl_linux.c.orig b/x86-32/src/wl/sys/wl_linux.c.orig +index 38206ab..9ee69e1 100644 +--- a/x86-32/src/wl/sys/wl_linux.c.orig ++++ b/x86-32/src/wl/sys/wl_linux.c.orig +@@ -219,7 +219,7 @@ module_param(nompc, int, 0); + #define quote_str(s) to_str(s) + + #ifndef BRCM_WLAN_IFNAME +-#define BRCM_WLAN_IFNAME eth%d ++#define BRCM_WLAN_IFNAME wlan%d + #endif + + static char intf_name[IFNAMSIZ] = quote_str(BRCM_WLAN_IFNAME); +diff --git a/x86-64/src/wl/sys/wl_linux.c b/x86-64/src/wl/sys/wl_linux.c +index 9ee69e1..409bda7 100644 +--- a/x86-64/src/wl/sys/wl_linux.c ++++ b/x86-64/src/wl/sys/wl_linux.c +@@ -2693,7 +2693,7 @@ wl_tkip_keyset(wl_info_t *wl, wsec_key_t *key) + void + wl_tkip_printstats(wl_info_t *wl, bool group_key) + { +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) + char debug_buf[512]; + int idx; + if (wl->tkipmodops) { +@@ -2855,6 +2855,7 @@ wl_linux_watchdog(void *ctx) + return 0; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) + static int + wl_proc_read(char *buffer, char **start, off_t offset, int length, int *eof, void *data) + { +@@ -2909,18 +2910,89 @@ wl_proc_write(struct file *filp, const char *buff, unsigned long length, void *d + return length; + } + ++#else ++ ++static int ++wl_proc_read(struct seq_file *seq, void *offset) ++{ ++ wl_info_t * wl = (wl_info_t *)seq->private; ++ int bcmerror, to_user; ++ ++ WL_LOCK(wl); ++ bcmerror = wlc_ioctl(wl->wlc, WLC_GET_MONITOR, &to_user, sizeof(int), NULL); ++ WL_UNLOCK(wl); ++ ++ seq_printf(seq, "%d\n", to_user); ++ return bcmerror; ++} ++ ++static ssize_t wl_proc_write(struct file *file, const char __user *buff, ++ size_t length, loff_t *ppos) ++{ ++ struct seq_file *seq = file->private_data; ++ wl_info_t * wl = (wl_info_t *)seq->private; ++ int bcmerror, from_user = 0; ++ ++ if (length != 1) { ++ WL_ERROR(("%s: Invalid data length\n", __FUNCTION__)); ++ return -EIO; ++ } ++ ++ if (copy_from_user(&from_user, buff, 1)) { ++ WL_ERROR(("%s: copy from user failed\n", __FUNCTION__)); ++ return -EFAULT; ++ } ++ ++ if (from_user >= 0x30) ++ from_user -= 0x30; ++ ++ WL_LOCK(wl); ++ bcmerror = wlc_ioctl(wl->wlc, WLC_SET_MONITOR, &from_user, sizeof(int), NULL); ++ WL_UNLOCK(wl); ++ ++ if (bcmerror < 0) { ++ WL_ERROR(("%s: SET_MONITOR failed with %d\n", __FUNCTION__, bcmerror)); ++ return -EIO; ++ } ++ *ppos += length; ++ return length; ++} ++ ++static int wl_proc_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, wl_proc_read, PDE_DATA(inode)); ++} ++ ++static const struct file_operations wl_proc_fops = { ++ .owner = THIS_MODULE, ++ .open = wl_proc_open, ++ .read = seq_read, ++ .write = wl_proc_write, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++#endif ++ + static int + wl_reg_proc_entry(wl_info_t *wl) + { + char tmp[32]; + sprintf(tmp, "%s%d", HYBRID_PROC, wl->pub->unit); +- if ((wl->proc_entry = create_proc_entry(tmp, 0644, NULL)) == NULL) { ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) ++ wl->proc_entry = create_proc_entry(tmp, 0644, NULL); ++ if (wl->proc_entry) { ++ wl->proc_entry->read_proc = wl_proc_read; ++ wl->proc_entry->write_proc = wl_proc_write; ++ wl->proc_entry->data = wl; ++ } ++#else ++ wl->proc_entry = proc_create_data(tmp, 0644, NULL, &wl_proc_fops, wl); ++#endif ++ if (!wl->proc_entry) { + WL_ERROR(("%s: create_proc_entry %s failed\n", __FUNCTION__, tmp)); + ASSERT(0); + return -1; + } +- wl->proc_entry->read_proc = wl_proc_read; +- wl->proc_entry->write_proc = wl_proc_write; +- wl->proc_entry->data = wl; + return 0; + } +diff --git a/x86-64/src/wl/sys/wl_linux.c.orig b/x86-64/src/wl/sys/wl_linux.c.orig +index 38206ab..9ee69e1 100644 +--- a/x86-64/src/wl/sys/wl_linux.c.orig ++++ b/x86-64/src/wl/sys/wl_linux.c.orig +@@ -219,7 +219,7 @@ module_param(nompc, int, 0); + #define quote_str(s) to_str(s) + + #ifndef BRCM_WLAN_IFNAME +-#define BRCM_WLAN_IFNAME eth%d ++#define BRCM_WLAN_IFNAME wlan%d + #endif + + static char intf_name[IFNAMSIZ] = quote_str(BRCM_WLAN_IFNAME);