aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2011-06-15 03:41:37 -0400
committerSven Eckelmann <sven@narfation.org>2011-06-20 05:37:18 -0400
commitb4e1705417c6cc7d46d9020259a2c8f457cf82bd (patch)
treed057a27c91d0bce396726878a6c8995f0d5b0d3b
parentb2c44a53836559b5e2823aa215c979c33bc9e2db (diff)
batman-adv: Reduce usage of char
char was used in different places to store information without really using the characteristics of that data type or by ignoring the fact that char has not a well defined signedness. Signed-off-by: Sven Eckelmann <sven@narfation.org>
-rw-r--r--net/batman-adv/aggregation.c2
-rw-r--r--net/batman-adv/aggregation.h2
-rw-r--r--net/batman-adv/bitarray.c4
-rw-r--r--net/batman-adv/bitarray.h4
-rw-r--r--net/batman-adv/gateway_client.c2
-rw-r--r--net/batman-adv/gateway_common.c6
-rw-r--r--net/batman-adv/main.h2
-rw-r--r--net/batman-adv/routing.c8
-rw-r--r--net/batman-adv/send.c6
-rw-r--r--net/batman-adv/send.h2
-rw-r--r--net/batman-adv/soft-interface.c2
11 files changed, 20 insertions, 20 deletions
diff --git a/net/batman-adv/aggregation.c b/net/batman-adv/aggregation.c
index 4080970ade7d..29c67405347b 100644
--- a/net/batman-adv/aggregation.c
+++ b/net/batman-adv/aggregation.c
@@ -195,7 +195,7 @@ static void aggregate(struct forw_packet *forw_packet_aggr,
195 195
196void add_bat_packet_to_list(struct bat_priv *bat_priv, 196void add_bat_packet_to_list(struct bat_priv *bat_priv,
197 unsigned char *packet_buff, int packet_len, 197 unsigned char *packet_buff, int packet_len,
198 struct hard_iface *if_incoming, char own_packet, 198 struct hard_iface *if_incoming, int own_packet,
199 unsigned long send_time) 199 unsigned long send_time)
200{ 200{
201 /** 201 /**
diff --git a/net/batman-adv/aggregation.h b/net/batman-adv/aggregation.h
index fedeb8d0e13f..0547fd8ea3b9 100644
--- a/net/batman-adv/aggregation.h
+++ b/net/batman-adv/aggregation.h
@@ -35,7 +35,7 @@ static inline int aggregated_packet(int buff_pos, int packet_len, int num_tt)
35 35
36void add_bat_packet_to_list(struct bat_priv *bat_priv, 36void add_bat_packet_to_list(struct bat_priv *bat_priv,
37 unsigned char *packet_buff, int packet_len, 37 unsigned char *packet_buff, int packet_len,
38 struct hard_iface *if_incoming, char own_packet, 38 struct hard_iface *if_incoming, int own_packet,
39 unsigned long send_time); 39 unsigned long send_time);
40void receive_aggr_bat_packet(const struct ethhdr *ethhdr, 40void receive_aggr_bat_packet(const struct ethhdr *ethhdr,
41 unsigned char *packet_buff, int packet_len, 41 unsigned char *packet_buff, int packet_len,
diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c
index 3659a258ef49..c1f4bfc09cc3 100644
--- a/net/batman-adv/bitarray.c
+++ b/net/batman-adv/bitarray.c
@@ -127,8 +127,8 @@ static void bit_reset_window(unsigned long *seq_bits)
127 * 1 if the window was moved (either new or very old) 127 * 1 if the window was moved (either new or very old)
128 * 0 if the window was not moved/shifted. 128 * 0 if the window was not moved/shifted.
129 */ 129 */
130char bit_get_packet(void *priv, unsigned long *seq_bits, 130int bit_get_packet(void *priv, unsigned long *seq_bits,
131 int32_t seq_num_diff, int8_t set_mark) 131 int32_t seq_num_diff, int set_mark)
132{ 132{
133 struct bat_priv *bat_priv = priv; 133 struct bat_priv *bat_priv = priv;
134 134
diff --git a/net/batman-adv/bitarray.h b/net/batman-adv/bitarray.h
index 277c037456e9..9c04422aeb07 100644
--- a/net/batman-adv/bitarray.h
+++ b/net/batman-adv/bitarray.h
@@ -35,8 +35,8 @@ void bit_mark(unsigned long *seq_bits, int32_t n);
35 35
36/* receive and process one packet, returns 1 if received seq_num is considered 36/* receive and process one packet, returns 1 if received seq_num is considered
37 * new, 0 if old */ 37 * new, 0 if old */
38char bit_get_packet(void *priv, unsigned long *seq_bits, 38int bit_get_packet(void *priv, unsigned long *seq_bits,
39 int32_t seq_num_diff, int8_t set_mark); 39 int32_t seq_num_diff, int set_mark);
40 40
41/* count the hamming weight, how many good packets did we receive? */ 41/* count the hamming weight, how many good packets did we receive? */
42int bit_packet_count(const unsigned long *seq_bits); 42int bit_packet_count(const unsigned long *seq_bits);
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 24aee561f3d8..7248de2e66dc 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -360,7 +360,7 @@ void gw_node_purge(struct bat_priv *bat_priv)
360 struct gw_node *gw_node, *curr_gw; 360 struct gw_node *gw_node, *curr_gw;
361 struct hlist_node *node, *node_tmp; 361 struct hlist_node *node, *node_tmp;
362 unsigned long timeout = 2 * PURGE_TIMEOUT * HZ; 362 unsigned long timeout = 2 * PURGE_TIMEOUT * HZ;
363 char do_deselect = 0; 363 int do_deselect = 0;
364 364
365 curr_gw = gw_get_selected_gw_node(bat_priv); 365 curr_gw = gw_get_selected_gw_node(bat_priv);
366 366
diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c
index e74307be8e0c..18661af0bc3b 100644
--- a/net/batman-adv/gateway_common.c
+++ b/net/batman-adv/gateway_common.c
@@ -61,9 +61,9 @@ static void kbit_to_gw_bandwidth(int down, int up, long *gw_srv_class)
61/* returns the up and downspeeds in kbit, calculated from the class */ 61/* returns the up and downspeeds in kbit, calculated from the class */
62void gw_bandwidth_to_kbit(uint8_t gw_srv_class, int *down, int *up) 62void gw_bandwidth_to_kbit(uint8_t gw_srv_class, int *down, int *up)
63{ 63{
64 char sbit = (gw_srv_class & 0x80) >> 7; 64 int sbit = (gw_srv_class & 0x80) >> 7;
65 char dpart = (gw_srv_class & 0x78) >> 3; 65 int dpart = (gw_srv_class & 0x78) >> 3;
66 char upart = (gw_srv_class & 0x07); 66 int upart = (gw_srv_class & 0x07);
67 67
68 if (!gw_srv_class) { 68 if (!gw_srv_class) {
69 *down = 0; 69 *down = 0;
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index ed488cbae80f..714a2414d913 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -151,7 +151,7 @@ int debug_log(struct bat_priv *bat_priv, const char *fmt, ...) __printf(2, 3);
151 while (0) 151 while (0)
152#else /* !CONFIG_BATMAN_ADV_DEBUG */ 152#else /* !CONFIG_BATMAN_ADV_DEBUG */
153__printf(3, 4) 153__printf(3, 4)
154static inline void bat_dbg(char type __always_unused, 154static inline void bat_dbg(int type __always_unused,
155 struct bat_priv *bat_priv __always_unused, 155 struct bat_priv *bat_priv __always_unused,
156 const char *fmt __always_unused, ...) 156 const char *fmt __always_unused, ...)
157{ 157{
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index d5ce644f8720..eb6fb7d2d368 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -163,7 +163,7 @@ static int is_bidirectional_neigh(struct orig_node *orig_node,
163 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); 163 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
164 struct neigh_node *neigh_node = NULL, *tmp_neigh_node; 164 struct neigh_node *neigh_node = NULL, *tmp_neigh_node;
165 struct hlist_node *node; 165 struct hlist_node *node;
166 unsigned char total_count; 166 uint8_t total_count;
167 uint8_t orig_eq_count, neigh_rq_count, tq_own; 167 uint8_t orig_eq_count, neigh_rq_count, tq_own;
168 int tq_asym_penalty, ret = 0; 168 int tq_asym_penalty, ret = 0;
169 169
@@ -602,9 +602,9 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
602 struct orig_node *orig_neigh_node, *orig_node; 602 struct orig_node *orig_neigh_node, *orig_node;
603 struct neigh_node *router = NULL, *router_router = NULL; 603 struct neigh_node *router = NULL, *router_router = NULL;
604 struct neigh_node *orig_neigh_router = NULL; 604 struct neigh_node *orig_neigh_router = NULL;
605 char has_directlink_flag; 605 int has_directlink_flag;
606 char is_my_addr = 0, is_my_orig = 0, is_my_oldorig = 0; 606 int is_my_addr = 0, is_my_orig = 0, is_my_oldorig = 0;
607 char is_broadcast = 0, is_bidirectional, is_single_hop_neigh; 607 int is_broadcast = 0, is_bidirectional, is_single_hop_neigh;
608 int is_duplicate; 608 int is_duplicate;
609 uint32_t if_incoming_seqno; 609 uint32_t if_incoming_seqno;
610 610
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index a1b8c3173a3f..be0d581a62a9 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -165,7 +165,7 @@ static void send_packet(struct forw_packet *forw_packet)
165 struct bat_priv *bat_priv; 165 struct bat_priv *bat_priv;
166 struct batman_packet *batman_packet = 166 struct batman_packet *batman_packet =
167 (struct batman_packet *)(forw_packet->skb->data); 167 (struct batman_packet *)(forw_packet->skb->data);
168 unsigned char directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0); 168 int directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0);
169 169
170 if (!forw_packet->if_incoming) { 170 if (!forw_packet->if_incoming) {
171 pr_err("Error - can't forward packet: incoming iface not " 171 pr_err("Error - can't forward packet: incoming iface not "
@@ -307,12 +307,12 @@ void schedule_own_packet(struct hard_iface *hard_iface)
307void schedule_forward_packet(struct orig_node *orig_node, 307void schedule_forward_packet(struct orig_node *orig_node,
308 const struct ethhdr *ethhdr, 308 const struct ethhdr *ethhdr,
309 struct batman_packet *batman_packet, 309 struct batman_packet *batman_packet,
310 uint8_t directlink, int tt_buff_len, 310 int directlink, int tt_buff_len,
311 struct hard_iface *if_incoming) 311 struct hard_iface *if_incoming)
312{ 312{
313 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); 313 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
314 struct neigh_node *router; 314 struct neigh_node *router;
315 unsigned char in_tq, in_ttl, tq_avg = 0; 315 uint8_t in_tq, in_ttl, tq_avg = 0;
316 unsigned long send_time; 316 unsigned long send_time;
317 317
318 if (batman_packet->ttl <= 1) { 318 if (batman_packet->ttl <= 1) {
diff --git a/net/batman-adv/send.h b/net/batman-adv/send.h
index eceab870024d..6d9c14d75977 100644
--- a/net/batman-adv/send.h
+++ b/net/batman-adv/send.h
@@ -28,7 +28,7 @@ void schedule_own_packet(struct hard_iface *hard_iface);
28void schedule_forward_packet(struct orig_node *orig_node, 28void schedule_forward_packet(struct orig_node *orig_node,
29 const struct ethhdr *ethhdr, 29 const struct ethhdr *ethhdr,
30 struct batman_packet *batman_packet, 30 struct batman_packet *batman_packet,
31 uint8_t directlink, int tt_buff_len, 31 int directlink, int tt_buff_len,
32 struct hard_iface *if_outgoing); 32 struct hard_iface *if_outgoing);
33int add_bcast_packet_to_list(struct bat_priv *bat_priv, 33int add_bcast_packet_to_list(struct bat_priv *bat_priv,
34 const struct sk_buff *skb); 34 const struct sk_buff *skb);
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 0fc997e13251..69c002279e63 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -380,7 +380,7 @@ void softif_neigh_purge(struct bat_priv *bat_priv)
380 struct softif_neigh *softif_neigh, *curr_softif_neigh; 380 struct softif_neigh *softif_neigh, *curr_softif_neigh;
381 struct softif_neigh_vid *softif_neigh_vid; 381 struct softif_neigh_vid *softif_neigh_vid;
382 struct hlist_node *node, *node_tmp, *node_tmp2; 382 struct hlist_node *node, *node_tmp, *node_tmp2;
383 char do_deselect; 383 int do_deselect;
384 384
385 rcu_read_lock(); 385 rcu_read_lock();
386 hlist_for_each_entry_rcu(softif_neigh_vid, node, 386 hlist_for_each_entry_rcu(softif_neigh_vid, node,