aboutsummaryrefslogtreecommitdiffstats
path: root/net/netrom/nr_route.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/netrom/nr_route.c')
-rw-r--r--net/netrom/nr_route.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index 70ffff76a967..b976d5eff2de 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -49,10 +49,9 @@ static struct nr_node *nr_node_get(ax25_address *callsign)
49{ 49{
50 struct nr_node *found = NULL; 50 struct nr_node *found = NULL;
51 struct nr_node *nr_node; 51 struct nr_node *nr_node;
52 struct hlist_node *node;
53 52
54 spin_lock_bh(&nr_node_list_lock); 53 spin_lock_bh(&nr_node_list_lock);
55 nr_node_for_each(nr_node, node, &nr_node_list) 54 nr_node_for_each(nr_node, &nr_node_list)
56 if (ax25cmp(callsign, &nr_node->callsign) == 0) { 55 if (ax25cmp(callsign, &nr_node->callsign) == 0) {
57 nr_node_hold(nr_node); 56 nr_node_hold(nr_node);
58 found = nr_node; 57 found = nr_node;
@@ -67,10 +66,9 @@ static struct nr_neigh *nr_neigh_get_dev(ax25_address *callsign,
67{ 66{
68 struct nr_neigh *found = NULL; 67 struct nr_neigh *found = NULL;
69 struct nr_neigh *nr_neigh; 68 struct nr_neigh *nr_neigh;
70 struct hlist_node *node;
71 69
72 spin_lock_bh(&nr_neigh_list_lock); 70 spin_lock_bh(&nr_neigh_list_lock);
73 nr_neigh_for_each(nr_neigh, node, &nr_neigh_list) 71 nr_neigh_for_each(nr_neigh, &nr_neigh_list)
74 if (ax25cmp(callsign, &nr_neigh->callsign) == 0 && 72 if (ax25cmp(callsign, &nr_neigh->callsign) == 0 &&
75 nr_neigh->dev == dev) { 73 nr_neigh->dev == dev) {
76 nr_neigh_hold(nr_neigh); 74 nr_neigh_hold(nr_neigh);
@@ -114,10 +112,9 @@ static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic,
114 */ 112 */
115 if (nr_neigh != NULL && nr_neigh->failed != 0 && quality == 0) { 113 if (nr_neigh != NULL && nr_neigh->failed != 0 && quality == 0) {
116 struct nr_node *nr_nodet; 114 struct nr_node *nr_nodet;
117 struct hlist_node *node;
118 115
119 spin_lock_bh(&nr_node_list_lock); 116 spin_lock_bh(&nr_node_list_lock);
120 nr_node_for_each(nr_nodet, node, &nr_node_list) { 117 nr_node_for_each(nr_nodet, &nr_node_list) {
121 nr_node_lock(nr_nodet); 118 nr_node_lock(nr_nodet);
122 for (i = 0; i < nr_nodet->count; i++) 119 for (i = 0; i < nr_nodet->count; i++)
123 if (nr_nodet->routes[i].neighbour == nr_neigh) 120 if (nr_nodet->routes[i].neighbour == nr_neigh)
@@ -485,11 +482,11 @@ static int nr_dec_obs(void)
485{ 482{
486 struct nr_neigh *nr_neigh; 483 struct nr_neigh *nr_neigh;
487 struct nr_node *s; 484 struct nr_node *s;
488 struct hlist_node *node, *nodet; 485 struct hlist_node *nodet;
489 int i; 486 int i;
490 487
491 spin_lock_bh(&nr_node_list_lock); 488 spin_lock_bh(&nr_node_list_lock);
492 nr_node_for_each_safe(s, node, nodet, &nr_node_list) { 489 nr_node_for_each_safe(s, nodet, &nr_node_list) {
493 nr_node_lock(s); 490 nr_node_lock(s);
494 for (i = 0; i < s->count; i++) { 491 for (i = 0; i < s->count; i++) {
495 switch (s->routes[i].obs_count) { 492 switch (s->routes[i].obs_count) {
@@ -540,15 +537,15 @@ static int nr_dec_obs(void)
540void nr_rt_device_down(struct net_device *dev) 537void nr_rt_device_down(struct net_device *dev)
541{ 538{
542 struct nr_neigh *s; 539 struct nr_neigh *s;
543 struct hlist_node *node, *nodet, *node2, *node2t; 540 struct hlist_node *nodet, *node2t;
544 struct nr_node *t; 541 struct nr_node *t;
545 int i; 542 int i;
546 543
547 spin_lock_bh(&nr_neigh_list_lock); 544 spin_lock_bh(&nr_neigh_list_lock);
548 nr_neigh_for_each_safe(s, node, nodet, &nr_neigh_list) { 545 nr_neigh_for_each_safe(s, nodet, &nr_neigh_list) {
549 if (s->dev == dev) { 546 if (s->dev == dev) {
550 spin_lock_bh(&nr_node_list_lock); 547 spin_lock_bh(&nr_node_list_lock);
551 nr_node_for_each_safe(t, node2, node2t, &nr_node_list) { 548 nr_node_for_each_safe(t, node2t, &nr_node_list) {
552 nr_node_lock(t); 549 nr_node_lock(t);
553 for (i = 0; i < t->count; i++) { 550 for (i = 0; i < t->count; i++) {
554 if (t->routes[i].neighbour == s) { 551 if (t->routes[i].neighbour == s) {
@@ -737,11 +734,10 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg)
737void nr_link_failed(ax25_cb *ax25, int reason) 734void nr_link_failed(ax25_cb *ax25, int reason)
738{ 735{
739 struct nr_neigh *s, *nr_neigh = NULL; 736 struct nr_neigh *s, *nr_neigh = NULL;
740 struct hlist_node *node;
741 struct nr_node *nr_node = NULL; 737 struct nr_node *nr_node = NULL;
742 738
743 spin_lock_bh(&nr_neigh_list_lock); 739 spin_lock_bh(&nr_neigh_list_lock);
744 nr_neigh_for_each(s, node, &nr_neigh_list) { 740 nr_neigh_for_each(s, &nr_neigh_list) {
745 if (s->ax25 == ax25) { 741 if (s->ax25 == ax25) {
746 nr_neigh_hold(s); 742 nr_neigh_hold(s);
747 nr_neigh = s; 743 nr_neigh = s;
@@ -761,7 +757,7 @@ void nr_link_failed(ax25_cb *ax25, int reason)
761 return; 757 return;
762 } 758 }
763 spin_lock_bh(&nr_node_list_lock); 759 spin_lock_bh(&nr_node_list_lock);
764 nr_node_for_each(nr_node, node, &nr_node_list) { 760 nr_node_for_each(nr_node, &nr_node_list) {
765 nr_node_lock(nr_node); 761 nr_node_lock(nr_node);
766 if (nr_node->which < nr_node->count && 762 if (nr_node->which < nr_node->count &&
767 nr_node->routes[nr_node->which].neighbour == nr_neigh) 763 nr_node->routes[nr_node->which].neighbour == nr_neigh)
@@ -1013,16 +1009,16 @@ void __exit nr_rt_free(void)
1013{ 1009{
1014 struct nr_neigh *s = NULL; 1010 struct nr_neigh *s = NULL;
1015 struct nr_node *t = NULL; 1011 struct nr_node *t = NULL;
1016 struct hlist_node *node, *nodet; 1012 struct hlist_node *nodet;
1017 1013
1018 spin_lock_bh(&nr_neigh_list_lock); 1014 spin_lock_bh(&nr_neigh_list_lock);
1019 spin_lock_bh(&nr_node_list_lock); 1015 spin_lock_bh(&nr_node_list_lock);
1020 nr_node_for_each_safe(t, node, nodet, &nr_node_list) { 1016 nr_node_for_each_safe(t, nodet, &nr_node_list) {
1021 nr_node_lock(t); 1017 nr_node_lock(t);
1022 nr_remove_node_locked(t); 1018 nr_remove_node_locked(t);
1023 nr_node_unlock(t); 1019 nr_node_unlock(t);
1024 } 1020 }
1025 nr_neigh_for_each_safe(s, node, nodet, &nr_neigh_list) { 1021 nr_neigh_for_each_safe(s, nodet, &nr_neigh_list) {
1026 while(s->count) { 1022 while(s->count) {
1027 s->count--; 1023 s->count--;
1028 nr_neigh_put(s); 1024 nr_neigh_put(s);