From: Vasilis Tsiligiannis Date: Sat, 12 Oct 2013 19:53:18 +0000 (+0000) Subject: madwifi: Fix building against linux 3.10 X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=commitdiff_plain;hb=be508c3b0c342301119e043bd45ae8f8bb0de103 madwifi: Fix building against linux 3.10 SVN-Revision: 38372 --- diff --git a/net/madwifi/patches/480-remove_get-signal.patch b/net/madwifi/patches/480-remove_get-signal.patch new file mode 100644 index 0000000000..3785c57c03 --- /dev/null +++ b/net/madwifi/patches/480-remove_get-signal.patch @@ -0,0 +1,30 @@ +--- a/net80211/ieee80211_scan.c ++++ b/net80211/ieee80211_scan.c +@@ -107,17 +107,6 @@ struct channel_inuse { + u8 bw; + }; + +-static inline u32 +-get_signal(u8 bw, u8 distance) +-{ +- u32 v; +- +- /* signal = 1 - (distance / bw)^2 [scale: 100] */ +- v = 100 * distance / bw; +- v = (100 - ((v * v) / 100)); +- return v; +-} +- + static u32 + get_overlap(u16 f1, u16 f2, u8 b1, u8 b2) + { +@@ -137,7 +126,8 @@ get_overlap(u16 f1, u16 f2, u8 b1, u8 b2 + + d = f2 - f1; + c = d * b1 / (b1 + b2); +- v = get_signal(b1, c); ++ v = 100 * c / b1; ++ v = (100 - ((v * v) / 100)); + + return v * v / 100; + } diff --git a/net/madwifi/patches/481-fix_proc.patch b/net/madwifi/patches/481-fix_proc.patch new file mode 100644 index 0000000000..d8f6f94aee --- /dev/null +++ b/net/madwifi/patches/481-fix_proc.patch @@ -0,0 +1,177 @@ +--- a/net80211/ieee80211_linux.c ++++ b/net80211/ieee80211_linux.c +@@ -476,8 +476,12 @@ static int + proc_ieee80211_open(struct inode *inode, struct file *file) + { + struct proc_ieee80211_priv *pv = NULL; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++ struct ieee80211vap *vap = PDE_DATA(inode); ++#else + struct proc_dir_entry *dp = PDE(inode); + struct ieee80211vap *vap = dp->data; ++#endif + + if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv), GFP_KERNEL))) + return -ENOMEM; +@@ -842,10 +846,16 @@ ieee80211_virtfs_latevattach(struct ieee + tmp = vap->iv_proc_entries; + while (tmp) { + if (!tmp->entry) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++ tmp->entry = proc_create_data(tmp->name, ++ PROC_IEEE80211_PERM, vap->iv_proc, ++ tmp->fileops, vap); ++#else + tmp->entry = create_proc_entry(tmp->name, + PROC_IEEE80211_PERM, vap->iv_proc); + tmp->entry->data = vap; + tmp->entry->proc_fops = tmp->fileops; ++#endif + } + tmp = tmp->next; + } +@@ -913,10 +923,16 @@ ieee80211_proc_vcreate(struct ieee80211v + + /* Create the actual proc entry */ + if (vap->iv_proc) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++ entry->entry = proc_create_data(entry->name, ++ PROC_IEEE80211_PERM, vap->iv_proc, ++ entry->fileops, vap); ++#else + entry->entry = create_proc_entry(entry->name, + PROC_IEEE80211_PERM, vap->iv_proc); + entry->entry->data = vap; + entry->entry->proc_fops = entry->fileops; ++#endif + } + + /* Add it to the list */ +@@ -953,14 +969,26 @@ ieee80211_virtfs_vdetach(struct ieee8021 + tmp = vap->iv_proc_entries; + while (tmp) { + if (tmp->entry) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++ proc_remove(vap->iv_proc); ++#else + remove_proc_entry(tmp->name, vap->iv_proc); ++#endif + tmp->entry = NULL; + } + tmp = tmp->next; + } ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++ proc_remove(proc_madwifi); ++#else + remove_proc_entry(vap->iv_proc->name, proc_madwifi); ++#endif + if (proc_madwifi_count == 1) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++ proc_remove(proc_net); ++#else + remove_proc_entry("madwifi", proc_net); ++#endif + proc_madwifi = NULL; + } + proc_madwifi_count--; +--- a/ath_rate/minstrel/minstrel.c ++++ b/ath_rate/minstrel/minstrel.c +@@ -835,8 +835,12 @@ static int + ath_proc_ratesample_open(struct inode *inode, struct file *file) + { + struct proc_ieee80211_priv *pv = NULL; ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) ++ struct ieee80211vap *vap = PDE_DATA(inode); ++#else + struct proc_dir_entry *dp = PDE(inode); + struct ieee80211vap *vap = dp->data; ++#endif + + if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv), + GFP_KERNEL))) +--- a/ath_rate/sample/sample.c ++++ b/ath_rate/sample/sample.c +@@ -923,12 +923,15 @@ proc_read_nodes(struct ieee80211vap *vap + } + + static int +-proc_ratesample_open(struct inode *inode, struct file *file) ++proc_ratesample_open_common(struct inode *inode, struct file *file, const unsigned long size) + { + struct proc_ieee80211_priv *pv; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++ struct ieee80211vap *vap = PDE_DATA(inode); ++#else + struct proc_dir_entry *dp = PDE(inode); + struct ieee80211vap *vap = dp->data; +- unsigned long size; ++#endif + + if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv), + GFP_KERNEL))) +@@ -953,18 +956,47 @@ proc_ratesample_open(struct inode *inode + pv->max_wlen = MAX_PROC_IEEE80211_SIZE; + pv->max_rlen = MAX_PROC_IEEE80211_SIZE; + +- /* Determine what size packets to get stats for based on proc filename */ +- size = simple_strtoul(dp->name + 10, NULL, 0); +- + /* now read the data into the buffer */ + pv->rlen = proc_read_nodes(vap, size, pv->rbuf, MAX_PROC_IEEE80211_SIZE); + return 0; + } + +-static struct file_operations proc_ratesample_ops = { ++static int ++proc_ratesample_stats250_open(struct inode *inode, struct file *file) ++{ ++ return proc_ratesample_open_common(inode, file, 250); ++} ++ ++static int ++proc_ratesample_stats1600_open(struct inode *inode, struct file *file) ++{ ++ return proc_ratesample_open_common(inode, file, 1600); ++} ++ ++static int ++proc_ratesample_stats3000_open(struct inode *inode, struct file *file) ++{ ++ return proc_ratesample_open_common(inode, file, 3000); ++} ++ ++static struct file_operations proc_ratesample_stats250_ops = { ++ .read = NULL, ++ .write = NULL, ++ .open = proc_ratesample_stats250_open, ++ .release = NULL, ++}; ++ ++static struct file_operations proc_ratesample_stats1600_ops = { ++ .read = NULL, ++ .write = NULL, ++ .open = proc_ratesample_stats1600_open, ++ .release = NULL, ++}; ++ ++static struct file_operations proc_ratesample_stats3000_ops = { + .read = NULL, + .write = NULL, +- .open = proc_ratesample_open, ++ .open = proc_ratesample_stats3000_open, + .release = NULL, + }; + +@@ -972,9 +1004,9 @@ static void + ath_rate_dynamic_proc_register(struct ieee80211vap *vap) + { + /* Create proc entries for the rate control algorithm */ +- ieee80211_proc_vcreate(vap, &proc_ratesample_ops, "ratestats_250"); +- ieee80211_proc_vcreate(vap, &proc_ratesample_ops, "ratestats_1600"); +- ieee80211_proc_vcreate(vap, &proc_ratesample_ops, "ratestats_3000"); ++ ieee80211_proc_vcreate(vap, &proc_ratesample_stats250_ops, "ratestats_250"); ++ ieee80211_proc_vcreate(vap, &proc_ratesample_stats1600_ops, "ratestats_1600"); ++ ieee80211_proc_vcreate(vap, &proc_ratesample_stats3000_ops, "ratestats_3000"); + } + + static struct ieee80211_rate_ops ath_rate_ops = {