aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/batman-adv
diff options
context:
space:
mode:
authorSimon Wunderlich <siwu@hrz.tu-chemnitz.de>2010-01-02 05:30:51 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-03 19:42:36 -0500
commitabad5446585b0b9519fad00c05156f373ea114ad (patch)
treee2b09bb5a418d9bd0f78c88a85b51e857c42ddbf /drivers/staging/batman-adv
parentb9b27e4ef6313449a6b40a21e0e9a1bdd9a1d8ce (diff)
Staging: batman-adv: Remove compat.h
Since we are now part of mainline, we don't need compat.h to allow building of the module with old versions of the kernel. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/batman-adv')
-rw-r--r--drivers/staging/batman-adv/TODO3
-rw-r--r--drivers/staging/batman-adv/compat.h121
-rw-r--r--drivers/staging/batman-adv/device.c2
-rw-r--r--drivers/staging/batman-adv/hard-interface.c1
-rw-r--r--drivers/staging/batman-adv/main.c1
-rw-r--r--drivers/staging/batman-adv/originator.c16
-rw-r--r--drivers/staging/batman-adv/proc.c1
-rw-r--r--drivers/staging/batman-adv/routing.c2
-rw-r--r--drivers/staging/batman-adv/send.c2
-rw-r--r--drivers/staging/batman-adv/soft-interface.c6
-rw-r--r--drivers/staging/batman-adv/translation-table.c1
-rw-r--r--drivers/staging/batman-adv/vis.c1
12 files changed, 6 insertions, 151 deletions
diff --git a/drivers/staging/batman-adv/TODO b/drivers/staging/batman-adv/TODO
index 2122adc6aa8..2f15136b18e 100644
--- a/drivers/staging/batman-adv/TODO
+++ b/drivers/staging/batman-adv/TODO
@@ -17,9 +17,6 @@
17-> transtable_global (read-only) [outputs the global translation table] 17-> transtable_global (read-only) [outputs the global translation table]
18-> transtable_local (read-only) [outputs the local translation table] 18-> transtable_local (read-only) [outputs the local translation table]
19 19
20=> strip out all backward compatibility support to older kernels
21 (only found in compat.h)
22
23=> fix checkpatch.pl errors 20=> fix checkpatch.pl errors
24 21
25Please send all patches to: 22Please send all patches to:
diff --git a/drivers/staging/batman-adv/compat.h b/drivers/staging/batman-adv/compat.h
deleted file mode 100644
index ded1e6e1524..00000000000
--- a/drivers/staging/batman-adv/compat.h
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors:
3 *
4 * Marek Lindner, Simon Wunderlich
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA
19 *
20 *
21 * This file contains macros for maintaining compatibility with older versions
22 * of the Linux kernel.
23 */
24
25#include <linux/version.h> /* LINUX_VERSION_CODE */
26
27#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
28
29#define skb_set_network_header(_skb, _offset) \
30 do { (_skb)->nh.raw = (_skb)->data + (_offset); } while (0)
31
32#define skb_reset_mac_header(_skb) \
33 do { (_skb)->mac.raw = (_skb)->data; } while (0)
34
35#define list_first_entry(ptr, type, member) \
36 list_entry((ptr)->next, type, member)
37
38#define skb_mac_header(_skb) \
39 ((_skb)->mac.raw)
40
41#define skb_network_header(_skb) \
42 ((_skb)->nh.raw)
43
44#define skb_mac_header(_skb) \
45 ((_skb)->mac.raw)
46
47#endif /* < KERNEL_VERSION(2,6,22) */
48
49#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
50
51static inline int skb_clone_writable(struct sk_buff *skb, unsigned int len)
52{
53 /* skb->hdr_len not available, just "not writable" to enforce a copy */
54 return 0;
55}
56
57#define cancel_delayed_work_sync(wq) cancel_rearming_delayed_work(wq)
58
59#endif /* < KERNEL_VERSION(2, 6, 23) */
60
61#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
62
63#define strict_strtoul(cp, base, res) \
64 ({ \
65 int ret = 0; \
66 char *endp; \
67 *res = simple_strtoul(cp, &endp, base); \
68 if (cp == endp) \
69 ret = -EINVAL; \
70 ret; \
71})
72
73#endif /* < KERNEL_VERSION(2, 6, 25) */
74
75#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
76
77static const char hex_asc[] = "0123456789abcdef";
78#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
79#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4]
80static inline char *pack_hex_byte(char *buf, u8 byte)
81{
82 *buf++ = hex_asc_hi(byte);
83 *buf++ = hex_asc_lo(byte);
84 return buf;
85}
86
87#define device_create(_cls, _parent, _devt, _device, _fmt) \
88 class_device_create(_cls, _parent, _devt, _device, _fmt)
89
90#define device_destroy(_cls, _device) \
91 class_device_destroy(_cls, _device)
92
93#endif /* < KERNEL_VERSION(2, 6, 26) */
94
95#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
96
97#ifndef dereference_function_descriptor
98#define dereference_function_descriptor(p) (p)
99#endif
100
101#ifndef device_create
102#define device_create(_cls, _parent, _devt, _device, _fmt) \
103 device_create_drvdata(_cls, _parent, _devt, _device, _fmt)
104#endif
105
106#endif /* < KERNEL_VERSION(2, 6, 27) */
107
108#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
109
110asmlinkage int bat_printk(const char *fmt, ...);
111#define printk bat_printk
112
113static inline struct net_device_stats *dev_get_stats(struct net_device *dev)
114{
115 if (dev->get_stats)
116 return dev->get_stats(dev);
117 else
118 return NULL;
119}
120
121#endif /* < KERNEL_VERSION(2, 6, 29) */
diff --git a/drivers/staging/batman-adv/device.c b/drivers/staging/batman-adv/device.c
index 72306acec5e..a3e74296abf 100644
--- a/drivers/staging/batman-adv/device.c
+++ b/drivers/staging/batman-adv/device.c
@@ -26,8 +26,6 @@
26#include "types.h" 26#include "types.h"
27#include "hash.h" 27#include "hash.h"
28 28
29#include "compat.h"
30
31static struct class *batman_class; 29static struct class *batman_class;
32 30
33static int Major; /* Major number assigned to our device driver */ 31static int Major; /* Major number assigned to our device driver */
diff --git a/drivers/staging/batman-adv/hard-interface.c b/drivers/staging/batman-adv/hard-interface.c
index db264bd0bf9..f8b1ba3910a 100644
--- a/drivers/staging/batman-adv/hard-interface.c
+++ b/drivers/staging/batman-adv/hard-interface.c
@@ -26,7 +26,6 @@
26#include "translation-table.h" 26#include "translation-table.h"
27#include "routing.h" 27#include "routing.h"
28#include "hash.h" 28#include "hash.h"
29#include "compat.h"
30 29
31#define MIN(x, y) ((x) < (y) ? (x) : (y)) 30#define MIN(x, y) ((x) < (y) ? (x) : (y))
32 31
diff --git a/drivers/staging/batman-adv/main.c b/drivers/staging/batman-adv/main.c
index 1d80ea366be..3f780753a2b 100644
--- a/drivers/staging/batman-adv/main.c
+++ b/drivers/staging/batman-adv/main.c
@@ -31,7 +31,6 @@
31#include "types.h" 31#include "types.h"
32#include "vis.h" 32#include "vis.h"
33#include "hash.h" 33#include "hash.h"
34#include "compat.h"
35 34
36struct list_head if_list; 35struct list_head if_list;
37struct hlist_head forw_bat_list; 36struct hlist_head forw_bat_list;
diff --git a/drivers/staging/batman-adv/originator.c b/drivers/staging/batman-adv/originator.c
index a60dbe1cf6b..29c241119a3 100644
--- a/drivers/staging/batman-adv/originator.c
+++ b/drivers/staging/batman-adv/originator.c
@@ -26,8 +26,6 @@
26#include "hash.h" 26#include "hash.h"
27#include "translation-table.h" 27#include "translation-table.h"
28#include "routing.h" 28#include "routing.h"
29#include "compat.h"
30
31 29
32static DECLARE_DELAYED_WORK(purge_orig_wq, purge_orig); 30static DECLARE_DELAYED_WORK(purge_orig_wq, purge_orig);
33 31
@@ -80,11 +78,10 @@ create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node,
80 78
81 bat_dbg(DBG_BATMAN, "Creating new last-hop neighbor of originator\n"); 79 bat_dbg(DBG_BATMAN, "Creating new last-hop neighbor of originator\n");
82 80
83 neigh_node = kmalloc(sizeof(struct neigh_node), GFP_ATOMIC); 81 neigh_node = kzalloc(sizeof(struct neigh_node), GFP_ATOMIC);
84 if (!neigh_node) 82 if (!neigh_node)
85 return NULL; 83 return NULL;
86 84
87 memset(neigh_node, 0, sizeof(struct neigh_node));
88 INIT_LIST_HEAD(&neigh_node->list); 85 INIT_LIST_HEAD(&neigh_node->list);
89 86
90 memcpy(neigh_node->addr, neigh, ETH_ALEN); 87 memcpy(neigh_node->addr, neigh, ETH_ALEN);
@@ -131,11 +128,10 @@ struct orig_node *get_orig_node(uint8_t *addr)
131 128
132 bat_dbg(DBG_BATMAN, "Creating new originator: %pM \n", addr); 129 bat_dbg(DBG_BATMAN, "Creating new originator: %pM \n", addr);
133 130
134 orig_node = kmalloc(sizeof(struct orig_node), GFP_ATOMIC); 131 orig_node = kzalloc(sizeof(struct orig_node), GFP_ATOMIC);
135 if (!orig_node) 132 if (!orig_node)
136 return NULL; 133 return NULL;
137 134
138 memset(orig_node, 0, sizeof(struct orig_node));
139 INIT_LIST_HEAD(&orig_node->neigh_list); 135 INIT_LIST_HEAD(&orig_node->neigh_list);
140 136
141 memcpy(orig_node->orig, addr, ETH_ALEN); 137 memcpy(orig_node->orig, addr, ETH_ALEN);
@@ -145,19 +141,15 @@ struct orig_node *get_orig_node(uint8_t *addr)
145 141
146 size = num_ifs * sizeof(TYPE_OF_WORD) * NUM_WORDS; 142 size = num_ifs * sizeof(TYPE_OF_WORD) * NUM_WORDS;
147 143
148 orig_node->bcast_own = kmalloc(size, GFP_ATOMIC); 144 orig_node->bcast_own = kzalloc(size, GFP_ATOMIC);
149 if (!orig_node->bcast_own) 145 if (!orig_node->bcast_own)
150 goto free_orig_node; 146 goto free_orig_node;
151 147
152 memset(orig_node->bcast_own, 0, size);
153
154 size = num_ifs * sizeof(uint8_t); 148 size = num_ifs * sizeof(uint8_t);
155 orig_node->bcast_own_sum = kmalloc(size, GFP_ATOMIC); 149 orig_node->bcast_own_sum = kzalloc(size, GFP_ATOMIC);
156 if (!orig_node->bcast_own_sum) 150 if (!orig_node->bcast_own_sum)
157 goto free_bcast_own; 151 goto free_bcast_own;
158 152
159 memset(orig_node->bcast_own_sum, 0, size);
160
161 if (hash_add(orig_hash, orig_node) < 0) 153 if (hash_add(orig_hash, orig_node) < 0)
162 goto free_bcast_own_sum; 154 goto free_bcast_own_sum;
163 155
diff --git a/drivers/staging/batman-adv/proc.c b/drivers/staging/batman-adv/proc.c
index 33dae941a5c..4d199351c2b 100644
--- a/drivers/staging/batman-adv/proc.c
+++ b/drivers/staging/batman-adv/proc.c
@@ -27,7 +27,6 @@
27#include "types.h" 27#include "types.h"
28#include "hash.h" 28#include "hash.h"
29#include "vis.h" 29#include "vis.h"
30#include "compat.h"
31 30
32static struct proc_dir_entry *proc_batman_dir, *proc_interface_file; 31static struct proc_dir_entry *proc_batman_dir, *proc_interface_file;
33static struct proc_dir_entry *proc_orig_interval_file, *proc_originators_file; 32static struct proc_dir_entry *proc_orig_interval_file, *proc_originators_file;
diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c
index bab7a73e17a..09917e57b41 100644
--- a/drivers/staging/batman-adv/routing.c
+++ b/drivers/staging/batman-adv/routing.c
@@ -32,7 +32,6 @@
32#include "ring_buffer.h" 32#include "ring_buffer.h"
33#include "vis.h" 33#include "vis.h"
34#include "aggregation.h" 34#include "aggregation.h"
35#include "compat.h"
36 35
37DECLARE_WAIT_QUEUE_HEAD(thread_wait); 36DECLARE_WAIT_QUEUE_HEAD(thread_wait);
38 37
@@ -310,7 +309,6 @@ static void update_orig(struct orig_node *orig_node, struct ethhdr *ethhdr,
310 309
311update_hna: 310update_hna:
312 update_routes(orig_node, orig_node->router, hna_buff, tmp_hna_buff_len); 311 update_routes(orig_node, orig_node->router, hna_buff, tmp_hna_buff_len);
313 return;
314} 312}
315 313
316static char count_real_packets(struct ethhdr *ethhdr, 314static char count_real_packets(struct ethhdr *ethhdr,
diff --git a/drivers/staging/batman-adv/send.c b/drivers/staging/batman-adv/send.c
index edfdd5d9279..944b2cdbdff 100644
--- a/drivers/staging/batman-adv/send.c
+++ b/drivers/staging/batman-adv/send.c
@@ -29,8 +29,6 @@
29#include "vis.h" 29#include "vis.h"
30#include "aggregation.h" 30#include "aggregation.h"
31 31
32#include "compat.h"
33
34/* apply hop penalty for a normal link */ 32/* apply hop penalty for a normal link */
35static uint8_t hop_penalty(const uint8_t tq) 33static uint8_t hop_penalty(const uint8_t tq)
36{ 34{
diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c
index bc0217b1aeb..c9b35d9f799 100644
--- a/drivers/staging/batman-adv/soft-interface.c
+++ b/drivers/staging/batman-adv/soft-interface.c
@@ -28,7 +28,6 @@
28#include "hash.h" 28#include "hash.h"
29#include <linux/ethtool.h> 29#include <linux/ethtool.h>
30#include <linux/etherdevice.h> 30#include <linux/etherdevice.h>
31#include "compat.h"
32 31
33static uint16_t bcast_seqno = 1; /* give own bcast messages seq numbers to avoid 32static uint16_t bcast_seqno = 1; /* give own bcast messages seq numbers to avoid
34 * broadcast storms */ 33 * broadcast storms */
@@ -120,7 +119,7 @@ void interface_setup(struct net_device *dev)
120 119
121 /* generate random address */ 120 /* generate random address */
122 random_ether_addr(dev_addr); 121 random_ether_addr(dev_addr);
123 memcpy(dev->dev_addr, dev_addr, sizeof(dev->dev_addr)); 122 memcpy(dev->dev_addr, dev_addr, ETH_ALEN);
124 123
125 SET_ETHTOOL_OPS(dev, &bat_ethtool_ops); 124 SET_ETHTOOL_OPS(dev, &bat_ethtool_ops);
126 125
@@ -269,7 +268,7 @@ unlock:
269dropped: 268dropped:
270 priv->stats.tx_dropped++; 269 priv->stats.tx_dropped++;
271end: 270end:
272 return 0; 271 return NETDEV_TX_OK;
273} 272}
274 273
275void interface_rx(struct sk_buff *skb, int hdr_size) 274void interface_rx(struct sk_buff *skb, int hdr_size)
@@ -338,7 +337,6 @@ static u32 bat_get_msglevel(struct net_device *dev)
338 337
339static void bat_set_msglevel(struct net_device *dev, u32 value) 338static void bat_set_msglevel(struct net_device *dev, u32 value)
340{ 339{
341 return;
342} 340}
343 341
344static u32 bat_get_link(struct net_device *dev) 342static u32 bat_get_link(struct net_device *dev)
diff --git a/drivers/staging/batman-adv/translation-table.c b/drivers/staging/batman-adv/translation-table.c
index 398a8084660..d56f6654de0 100644
--- a/drivers/staging/batman-adv/translation-table.c
+++ b/drivers/staging/batman-adv/translation-table.c
@@ -24,7 +24,6 @@
24#include "soft-interface.h" 24#include "soft-interface.h"
25#include "types.h" 25#include "types.h"
26#include "hash.h" 26#include "hash.h"
27#include "compat.h"
28 27
29struct hashtable_t *hna_local_hash; 28struct hashtable_t *hna_local_hash;
30static struct hashtable_t *hna_global_hash; 29static struct hashtable_t *hna_global_hash;
diff --git a/drivers/staging/batman-adv/vis.c b/drivers/staging/batman-adv/vis.c
index 191297926b3..ec8bb3f382c 100644
--- a/drivers/staging/batman-adv/vis.c
+++ b/drivers/staging/batman-adv/vis.c
@@ -26,7 +26,6 @@
26#include "soft-interface.h" 26#include "soft-interface.h"
27#include "hard-interface.h" 27#include "hard-interface.h"
28#include "hash.h" 28#include "hash.h"
29#include "compat.h"
30 29
31struct hashtable_t *vis_hash; 30struct hashtable_t *vis_hash;
32DEFINE_SPINLOCK(vis_hash_lock); 31DEFINE_SPINLOCK(vis_hash_lock);