diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-07-08 11:13:15 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-08-23 08:20:20 -0400 |
commit | bbb1f90efba89b31fc5e329d5fcaf10aca99212b (patch) | |
tree | db2645f7068d5da5b501559e6a2972c20f361082 | |
parent | 8de47de5757bd5f64a823185e544210d95fd2088 (diff) |
batman-adv: Don't break statements after assignment operator
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
-rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 39 | ||||
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 7 | ||||
-rw-r--r-- | net/batman-adv/send.c | 8 | ||||
-rw-r--r-- | net/batman-adv/soft-interface.c | 5 | ||||
-rw-r--r-- | net/batman-adv/unicast.c | 11 | ||||
-rw-r--r-- | net/batman-adv/vis.c | 4 |
6 files changed, 39 insertions, 35 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index daaccc1326d4..616d52d9cd0a 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -588,6 +588,8 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) | |||
588 | struct batadv_ogm_packet *batadv_ogm_packet; | 588 | struct batadv_ogm_packet *batadv_ogm_packet; |
589 | struct batadv_hard_iface *primary_if; | 589 | struct batadv_hard_iface *primary_if; |
590 | int vis_server, tt_num_changes = 0; | 590 | int vis_server, tt_num_changes = 0; |
591 | uint32_t seqno; | ||
592 | uint8_t bandwidth; | ||
591 | 593 | ||
592 | vis_server = atomic_read(&bat_priv->vis_mode); | 594 | vis_server = atomic_read(&bat_priv->vis_mode); |
593 | primary_if = batadv_primary_if_get_selected(bat_priv); | 595 | primary_if = batadv_primary_if_get_selected(bat_priv); |
@@ -601,8 +603,8 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) | |||
601 | batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff; | 603 | batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff; |
602 | 604 | ||
603 | /* change sequence number to network order */ | 605 | /* change sequence number to network order */ |
604 | batadv_ogm_packet->seqno = | 606 | seqno = (uint32_t)atomic_read(&hard_iface->seqno); |
605 | htonl((uint32_t)atomic_read(&hard_iface->seqno)); | 607 | batadv_ogm_packet->seqno = htonl(seqno); |
606 | atomic_inc(&hard_iface->seqno); | 608 | atomic_inc(&hard_iface->seqno); |
607 | 609 | ||
608 | batadv_ogm_packet->ttvn = atomic_read(&bat_priv->tt.vn); | 610 | batadv_ogm_packet->ttvn = atomic_read(&bat_priv->tt.vn); |
@@ -615,12 +617,13 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) | |||
615 | else | 617 | else |
616 | batadv_ogm_packet->flags &= ~BATADV_VIS_SERVER; | 618 | batadv_ogm_packet->flags &= ~BATADV_VIS_SERVER; |
617 | 619 | ||
618 | if ((hard_iface == primary_if) && | 620 | if (hard_iface == primary_if && |
619 | (atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER)) | 621 | atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER) { |
620 | batadv_ogm_packet->gw_flags = | 622 | bandwidth = (uint8_t)atomic_read(&bat_priv->gw_bandwidth); |
621 | (uint8_t)atomic_read(&bat_priv->gw_bandwidth); | 623 | batadv_ogm_packet->gw_flags = bandwidth; |
622 | else | 624 | } else { |
623 | batadv_ogm_packet->gw_flags = BATADV_NO_FLAGS; | 625 | batadv_ogm_packet->gw_flags = BATADV_NO_FLAGS; |
626 | } | ||
624 | 627 | ||
625 | batadv_slide_own_bcast_window(hard_iface); | 628 | batadv_slide_own_bcast_window(hard_iface); |
626 | batadv_iv_ogm_queue_add(bat_priv, hard_iface->packet_buff, | 629 | batadv_iv_ogm_queue_add(bat_priv, hard_iface->packet_buff, |
@@ -644,8 +647,9 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, | |||
644 | struct batadv_neigh_node *router = NULL; | 647 | struct batadv_neigh_node *router = NULL; |
645 | struct batadv_orig_node *orig_node_tmp; | 648 | struct batadv_orig_node *orig_node_tmp; |
646 | struct hlist_node *node; | 649 | struct hlist_node *node; |
647 | uint8_t bcast_own_sum_orig, bcast_own_sum_neigh; | 650 | uint8_t sum_orig, sum_neigh; |
648 | uint8_t *neigh_addr; | 651 | uint8_t *neigh_addr; |
652 | uint8_t tq_avg; | ||
649 | 653 | ||
650 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, | 654 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, |
651 | "update_originator(): Searching and updating originator entry of received packet\n"); | 655 | "update_originator(): Searching and updating originator entry of received packet\n"); |
@@ -669,8 +673,8 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, | |||
669 | spin_lock_bh(&tmp_neigh_node->lq_update_lock); | 673 | spin_lock_bh(&tmp_neigh_node->lq_update_lock); |
670 | batadv_ring_buffer_set(tmp_neigh_node->tq_recv, | 674 | batadv_ring_buffer_set(tmp_neigh_node->tq_recv, |
671 | &tmp_neigh_node->tq_index, 0); | 675 | &tmp_neigh_node->tq_index, 0); |
672 | tmp_neigh_node->tq_avg = | 676 | tq_avg = batadv_ring_buffer_avg(tmp_neigh_node->tq_recv); |
673 | batadv_ring_buffer_avg(tmp_neigh_node->tq_recv); | 677 | tmp_neigh_node->tq_avg = tq_avg; |
674 | spin_unlock_bh(&tmp_neigh_node->lq_update_lock); | 678 | spin_unlock_bh(&tmp_neigh_node->lq_update_lock); |
675 | } | 679 | } |
676 | 680 | ||
@@ -729,17 +733,15 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, | |||
729 | if (router && (neigh_node->tq_avg == router->tq_avg)) { | 733 | if (router && (neigh_node->tq_avg == router->tq_avg)) { |
730 | orig_node_tmp = router->orig_node; | 734 | orig_node_tmp = router->orig_node; |
731 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); | 735 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); |
732 | bcast_own_sum_orig = | 736 | sum_orig = orig_node_tmp->bcast_own_sum[if_incoming->if_num]; |
733 | orig_node_tmp->bcast_own_sum[if_incoming->if_num]; | ||
734 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); | 737 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); |
735 | 738 | ||
736 | orig_node_tmp = neigh_node->orig_node; | 739 | orig_node_tmp = neigh_node->orig_node; |
737 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); | 740 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); |
738 | bcast_own_sum_neigh = | 741 | sum_neigh = orig_node_tmp->bcast_own_sum[if_incoming->if_num]; |
739 | orig_node_tmp->bcast_own_sum[if_incoming->if_num]; | ||
740 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); | 742 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); |
741 | 743 | ||
742 | if (bcast_own_sum_orig >= bcast_own_sum_neigh) | 744 | if (sum_orig >= sum_neigh) |
743 | goto update_tt; | 745 | goto update_tt; |
744 | } | 746 | } |
745 | 747 | ||
@@ -912,6 +914,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, | |||
912 | int set_mark, ret = -1; | 914 | int set_mark, ret = -1; |
913 | uint32_t seqno = ntohl(batadv_ogm_packet->seqno); | 915 | uint32_t seqno = ntohl(batadv_ogm_packet->seqno); |
914 | uint8_t *neigh_addr; | 916 | uint8_t *neigh_addr; |
917 | uint8_t packet_count; | ||
915 | 918 | ||
916 | orig_node = batadv_get_orig_node(bat_priv, batadv_ogm_packet->orig); | 919 | orig_node = batadv_get_orig_node(bat_priv, batadv_ogm_packet->orig); |
917 | if (!orig_node) | 920 | if (!orig_node) |
@@ -946,9 +949,9 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, | |||
946 | tmp_neigh_node->real_bits, | 949 | tmp_neigh_node->real_bits, |
947 | seq_diff, set_mark); | 950 | seq_diff, set_mark); |
948 | 951 | ||
949 | tmp_neigh_node->real_packet_count = | 952 | packet_count = bitmap_weight(tmp_neigh_node->real_bits, |
950 | bitmap_weight(tmp_neigh_node->real_bits, | 953 | BATADV_TQ_LOCAL_WINDOW_SIZE); |
951 | BATADV_TQ_LOCAL_WINDOW_SIZE); | 954 | tmp_neigh_node->real_packet_count = packet_count; |
952 | } | 955 | } |
953 | rcu_read_unlock(); | 956 | rcu_read_unlock(); |
954 | 957 | ||
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index ad18017da4e7..7a93b2ae3a9b 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -579,8 +579,7 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv, | |||
579 | "bla_add_claim(): changing ownership for %pM, vid %d\n", | 579 | "bla_add_claim(): changing ownership for %pM, vid %d\n", |
580 | mac, vid); | 580 | mac, vid); |
581 | 581 | ||
582 | claim->backbone_gw->crc ^= | 582 | claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN); |
583 | crc16(0, claim->addr, ETH_ALEN); | ||
584 | batadv_backbone_gw_free_ref(claim->backbone_gw); | 583 | batadv_backbone_gw_free_ref(claim->backbone_gw); |
585 | 584 | ||
586 | } | 585 | } |
@@ -1102,8 +1101,7 @@ static void batadv_bla_start_timer(struct batadv_priv *bat_priv) | |||
1102 | */ | 1101 | */ |
1103 | static void batadv_bla_periodic_work(struct work_struct *work) | 1102 | static void batadv_bla_periodic_work(struct work_struct *work) |
1104 | { | 1103 | { |
1105 | struct delayed_work *delayed_work = | 1104 | struct delayed_work *delayed_work; |
1106 | container_of(work, struct delayed_work, work); | ||
1107 | struct batadv_priv *bat_priv; | 1105 | struct batadv_priv *bat_priv; |
1108 | struct batadv_priv_bla *priv_bla; | 1106 | struct batadv_priv_bla *priv_bla; |
1109 | struct hlist_node *node; | 1107 | struct hlist_node *node; |
@@ -1113,6 +1111,7 @@ static void batadv_bla_periodic_work(struct work_struct *work) | |||
1113 | struct batadv_hard_iface *primary_if; | 1111 | struct batadv_hard_iface *primary_if; |
1114 | int i; | 1112 | int i; |
1115 | 1113 | ||
1114 | delayed_work = container_of(work, struct delayed_work, work); | ||
1116 | priv_bla = container_of(delayed_work, struct batadv_priv_bla, work); | 1115 | priv_bla = container_of(delayed_work, struct batadv_priv_bla, work); |
1117 | bat_priv = container_of(priv_bla, struct batadv_priv, bla); | 1116 | bat_priv = container_of(priv_bla, struct batadv_priv, bla); |
1118 | primary_if = batadv_primary_if_get_selected(bat_priv); | 1117 | primary_if = batadv_primary_if_get_selected(bat_priv); |
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 3b4b2daa3b3e..570a8bce0364 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c | |||
@@ -190,13 +190,13 @@ out: | |||
190 | static void batadv_send_outstanding_bcast_packet(struct work_struct *work) | 190 | static void batadv_send_outstanding_bcast_packet(struct work_struct *work) |
191 | { | 191 | { |
192 | struct batadv_hard_iface *hard_iface; | 192 | struct batadv_hard_iface *hard_iface; |
193 | struct delayed_work *delayed_work = | 193 | struct delayed_work *delayed_work; |
194 | container_of(work, struct delayed_work, work); | ||
195 | struct batadv_forw_packet *forw_packet; | 194 | struct batadv_forw_packet *forw_packet; |
196 | struct sk_buff *skb1; | 195 | struct sk_buff *skb1; |
197 | struct net_device *soft_iface; | 196 | struct net_device *soft_iface; |
198 | struct batadv_priv *bat_priv; | 197 | struct batadv_priv *bat_priv; |
199 | 198 | ||
199 | delayed_work = container_of(work, struct delayed_work, work); | ||
200 | forw_packet = container_of(delayed_work, struct batadv_forw_packet, | 200 | forw_packet = container_of(delayed_work, struct batadv_forw_packet, |
201 | delayed_work); | 201 | delayed_work); |
202 | soft_iface = forw_packet->if_incoming->soft_iface; | 202 | soft_iface = forw_packet->if_incoming->soft_iface; |
@@ -239,11 +239,11 @@ out: | |||
239 | 239 | ||
240 | void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work) | 240 | void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work) |
241 | { | 241 | { |
242 | struct delayed_work *delayed_work = | 242 | struct delayed_work *delayed_work; |
243 | container_of(work, struct delayed_work, work); | ||
244 | struct batadv_forw_packet *forw_packet; | 243 | struct batadv_forw_packet *forw_packet; |
245 | struct batadv_priv *bat_priv; | 244 | struct batadv_priv *bat_priv; |
246 | 245 | ||
246 | delayed_work = container_of(work, struct delayed_work, work); | ||
247 | forw_packet = container_of(delayed_work, struct batadv_forw_packet, | 247 | forw_packet = container_of(delayed_work, struct batadv_forw_packet, |
248 | delayed_work); | 248 | delayed_work); |
249 | bat_priv = netdev_priv(forw_packet->if_incoming->soft_iface); | 249 | bat_priv = netdev_priv(forw_packet->if_incoming->soft_iface); |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 6d44625c0f5e..03b0763abd2f 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -149,6 +149,7 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
149 | int data_len = skb->len, ret; | 149 | int data_len = skb->len, ret; |
150 | short vid __maybe_unused = -1; | 150 | short vid __maybe_unused = -1; |
151 | bool do_bcast = false; | 151 | bool do_bcast = false; |
152 | uint32_t seqno; | ||
152 | 153 | ||
153 | if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) | 154 | if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) |
154 | goto dropped; | 155 | goto dropped; |
@@ -230,8 +231,8 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
230 | primary_if->net_dev->dev_addr, ETH_ALEN); | 231 | primary_if->net_dev->dev_addr, ETH_ALEN); |
231 | 232 | ||
232 | /* set broadcast sequence number */ | 233 | /* set broadcast sequence number */ |
233 | bcast_packet->seqno = | 234 | seqno = atomic_inc_return(&bat_priv->bcast_seqno); |
234 | htonl(atomic_inc_return(&bat_priv->bcast_seqno)); | 235 | bcast_packet->seqno = htonl(seqno); |
235 | 236 | ||
236 | batadv_add_bcast_packet_to_list(bat_priv, skb, 1); | 237 | batadv_add_bcast_packet_to_list(bat_priv, skb, 1); |
237 | 238 | ||
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index 00164645b3f7..d7904bdb1ff9 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c | |||
@@ -121,6 +121,7 @@ batadv_frag_search_packet(struct list_head *head, | |||
121 | { | 121 | { |
122 | struct batadv_frag_packet_list_entry *tfp; | 122 | struct batadv_frag_packet_list_entry *tfp; |
123 | struct batadv_unicast_frag_packet *tmp_up = NULL; | 123 | struct batadv_unicast_frag_packet *tmp_up = NULL; |
124 | int is_head_tmp, is_head; | ||
124 | uint16_t search_seqno; | 125 | uint16_t search_seqno; |
125 | 126 | ||
126 | if (up->flags & BATADV_UNI_FRAG_HEAD) | 127 | if (up->flags & BATADV_UNI_FRAG_HEAD) |
@@ -128,6 +129,8 @@ batadv_frag_search_packet(struct list_head *head, | |||
128 | else | 129 | else |
129 | search_seqno = ntohs(up->seqno)-1; | 130 | search_seqno = ntohs(up->seqno)-1; |
130 | 131 | ||
132 | is_head = !!(up->flags & BATADV_UNI_FRAG_HEAD); | ||
133 | |||
131 | list_for_each_entry(tfp, head, list) { | 134 | list_for_each_entry(tfp, head, list) { |
132 | 135 | ||
133 | if (!tfp->skb) | 136 | if (!tfp->skb) |
@@ -139,9 +142,8 @@ batadv_frag_search_packet(struct list_head *head, | |||
139 | tmp_up = (struct batadv_unicast_frag_packet *)tfp->skb->data; | 142 | tmp_up = (struct batadv_unicast_frag_packet *)tfp->skb->data; |
140 | 143 | ||
141 | if (tfp->seqno == search_seqno) { | 144 | if (tfp->seqno == search_seqno) { |
142 | 145 | is_head_tmp = !!(tmp_up->flags & BATADV_UNI_FRAG_HEAD); | |
143 | if ((tmp_up->flags & BATADV_UNI_FRAG_HEAD) != | 146 | if (is_head_tmp != is_head) |
144 | (up->flags & BATADV_UNI_FRAG_HEAD)) | ||
145 | return tfp; | 147 | return tfp; |
146 | else | 148 | else |
147 | goto mov_tail; | 149 | goto mov_tail; |
@@ -334,8 +336,7 @@ find_router: | |||
334 | /* copy the destination for faster routing */ | 336 | /* copy the destination for faster routing */ |
335 | memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); | 337 | memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); |
336 | /* set the destination tt version number */ | 338 | /* set the destination tt version number */ |
337 | unicast_packet->ttvn = | 339 | unicast_packet->ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn); |
338 | (uint8_t)atomic_read(&orig_node->last_ttvn); | ||
339 | 340 | ||
340 | /* inform the destination node that we are still missing a correct route | 341 | /* inform the destination node that we are still missing a correct route |
341 | * for this client. The destination will receive this packet and will | 342 | * for this client. The destination will receive this packet and will |
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index 4608c1b22d44..55cc51bcc110 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -814,12 +814,12 @@ out: | |||
814 | /* called from timer; send (and maybe generate) vis packet. */ | 814 | /* called from timer; send (and maybe generate) vis packet. */ |
815 | static void batadv_send_vis_packets(struct work_struct *work) | 815 | static void batadv_send_vis_packets(struct work_struct *work) |
816 | { | 816 | { |
817 | struct delayed_work *delayed_work = | 817 | struct delayed_work *delayed_work; |
818 | container_of(work, struct delayed_work, work); | ||
819 | struct batadv_priv *bat_priv; | 818 | struct batadv_priv *bat_priv; |
820 | struct batadv_priv_vis *priv_vis; | 819 | struct batadv_priv_vis *priv_vis; |
821 | struct batadv_vis_info *info; | 820 | struct batadv_vis_info *info; |
822 | 821 | ||
822 | delayed_work = container_of(work, struct delayed_work, work); | ||
823 | priv_vis = container_of(delayed_work, struct batadv_priv_vis, work); | 823 | priv_vis = container_of(delayed_work, struct batadv_priv_vis, work); |
824 | bat_priv = container_of(priv_vis, struct batadv_priv, vis); | 824 | bat_priv = container_of(priv_vis, struct batadv_priv, vis); |
825 | spin_lock_bh(&bat_priv->vis.hash_lock); | 825 | spin_lock_bh(&bat_priv->vis.hash_lock); |