aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/bcast.c58
-rw-r--r--net/tipc/bearer.c20
-rw-r--r--net/tipc/cluster.c22
-rw-r--r--net/tipc/cluster.h2
-rw-r--r--net/tipc/config.c4
-rw-r--r--net/tipc/dbg.c4
-rw-r--r--net/tipc/discover.c8
-rw-r--r--net/tipc/eth_media.c4
-rw-r--r--net/tipc/link.c89
-rw-r--r--net/tipc/name_distr.c6
-rw-r--r--net/tipc/name_table.c62
-rw-r--r--net/tipc/net.c7
-rw-r--r--net/tipc/node.c20
-rw-r--r--net/tipc/node.h2
-rw-r--r--net/tipc/node_subscr.c2
-rw-r--r--net/tipc/port.c57
-rw-r--r--net/tipc/ref.c8
-rw-r--r--net/tipc/ref.h4
-rw-r--r--net/tipc/socket.c28
-rw-r--r--net/tipc/subscr.c30
-rw-r--r--net/tipc/user_reg.c4
-rw-r--r--net/tipc/zone.c12
22 files changed, 231 insertions, 222 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index a7b04f397c12..2c4ecbe50082 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -107,22 +107,22 @@ static spinlock_t bc_lock = SPIN_LOCK_UNLOCKED;
107char tipc_bclink_name[] = "multicast-link"; 107char tipc_bclink_name[] = "multicast-link";
108 108
109 109
110static inline u32 buf_seqno(struct sk_buff *buf) 110static u32 buf_seqno(struct sk_buff *buf)
111{ 111{
112 return msg_seqno(buf_msg(buf)); 112 return msg_seqno(buf_msg(buf));
113} 113}
114 114
115static inline u32 bcbuf_acks(struct sk_buff *buf) 115static u32 bcbuf_acks(struct sk_buff *buf)
116{ 116{
117 return (u32)(unsigned long)TIPC_SKB_CB(buf)->handle; 117 return (u32)(unsigned long)TIPC_SKB_CB(buf)->handle;
118} 118}
119 119
120static inline void bcbuf_set_acks(struct sk_buff *buf, u32 acks) 120static void bcbuf_set_acks(struct sk_buff *buf, u32 acks)
121{ 121{
122 TIPC_SKB_CB(buf)->handle = (void *)(unsigned long)acks; 122 TIPC_SKB_CB(buf)->handle = (void *)(unsigned long)acks;
123} 123}
124 124
125static inline void bcbuf_decr_acks(struct sk_buff *buf) 125static void bcbuf_decr_acks(struct sk_buff *buf)
126{ 126{
127 bcbuf_set_acks(buf, bcbuf_acks(buf) - 1); 127 bcbuf_set_acks(buf, bcbuf_acks(buf) - 1);
128} 128}
@@ -134,7 +134,7 @@ static inline void bcbuf_decr_acks(struct sk_buff *buf)
134 * Called with 'node' locked, bc_lock unlocked 134 * Called with 'node' locked, bc_lock unlocked
135 */ 135 */
136 136
137static inline void bclink_set_gap(struct node *n_ptr) 137static void bclink_set_gap(struct node *n_ptr)
138{ 138{
139 struct sk_buff *buf = n_ptr->bclink.deferred_head; 139 struct sk_buff *buf = n_ptr->bclink.deferred_head;
140 140
@@ -154,7 +154,7 @@ static inline void bclink_set_gap(struct node *n_ptr)
154 * distribute NACKs, but tries to use the same spacing (divide by 16). 154 * distribute NACKs, but tries to use the same spacing (divide by 16).
155 */ 155 */
156 156
157static inline int bclink_ack_allowed(u32 n) 157static int bclink_ack_allowed(u32 n)
158{ 158{
159 return((n % TIPC_MIN_LINK_WIN) == tipc_own_tag); 159 return((n % TIPC_MIN_LINK_WIN) == tipc_own_tag);
160} 160}
@@ -271,7 +271,7 @@ static void bclink_send_nack(struct node *n_ptr)
271 msg_set_bcgap_to(msg, n_ptr->bclink.gap_to); 271 msg_set_bcgap_to(msg, n_ptr->bclink.gap_to);
272 msg_set_bcast_tag(msg, tipc_own_tag); 272 msg_set_bcast_tag(msg, tipc_own_tag);
273 273
274 if (tipc_bearer_send(&bcbearer->bearer, buf, 0)) { 274 if (tipc_bearer_send(&bcbearer->bearer, buf, NULL)) {
275 bcl->stats.sent_nacks++; 275 bcl->stats.sent_nacks++;
276 buf_discard(buf); 276 buf_discard(buf);
277 } else { 277 } else {
@@ -314,7 +314,7 @@ void tipc_bclink_check_gap(struct node *n_ptr, u32 last_sent)
314 * Only tipc_net_lock set. 314 * Only tipc_net_lock set.
315 */ 315 */
316 316
317void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to) 317static void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to)
318{ 318{
319 struct node *n_ptr = tipc_node_find(dest); 319 struct node *n_ptr = tipc_node_find(dest);
320 u32 my_after, my_to; 320 u32 my_after, my_to;
@@ -425,9 +425,9 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
425 msg_bcgap_to(msg)); 425 msg_bcgap_to(msg));
426 } else { 426 } else {
427 tipc_bclink_peek_nack(msg_destnode(msg), 427 tipc_bclink_peek_nack(msg_destnode(msg),
428 msg_bcast_tag(msg), 428 msg_bcast_tag(msg),
429 msg_bcgap_after(msg), 429 msg_bcgap_after(msg),
430 msg_bcgap_to(msg)); 430 msg_bcgap_to(msg));
431 } 431 }
432 buf_discard(buf); 432 buf_discard(buf);
433 return; 433 return;
@@ -525,16 +525,18 @@ u32 tipc_bclink_acks_missing(struct node *n_ptr)
525 * Returns 0 if packet sent successfully, non-zero if not 525 * Returns 0 if packet sent successfully, non-zero if not
526 */ 526 */
527 527
528int tipc_bcbearer_send(struct sk_buff *buf, 528static int tipc_bcbearer_send(struct sk_buff *buf,
529 struct tipc_bearer *unused1, 529 struct tipc_bearer *unused1,
530 struct tipc_media_addr *unused2) 530 struct tipc_media_addr *unused2)
531{ 531{
532 static int send_count = 0; 532 static int send_count = 0;
533 533
534 struct node_map remains; 534 struct node_map *remains;
535 struct node_map remains_new; 535 struct node_map *remains_new;
536 struct node_map *remains_tmp;
536 int bp_index; 537 int bp_index;
537 int swap_time; 538 int swap_time;
539 int err;
538 540
539 /* Prepare buffer for broadcasting (if first time trying to send it) */ 541 /* Prepare buffer for broadcasting (if first time trying to send it) */
540 542
@@ -555,7 +557,9 @@ int tipc_bcbearer_send(struct sk_buff *buf,
555 557
556 /* Send buffer over bearers until all targets reached */ 558 /* Send buffer over bearers until all targets reached */
557 559
558 remains = tipc_cltr_bcast_nodes; 560 remains = kmalloc(sizeof(struct node_map), GFP_ATOMIC);
561 remains_new = kmalloc(sizeof(struct node_map), GFP_ATOMIC);
562 *remains = tipc_cltr_bcast_nodes;
559 563
560 for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { 564 for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) {
561 struct bearer *p = bcbearer->bpairs[bp_index].primary; 565 struct bearer *p = bcbearer->bpairs[bp_index].primary;
@@ -564,8 +568,8 @@ int tipc_bcbearer_send(struct sk_buff *buf,
564 if (!p) 568 if (!p)
565 break; /* no more bearers to try */ 569 break; /* no more bearers to try */
566 570
567 tipc_nmap_diff(&remains, &p->nodes, &remains_new); 571 tipc_nmap_diff(remains, &p->nodes, remains_new);
568 if (remains_new.count == remains.count) 572 if (remains_new->count == remains->count)
569 continue; /* bearer pair doesn't add anything */ 573 continue; /* bearer pair doesn't add anything */
570 574
571 if (!p->publ.blocked && 575 if (!p->publ.blocked &&
@@ -583,17 +587,27 @@ swap:
583 bcbearer->bpairs[bp_index].primary = s; 587 bcbearer->bpairs[bp_index].primary = s;
584 bcbearer->bpairs[bp_index].secondary = p; 588 bcbearer->bpairs[bp_index].secondary = p;
585update: 589update:
586 if (remains_new.count == 0) 590 if (remains_new->count == 0) {
587 return TIPC_OK; 591 err = TIPC_OK;
592 goto out;
593 }
588 594
595 /* swap map */
596 remains_tmp = remains;
589 remains = remains_new; 597 remains = remains_new;
598 remains_new = remains_tmp;
590 } 599 }
591 600
592 /* Unable to reach all targets */ 601 /* Unable to reach all targets */
593 602
594 bcbearer->bearer.publ.blocked = 1; 603 bcbearer->bearer.publ.blocked = 1;
595 bcl->stats.bearer_congs++; 604 bcl->stats.bearer_congs++;
596 return ~TIPC_OK; 605 err = ~TIPC_OK;
606
607 out:
608 kfree(remains_new);
609 kfree(remains);
610 return err;
597} 611}
598 612
599/** 613/**
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 64dcb0f3a8b2..e213a8e54855 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -45,10 +45,10 @@
45 45
46#define MAX_ADDR_STR 32 46#define MAX_ADDR_STR 32
47 47
48static struct media *media_list = 0; 48static struct media *media_list = NULL;
49static u32 media_count = 0; 49static u32 media_count = 0;
50 50
51struct bearer *tipc_bearers = 0; 51struct bearer *tipc_bearers = NULL;
52 52
53/** 53/**
54 * media_name_valid - validate media name 54 * media_name_valid - validate media name
@@ -79,7 +79,7 @@ static struct media *media_find(const char *name)
79 if (!strcmp(m_ptr->name, name)) 79 if (!strcmp(m_ptr->name, name))
80 return m_ptr; 80 return m_ptr;
81 } 81 }
82 return 0; 82 return NULL;
83} 83}
84 84
85/** 85/**
@@ -287,7 +287,7 @@ static struct bearer *bearer_find(const char *name)
287 if (b_ptr->active && (!strcmp(b_ptr->publ.name, name))) 287 if (b_ptr->active && (!strcmp(b_ptr->publ.name, name)))
288 return b_ptr; 288 return b_ptr;
289 } 289 }
290 return 0; 290 return NULL;
291} 291}
292 292
293/** 293/**
@@ -307,7 +307,7 @@ struct bearer *tipc_bearer_find_interface(const char *if_name)
307 if (!strcmp(b_if_name, if_name)) 307 if (!strcmp(b_if_name, if_name))
308 return b_ptr; 308 return b_ptr;
309 } 309 }
310 return 0; 310 return NULL;
311} 311}
312 312
313/** 313/**
@@ -569,7 +569,7 @@ failed:
569 569
570int tipc_block_bearer(const char *name) 570int tipc_block_bearer(const char *name)
571{ 571{
572 struct bearer *b_ptr = 0; 572 struct bearer *b_ptr = NULL;
573 struct link *l_ptr; 573 struct link *l_ptr;
574 struct link *temp_l_ptr; 574 struct link *temp_l_ptr;
575 575
@@ -666,8 +666,8 @@ int tipc_bearer_init(void)
666 } else { 666 } else {
667 kfree(tipc_bearers); 667 kfree(tipc_bearers);
668 kfree(media_list); 668 kfree(media_list);
669 tipc_bearers = 0; 669 tipc_bearers = NULL;
670 media_list = 0; 670 media_list = NULL;
671 res = -ENOMEM; 671 res = -ENOMEM;
672 } 672 }
673 write_unlock_bh(&tipc_net_lock); 673 write_unlock_bh(&tipc_net_lock);
@@ -691,8 +691,8 @@ void tipc_bearer_stop(void)
691 } 691 }
692 kfree(tipc_bearers); 692 kfree(tipc_bearers);
693 kfree(media_list); 693 kfree(media_list);
694 tipc_bearers = 0; 694 tipc_bearers = NULL;
695 media_list = 0; 695 media_list = NULL;
696 media_count = 0; 696 media_count = 0;
697} 697}
698 698
diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c
index ab974ca19371..1aed81584e96 100644
--- a/net/tipc/cluster.c
+++ b/net/tipc/cluster.c
@@ -44,11 +44,11 @@
44#include "msg.h" 44#include "msg.h"
45#include "bearer.h" 45#include "bearer.h"
46 46
47void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf, 47static void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf,
48 u32 lower, u32 upper); 48 u32 lower, u32 upper);
49struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest); 49static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest);
50 50
51struct node **tipc_local_nodes = 0; 51struct node **tipc_local_nodes = NULL;
52struct node_map tipc_cltr_bcast_nodes = {0,{0,}}; 52struct node_map tipc_cltr_bcast_nodes = {0,{0,}};
53u32 tipc_highest_allowed_slave = 0; 53u32 tipc_highest_allowed_slave = 0;
54 54
@@ -61,7 +61,7 @@ struct cluster *tipc_cltr_create(u32 addr)
61 61
62 c_ptr = (struct cluster *)kmalloc(sizeof(*c_ptr), GFP_ATOMIC); 62 c_ptr = (struct cluster *)kmalloc(sizeof(*c_ptr), GFP_ATOMIC);
63 if (c_ptr == NULL) 63 if (c_ptr == NULL)
64 return 0; 64 return NULL;
65 memset(c_ptr, 0, sizeof(*c_ptr)); 65 memset(c_ptr, 0, sizeof(*c_ptr));
66 66
67 c_ptr->addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); 67 c_ptr->addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
@@ -73,7 +73,7 @@ struct cluster *tipc_cltr_create(u32 addr)
73 c_ptr->nodes = (struct node **)kmalloc(alloc, GFP_ATOMIC); 73 c_ptr->nodes = (struct node **)kmalloc(alloc, GFP_ATOMIC);
74 if (c_ptr->nodes == NULL) { 74 if (c_ptr->nodes == NULL) {
75 kfree(c_ptr); 75 kfree(c_ptr);
76 return 0; 76 return NULL;
77 } 77 }
78 memset(c_ptr->nodes, 0, alloc); 78 memset(c_ptr->nodes, 0, alloc);
79 if (in_own_cluster(addr)) 79 if (in_own_cluster(addr))
@@ -91,7 +91,7 @@ struct cluster *tipc_cltr_create(u32 addr)
91 } 91 }
92 else { 92 else {
93 kfree(c_ptr); 93 kfree(c_ptr);
94 c_ptr = 0; 94 c_ptr = NULL;
95 } 95 }
96 96
97 return c_ptr; 97 return c_ptr;
@@ -204,7 +204,7 @@ struct node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector)
204 204
205 assert(!in_own_cluster(c_ptr->addr)); 205 assert(!in_own_cluster(c_ptr->addr));
206 if (!c_ptr->highest_node) 206 if (!c_ptr->highest_node)
207 return 0; 207 return NULL;
208 208
209 /* Start entry must be random */ 209 /* Start entry must be random */
210 while (mask > c_ptr->highest_node) { 210 while (mask > c_ptr->highest_node) {
@@ -222,14 +222,14 @@ struct node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector)
222 if (tipc_node_has_active_links(c_ptr->nodes[n_num])) 222 if (tipc_node_has_active_links(c_ptr->nodes[n_num]))
223 return c_ptr->nodes[n_num]; 223 return c_ptr->nodes[n_num];
224 } 224 }
225 return 0; 225 return NULL;
226} 226}
227 227
228/* 228/*
229 * Routing table management: See description in node.c 229 * Routing table management: See description in node.c
230 */ 230 */
231 231
232struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest) 232static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest)
233{ 233{
234 u32 size = INT_H_SIZE + data_size; 234 u32 size = INT_H_SIZE + data_size;
235 struct sk_buff *buf = buf_acquire(size); 235 struct sk_buff *buf = buf_acquire(size);
@@ -495,7 +495,7 @@ void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router)
495 * tipc_cltr_multicast - multicast message to local nodes 495 * tipc_cltr_multicast - multicast message to local nodes
496 */ 496 */
497 497
498void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf, 498static void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf,
499 u32 lower, u32 upper) 499 u32 lower, u32 upper)
500{ 500{
501 struct sk_buff *buf_copy; 501 struct sk_buff *buf_copy;
diff --git a/net/tipc/cluster.h b/net/tipc/cluster.h
index 9963642e1058..1b4cd309495a 100644
--- a/net/tipc/cluster.h
+++ b/net/tipc/cluster.h
@@ -86,7 +86,7 @@ static inline struct cluster *tipc_cltr_find(u32 addr)
86 86
87 if (z_ptr) 87 if (z_ptr)
88 return z_ptr->clusters[1]; 88 return z_ptr->clusters[1];
89 return 0; 89 return NULL;
90} 90}
91 91
92#endif 92#endif
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 3c8e6740e5ae..48b5de2dbe60 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -683,11 +683,11 @@ int tipc_cfg_init(void)
683 memset(&mng, 0, sizeof(mng)); 683 memset(&mng, 0, sizeof(mng));
684 INIT_LIST_HEAD(&mng.link_subscribers); 684 INIT_LIST_HEAD(&mng.link_subscribers);
685 685
686 res = tipc_attach(&mng.user_ref, 0, 0); 686 res = tipc_attach(&mng.user_ref, NULL, NULL);
687 if (res) 687 if (res)
688 goto failed; 688 goto failed;
689 689
690 res = tipc_createport(mng.user_ref, 0, TIPC_CRITICAL_IMPORTANCE, 690 res = tipc_createport(mng.user_ref, NULL, TIPC_CRITICAL_IMPORTANCE,
691 NULL, NULL, NULL, 691 NULL, NULL, NULL,
692 NULL, cfg_named_msg_event, NULL, 692 NULL, cfg_named_msg_event, NULL,
693 NULL, &mng.port_ref); 693 NULL, &mng.port_ref);
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c
index 4f4beefa7830..26ef95d5fe38 100644
--- a/net/tipc/dbg.c
+++ b/net/tipc/dbg.c
@@ -81,7 +81,7 @@ void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 sz)
81 81
82 pb->crs = pb->buf = raw; 82 pb->crs = pb->buf = raw;
83 pb->size = sz; 83 pb->size = sz;
84 pb->next = 0; 84 pb->next = NULL;
85 pb->buf[0] = 0; 85 pb->buf[0] = 0;
86 pb->buf[sz-1] = ~0; 86 pb->buf[sz-1] = ~0;
87} 87}
@@ -216,7 +216,7 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
216 } 216 }
217 } 217 }
218 pb_next = pb->next; 218 pb_next = pb->next;
219 pb->next = 0; 219 pb->next = NULL;
220 pb = pb_next; 220 pb = pb_next;
221 } 221 }
222 spin_unlock_bh(&print_lock); 222 spin_unlock_bh(&print_lock);
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 53ba4630c10d..92601385e5f5 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -110,10 +110,10 @@ void tipc_disc_link_event(u32 addr, char *name, int up)
110 * @b_ptr: ptr to bearer issuing message 110 * @b_ptr: ptr to bearer issuing message
111 */ 111 */
112 112
113struct sk_buff *tipc_disc_init_msg(u32 type, 113static struct sk_buff *tipc_disc_init_msg(u32 type,
114 u32 req_links, 114 u32 req_links,
115 u32 dest_domain, 115 u32 dest_domain,
116 struct bearer *b_ptr) 116 struct bearer *b_ptr)
117{ 117{
118 struct sk_buff *buf = buf_acquire(DSC_H_SIZE); 118 struct sk_buff *buf = buf_acquire(DSC_H_SIZE);
119 struct tipc_msg *msg; 119 struct tipc_msg *msg;
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index 1f8d83b9c8b4..7a252785f727 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -169,7 +169,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
169 169
170static void disable_bearer(struct tipc_bearer *tb_ptr) 170static void disable_bearer(struct tipc_bearer *tb_ptr)
171{ 171{
172 ((struct eth_bearer *)tb_ptr->usr_handle)->bearer = 0; 172 ((struct eth_bearer *)tb_ptr->usr_handle)->bearer = NULL;
173} 173}
174 174
175/** 175/**
@@ -285,7 +285,7 @@ void tipc_eth_media_stop(void)
285 for (i = 0; i < MAX_ETH_BEARERS ; i++) { 285 for (i = 0; i < MAX_ETH_BEARERS ; i++) {
286 if (eth_bearers[i].bearer) { 286 if (eth_bearers[i].bearer) {
287 eth_bearers[i].bearer->blocked = 1; 287 eth_bearers[i].bearer->blocked = 1;
288 eth_bearers[i].bearer = 0; 288 eth_bearers[i].bearer = NULL;
289 } 289 }
290 if (eth_bearers[i].dev) { 290 if (eth_bearers[i].dev) {
291 dev_remove_pack(&eth_bearers[i].tipc_packet_type); 291 dev_remove_pack(&eth_bearers[i].tipc_packet_type);
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 511872afa459..910b37e5083d 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -157,13 +157,13 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
157 } \ 157 } \
158} while (0) 158} while (0)
159 159
160static inline void dbg_print_link(struct link *l_ptr, const char *str) 160static void dbg_print_link(struct link *l_ptr, const char *str)
161{ 161{
162 if (DBG_OUTPUT) 162 if (DBG_OUTPUT)
163 link_print(l_ptr, DBG_OUTPUT, str); 163 link_print(l_ptr, DBG_OUTPUT, str);
164} 164}
165 165
166static inline void dbg_print_buf_chain(struct sk_buff *root_buf) 166static void dbg_print_buf_chain(struct sk_buff *root_buf)
167{ 167{
168 if (DBG_OUTPUT) { 168 if (DBG_OUTPUT) {
169 struct sk_buff *buf = root_buf; 169 struct sk_buff *buf = root_buf;
@@ -176,50 +176,50 @@ static inline void dbg_print_buf_chain(struct sk_buff *root_buf)
176} 176}
177 177
178/* 178/*
179 * Simple inlined link routines 179 * Simple link routines
180 */ 180 */
181 181
182static inline unsigned int align(unsigned int i) 182static unsigned int align(unsigned int i)
183{ 183{
184 return (i + 3) & ~3u; 184 return (i + 3) & ~3u;
185} 185}
186 186
187static inline int link_working_working(struct link *l_ptr) 187static int link_working_working(struct link *l_ptr)
188{ 188{
189 return (l_ptr->state == WORKING_WORKING); 189 return (l_ptr->state == WORKING_WORKING);
190} 190}
191 191
192static inline int link_working_unknown(struct link *l_ptr) 192static int link_working_unknown(struct link *l_ptr)
193{ 193{
194 return (l_ptr->state == WORKING_UNKNOWN); 194 return (l_ptr->state == WORKING_UNKNOWN);
195} 195}
196 196
197static inline int link_reset_unknown(struct link *l_ptr) 197static int link_reset_unknown(struct link *l_ptr)
198{ 198{
199 return (l_ptr->state == RESET_UNKNOWN); 199 return (l_ptr->state == RESET_UNKNOWN);
200} 200}
201 201
202static inline int link_reset_reset(struct link *l_ptr) 202static int link_reset_reset(struct link *l_ptr)
203{ 203{
204 return (l_ptr->state == RESET_RESET); 204 return (l_ptr->state == RESET_RESET);
205} 205}
206 206
207static inline int link_blocked(struct link *l_ptr) 207static int link_blocked(struct link *l_ptr)
208{ 208{
209 return (l_ptr->exp_msg_count || l_ptr->blocked); 209 return (l_ptr->exp_msg_count || l_ptr->blocked);
210} 210}
211 211
212static inline int link_congested(struct link *l_ptr) 212static int link_congested(struct link *l_ptr)
213{ 213{
214 return (l_ptr->out_queue_size >= l_ptr->queue_limit[0]); 214 return (l_ptr->out_queue_size >= l_ptr->queue_limit[0]);
215} 215}
216 216
217static inline u32 link_max_pkt(struct link *l_ptr) 217static u32 link_max_pkt(struct link *l_ptr)
218{ 218{
219 return l_ptr->max_pkt; 219 return l_ptr->max_pkt;
220} 220}
221 221
222static inline void link_init_max_pkt(struct link *l_ptr) 222static void link_init_max_pkt(struct link *l_ptr)
223{ 223{
224 u32 max_pkt; 224 u32 max_pkt;
225 225
@@ -236,20 +236,20 @@ static inline void link_init_max_pkt(struct link *l_ptr)
236 l_ptr->max_pkt_probes = 0; 236 l_ptr->max_pkt_probes = 0;
237} 237}
238 238
239static inline u32 link_next_sent(struct link *l_ptr) 239static u32 link_next_sent(struct link *l_ptr)
240{ 240{
241 if (l_ptr->next_out) 241 if (l_ptr->next_out)
242 return msg_seqno(buf_msg(l_ptr->next_out)); 242 return msg_seqno(buf_msg(l_ptr->next_out));
243 return mod(l_ptr->next_out_no); 243 return mod(l_ptr->next_out_no);
244} 244}
245 245
246static inline u32 link_last_sent(struct link *l_ptr) 246static u32 link_last_sent(struct link *l_ptr)
247{ 247{
248 return mod(link_next_sent(l_ptr) - 1); 248 return mod(link_next_sent(l_ptr) - 1);
249} 249}
250 250
251/* 251/*
252 * Simple non-inlined link routines (i.e. referenced outside this file) 252 * Simple non-static link routines (i.e. referenced outside this file)
253 */ 253 */
254 254
255int tipc_link_is_up(struct link *l_ptr) 255int tipc_link_is_up(struct link *l_ptr)
@@ -396,7 +396,7 @@ static void link_timeout(struct link *l_ptr)
396 tipc_node_unlock(l_ptr->owner); 396 tipc_node_unlock(l_ptr->owner);
397} 397}
398 398
399static inline void link_set_timer(struct link *l_ptr, u32 time) 399static void link_set_timer(struct link *l_ptr, u32 time)
400{ 400{
401 k_start_timer(&l_ptr->timer, time); 401 k_start_timer(&l_ptr->timer, time);
402} 402}
@@ -573,7 +573,7 @@ void tipc_link_wakeup_ports(struct link *l_ptr, int all)
573 if (win <= 0) 573 if (win <= 0)
574 break; 574 break;
575 list_del_init(&p_ptr->wait_list); 575 list_del_init(&p_ptr->wait_list);
576 p_ptr->congested_link = 0; 576 p_ptr->congested_link = NULL;
577 assert(p_ptr->wakeup); 577 assert(p_ptr->wakeup);
578 spin_lock_bh(p_ptr->publ.lock); 578 spin_lock_bh(p_ptr->publ.lock);
579 p_ptr->publ.congested = 0; 579 p_ptr->publ.congested = 0;
@@ -1004,9 +1004,9 @@ static int link_bundle_buf(struct link *l_ptr,
1004 return 1; 1004 return 1;
1005} 1005}
1006 1006
1007static inline void link_add_to_outqueue(struct link *l_ptr, 1007static void link_add_to_outqueue(struct link *l_ptr,
1008 struct sk_buff *buf, 1008 struct sk_buff *buf,
1009 struct tipc_msg *msg) 1009 struct tipc_msg *msg)
1010{ 1010{
1011 u32 ack = mod(l_ptr->next_in_no - 1); 1011 u32 ack = mod(l_ptr->next_in_no - 1);
1012 u32 seqno = mod(l_ptr->next_out_no++); 1012 u32 seqno = mod(l_ptr->next_out_no++);
@@ -1156,8 +1156,8 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
1156 * Link is locked. Returns user data length. 1156 * Link is locked. Returns user data length.
1157 */ 1157 */
1158 1158
1159static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf, 1159static int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
1160 u32 *used_max_pkt) 1160 u32 *used_max_pkt)
1161{ 1161{
1162 struct tipc_msg *msg = buf_msg(buf); 1162 struct tipc_msg *msg = buf_msg(buf);
1163 int res = msg_data_sz(msg); 1163 int res = msg_data_sz(msg);
@@ -1355,7 +1355,7 @@ again:
1355 fragm_crs = 0; 1355 fragm_crs = 0;
1356 fragm_rest = 0; 1356 fragm_rest = 0;
1357 sect_rest = 0; 1357 sect_rest = 0;
1358 sect_crs = 0; 1358 sect_crs = NULL;
1359 curr_sect = -1; 1359 curr_sect = -1;
1360 1360
1361 /* Prepare reusable fragment header: */ 1361 /* Prepare reusable fragment header: */
@@ -1549,7 +1549,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
1549 msg_dbg(buf_msg(buf), ">DEF-PROT>"); 1549 msg_dbg(buf_msg(buf), ">DEF-PROT>");
1550 l_ptr->unacked_window = 0; 1550 l_ptr->unacked_window = 0;
1551 buf_discard(buf); 1551 buf_discard(buf);
1552 l_ptr->proto_msg_queue = 0; 1552 l_ptr->proto_msg_queue = NULL;
1553 return TIPC_OK; 1553 return TIPC_OK;
1554 } else { 1554 } else {
1555 msg_dbg(buf_msg(buf), "|>DEF-PROT>"); 1555 msg_dbg(buf_msg(buf), "|>DEF-PROT>");
@@ -1860,7 +1860,7 @@ u32 tipc_link_defer_pkt(struct sk_buff **head,
1860 struct sk_buff **tail, 1860 struct sk_buff **tail,
1861 struct sk_buff *buf) 1861 struct sk_buff *buf)
1862{ 1862{
1863 struct sk_buff *prev = 0; 1863 struct sk_buff *prev = NULL;
1864 struct sk_buff *crs = *head; 1864 struct sk_buff *crs = *head;
1865 u32 seq_no = msg_seqno(buf_msg(buf)); 1865 u32 seq_no = msg_seqno(buf_msg(buf));
1866 1866
@@ -1953,7 +1953,7 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr,
1953void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, 1953void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
1954 u32 gap, u32 tolerance, u32 priority, u32 ack_mtu) 1954 u32 gap, u32 tolerance, u32 priority, u32 ack_mtu)
1955{ 1955{
1956 struct sk_buff *buf = 0; 1956 struct sk_buff *buf = NULL;
1957 struct tipc_msg *msg = l_ptr->pmsg; 1957 struct tipc_msg *msg = l_ptr->pmsg;
1958 u32 msg_size = sizeof(l_ptr->proto_msg); 1958 u32 msg_size = sizeof(l_ptr->proto_msg);
1959 1959
@@ -2426,7 +2426,7 @@ static int link_recv_changeover_msg(struct link **l_ptr,
2426 } 2426 }
2427 } 2427 }
2428exit: 2428exit:
2429 *buf = 0; 2429 *buf = NULL;
2430 buf_discard(tunnel_buf); 2430 buf_discard(tunnel_buf);
2431 return 0; 2431 return 0;
2432} 2432}
@@ -2539,42 +2539,37 @@ exit:
2539 * pending message. This makes dynamic memory allocation unecessary. 2539 * pending message. This makes dynamic memory allocation unecessary.
2540 */ 2540 */
2541 2541
2542static inline u32 get_long_msg_seqno(struct sk_buff *buf) 2542static void set_long_msg_seqno(struct sk_buff *buf, u32 seqno)
2543{
2544 return msg_seqno(buf_msg(buf));
2545}
2546
2547static inline void set_long_msg_seqno(struct sk_buff *buf, u32 seqno)
2548{ 2543{
2549 msg_set_seqno(buf_msg(buf), seqno); 2544 msg_set_seqno(buf_msg(buf), seqno);
2550} 2545}
2551 2546
2552static inline u32 get_fragm_size(struct sk_buff *buf) 2547static u32 get_fragm_size(struct sk_buff *buf)
2553{ 2548{
2554 return msg_ack(buf_msg(buf)); 2549 return msg_ack(buf_msg(buf));
2555} 2550}
2556 2551
2557static inline void set_fragm_size(struct sk_buff *buf, u32 sz) 2552static void set_fragm_size(struct sk_buff *buf, u32 sz)
2558{ 2553{
2559 msg_set_ack(buf_msg(buf), sz); 2554 msg_set_ack(buf_msg(buf), sz);
2560} 2555}
2561 2556
2562static inline u32 get_expected_frags(struct sk_buff *buf) 2557static u32 get_expected_frags(struct sk_buff *buf)
2563{ 2558{
2564 return msg_bcast_ack(buf_msg(buf)); 2559 return msg_bcast_ack(buf_msg(buf));
2565} 2560}
2566 2561
2567static inline void set_expected_frags(struct sk_buff *buf, u32 exp) 2562static void set_expected_frags(struct sk_buff *buf, u32 exp)
2568{ 2563{
2569 msg_set_bcast_ack(buf_msg(buf), exp); 2564 msg_set_bcast_ack(buf_msg(buf), exp);
2570} 2565}
2571 2566
2572static inline u32 get_timer_cnt(struct sk_buff *buf) 2567static u32 get_timer_cnt(struct sk_buff *buf)
2573{ 2568{
2574 return msg_reroute_cnt(buf_msg(buf)); 2569 return msg_reroute_cnt(buf_msg(buf));
2575} 2570}
2576 2571
2577static inline void incr_timer_cnt(struct sk_buff *buf) 2572static void incr_timer_cnt(struct sk_buff *buf)
2578{ 2573{
2579 msg_incr_reroute_cnt(buf_msg(buf)); 2574 msg_incr_reroute_cnt(buf_msg(buf));
2580} 2575}
@@ -2586,13 +2581,13 @@ static inline void incr_timer_cnt(struct sk_buff *buf)
2586int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, 2581int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2587 struct tipc_msg **m) 2582 struct tipc_msg **m)
2588{ 2583{
2589 struct sk_buff *prev = 0; 2584 struct sk_buff *prev = NULL;
2590 struct sk_buff *fbuf = *fb; 2585 struct sk_buff *fbuf = *fb;
2591 struct tipc_msg *fragm = buf_msg(fbuf); 2586 struct tipc_msg *fragm = buf_msg(fbuf);
2592 struct sk_buff *pbuf = *pending; 2587 struct sk_buff *pbuf = *pending;
2593 u32 long_msg_seq_no = msg_long_msgno(fragm); 2588 u32 long_msg_seq_no = msg_long_msgno(fragm);
2594 2589
2595 *fb = 0; 2590 *fb = NULL;
2596 msg_dbg(fragm,"FRG<REC<"); 2591 msg_dbg(fragm,"FRG<REC<");
2597 2592
2598 /* Is there an incomplete message waiting for this fragment? */ 2593 /* Is there an incomplete message waiting for this fragment? */
@@ -2670,8 +2665,8 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2670 2665
2671static void link_check_defragm_bufs(struct link *l_ptr) 2666static void link_check_defragm_bufs(struct link *l_ptr)
2672{ 2667{
2673 struct sk_buff *prev = 0; 2668 struct sk_buff *prev = NULL;
2674 struct sk_buff *next = 0; 2669 struct sk_buff *next = NULL;
2675 struct sk_buff *buf = l_ptr->defragm_buf; 2670 struct sk_buff *buf = l_ptr->defragm_buf;
2676 2671
2677 if (!buf) 2672 if (!buf)
@@ -2750,19 +2745,19 @@ static struct link *link_find_link(const char *name, struct node **node)
2750 struct link *l_ptr; 2745 struct link *l_ptr;
2751 2746
2752 if (!link_name_validate(name, &link_name_parts)) 2747 if (!link_name_validate(name, &link_name_parts))
2753 return 0; 2748 return NULL;
2754 2749
2755 b_ptr = tipc_bearer_find_interface(link_name_parts.if_local); 2750 b_ptr = tipc_bearer_find_interface(link_name_parts.if_local);
2756 if (!b_ptr) 2751 if (!b_ptr)
2757 return 0; 2752 return NULL;
2758 2753
2759 *node = tipc_node_find(link_name_parts.addr_peer); 2754 *node = tipc_node_find(link_name_parts.addr_peer);
2760 if (!*node) 2755 if (!*node)
2761 return 0; 2756 return NULL;
2762 2757
2763 l_ptr = (*node)->links[b_ptr->identity]; 2758 l_ptr = (*node)->links[b_ptr->identity];
2764 if (!l_ptr || strcmp(l_ptr->name, name)) 2759 if (!l_ptr || strcmp(l_ptr->name, name))
2765 return 0; 2760 return NULL;
2766 2761
2767 return l_ptr; 2762 return l_ptr;
2768} 2763}
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 830f90999041..953307a9df1d 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -168,8 +168,8 @@ void tipc_named_withdraw(struct publication *publ)
168void tipc_named_node_up(unsigned long node) 168void tipc_named_node_up(unsigned long node)
169{ 169{
170 struct publication *publ; 170 struct publication *publ;
171 struct distr_item *item = 0; 171 struct distr_item *item = NULL;
172 struct sk_buff *buf = 0; 172 struct sk_buff *buf = NULL;
173 u32 left = 0; 173 u32 left = 0;
174 u32 rest; 174 u32 rest;
175 u32 max_item_buf; 175 u32 max_item_buf;
@@ -200,7 +200,7 @@ void tipc_named_node_up(unsigned long node)
200 "<%u.%u.%u>\n", tipc_zone(node), 200 "<%u.%u.%u>\n", tipc_zone(node),
201 tipc_cluster(node), tipc_node(node)); 201 tipc_cluster(node), tipc_node(node));
202 tipc_link_send(buf, node, node); 202 tipc_link_send(buf, node, node);
203 buf = 0; 203 buf = NULL;
204 } 204 }
205 } 205 }
206exit: 206exit:
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 3f4b23bd08f7..d129422fc5c2 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -46,7 +46,7 @@
46#include "cluster.h" 46#include "cluster.h"
47#include "bcast.h" 47#include "bcast.h"
48 48
49int tipc_nametbl_size = 1024; /* must be a power of 2 */ 49static int tipc_nametbl_size = 1024; /* must be a power of 2 */
50 50
51/** 51/**
52 * struct sub_seq - container for all published instances of a name sequence 52 * struct sub_seq - container for all published instances of a name sequence
@@ -104,7 +104,7 @@ static atomic_t rsv_publ_ok = ATOMIC_INIT(0);
104rwlock_t tipc_nametbl_lock = RW_LOCK_UNLOCKED; 104rwlock_t tipc_nametbl_lock = RW_LOCK_UNLOCKED;
105 105
106 106
107static inline int hash(int x) 107static int hash(int x)
108{ 108{
109 return(x & (tipc_nametbl_size - 1)); 109 return(x & (tipc_nametbl_size - 1));
110} 110}
@@ -121,7 +121,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
121 (struct publication *)kmalloc(sizeof(*publ), GFP_ATOMIC); 121 (struct publication *)kmalloc(sizeof(*publ), GFP_ATOMIC);
122 if (publ == NULL) { 122 if (publ == NULL) {
123 warn("Memory squeeze; failed to create publication\n"); 123 warn("Memory squeeze; failed to create publication\n");
124 return 0; 124 return NULL;
125 } 125 }
126 126
127 memset(publ, 0, sizeof(*publ)); 127 memset(publ, 0, sizeof(*publ));
@@ -142,7 +142,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
142 * tipc_subseq_alloc - allocate a specified number of sub-sequence structures 142 * tipc_subseq_alloc - allocate a specified number of sub-sequence structures
143 */ 143 */
144 144
145struct sub_seq *tipc_subseq_alloc(u32 cnt) 145static struct sub_seq *tipc_subseq_alloc(u32 cnt)
146{ 146{
147 u32 sz = cnt * sizeof(struct sub_seq); 147 u32 sz = cnt * sizeof(struct sub_seq);
148 struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC); 148 struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC);
@@ -158,7 +158,7 @@ struct sub_seq *tipc_subseq_alloc(u32 cnt)
158 * Allocates a single sub-sequence structure and sets it to all 0's. 158 * Allocates a single sub-sequence structure and sets it to all 0's.
159 */ 159 */
160 160
161struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head) 161static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
162{ 162{
163 struct name_seq *nseq = 163 struct name_seq *nseq =
164 (struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC); 164 (struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC);
@@ -168,7 +168,7 @@ struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
168 warn("Memory squeeze; failed to create name sequence\n"); 168 warn("Memory squeeze; failed to create name sequence\n");
169 kfree(nseq); 169 kfree(nseq);
170 kfree(sseq); 170 kfree(sseq);
171 return 0; 171 return NULL;
172 } 172 }
173 173
174 memset(nseq, 0, sizeof(*nseq)); 174 memset(nseq, 0, sizeof(*nseq));
@@ -190,8 +190,8 @@ struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
190 * Very time-critical, so binary searches through sub-sequence array. 190 * Very time-critical, so binary searches through sub-sequence array.
191 */ 191 */
192 192
193static inline struct sub_seq *nameseq_find_subseq(struct name_seq *nseq, 193static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq,
194 u32 instance) 194 u32 instance)
195{ 195{
196 struct sub_seq *sseqs = nseq->sseqs; 196 struct sub_seq *sseqs = nseq->sseqs;
197 int low = 0; 197 int low = 0;
@@ -207,7 +207,7 @@ static inline struct sub_seq *nameseq_find_subseq(struct name_seq *nseq,
207 else 207 else
208 return &sseqs[mid]; 208 return &sseqs[mid];
209 } 209 }
210 return 0; 210 return NULL;
211} 211}
212 212
213/** 213/**
@@ -243,9 +243,9 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance)
243 * tipc_nameseq_insert_publ - 243 * tipc_nameseq_insert_publ -
244 */ 244 */
245 245
246struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, 246static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
247 u32 type, u32 lower, u32 upper, 247 u32 type, u32 lower, u32 upper,
248 u32 scope, u32 node, u32 port, u32 key) 248 u32 scope, u32 node, u32 port, u32 key)
249{ 249{
250 struct subscription *s; 250 struct subscription *s;
251 struct subscription *st; 251 struct subscription *st;
@@ -263,7 +263,7 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
263 263
264 if ((sseq->lower != lower) || (sseq->upper != upper)) { 264 if ((sseq->lower != lower) || (sseq->upper != upper)) {
265 warn("Overlapping publ <%u,%u,%u>\n", type, lower, upper); 265 warn("Overlapping publ <%u,%u,%u>\n", type, lower, upper);
266 return 0; 266 return NULL;
267 } 267 }
268 } else { 268 } else {
269 u32 inspos; 269 u32 inspos;
@@ -278,7 +278,7 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
278 if ((inspos < nseq->first_free) && 278 if ((inspos < nseq->first_free) &&
279 (upper >= nseq->sseqs[inspos].lower)) { 279 (upper >= nseq->sseqs[inspos].lower)) {
280 warn("Overlapping publ <%u,%u,%u>\n", type, lower, upper); 280 warn("Overlapping publ <%u,%u,%u>\n", type, lower, upper);
281 return 0; 281 return NULL;
282 } 282 }
283 283
284 /* Ensure there is space for new sub-sequence */ 284 /* Ensure there is space for new sub-sequence */
@@ -294,7 +294,7 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
294 nseq->alloc *= 2; 294 nseq->alloc *= 2;
295 } else { 295 } else {
296 warn("Memory squeeze; failed to create sub-sequence\n"); 296 warn("Memory squeeze; failed to create sub-sequence\n");
297 return 0; 297 return NULL;
298 } 298 }
299 } 299 }
300 dbg("Have %u sseqs for type %u\n", nseq->alloc, type); 300 dbg("Have %u sseqs for type %u\n", nseq->alloc, type);
@@ -319,7 +319,7 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
319 319
320 publ = publ_create(type, lower, upper, scope, node, port, key); 320 publ = publ_create(type, lower, upper, scope, node, port, key);
321 if (!publ) 321 if (!publ)
322 return 0; 322 return NULL;
323 dbg("inserting publ %x, node=%x publ->node=%x, subscr->node=%x\n", 323 dbg("inserting publ %x, node=%x publ->node=%x, subscr->node=%x\n",
324 publ, node, publ->node, publ->subscr.node); 324 publ, node, publ->node, publ->subscr.node);
325 325
@@ -369,8 +369,8 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
369 * tipc_nameseq_remove_publ - 369 * tipc_nameseq_remove_publ -
370 */ 370 */
371 371
372struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst, 372static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
373 u32 node, u32 ref, u32 key) 373 u32 node, u32 ref, u32 key)
374{ 374{
375 struct publication *publ; 375 struct publication *publ;
376 struct publication *prev; 376 struct publication *prev;
@@ -394,7 +394,7 @@ struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
394 i, &nseq->sseqs[i], nseq->sseqs[i].lower, 394 i, &nseq->sseqs[i], nseq->sseqs[i].lower,
395 nseq->sseqs[i].upper); 395 nseq->sseqs[i].upper);
396 } 396 }
397 return 0; 397 return NULL;
398 } 398 }
399 dbg("nameseq_remove: seq: %x, sseq %x, <%u,%u> key %u\n", 399 dbg("nameseq_remove: seq: %x, sseq %x, <%u,%u> key %u\n",
400 nseq, sseq, nseq->type, inst, key); 400 nseq, sseq, nseq->type, inst, key);
@@ -413,7 +413,7 @@ struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
413 prev->zone_list_next = publ->zone_list_next; 413 prev->zone_list_next = publ->zone_list_next;
414 sseq->zone_list = publ->zone_list_next; 414 sseq->zone_list = publ->zone_list_next;
415 } else { 415 } else {
416 sseq->zone_list = 0; 416 sseq->zone_list = NULL;
417 } 417 }
418 418
419 if (in_own_cluster(node)) { 419 if (in_own_cluster(node)) {
@@ -431,7 +431,7 @@ struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
431 prev->cluster_list_next = publ->cluster_list_next; 431 prev->cluster_list_next = publ->cluster_list_next;
432 sseq->cluster_list = publ->cluster_list_next; 432 sseq->cluster_list = publ->cluster_list_next;
433 } else { 433 } else {
434 sseq->cluster_list = 0; 434 sseq->cluster_list = NULL;
435 } 435 }
436 } 436 }
437 437
@@ -450,7 +450,7 @@ struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
450 prev->node_list_next = publ->node_list_next; 450 prev->node_list_next = publ->node_list_next;
451 sseq->node_list = publ->node_list_next; 451 sseq->node_list = publ->node_list_next;
452 } else { 452 } else {
453 sseq->node_list = 0; 453 sseq->node_list = NULL;
454 } 454 }
455 } 455 }
456 assert(!publ->node || (publ->node == node)); 456 assert(!publ->node || (publ->node == node));
@@ -535,7 +535,7 @@ static struct name_seq *nametbl_find_seq(u32 type)
535 } 535 }
536 } 536 }
537 537
538 return 0; 538 return NULL;
539}; 539};
540 540
541struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, 541struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
@@ -547,7 +547,7 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
547 if (lower > upper) { 547 if (lower > upper) {
548 warn("Failed to publish illegal <%u,%u,%u>\n", 548 warn("Failed to publish illegal <%u,%u,%u>\n",
549 type, lower, upper); 549 type, lower, upper);
550 return 0; 550 return NULL;
551 } 551 }
552 552
553 dbg("Publishing <%u,%u,%u> from %x\n", type, lower, upper, node); 553 dbg("Publishing <%u,%u,%u> from %x\n", type, lower, upper, node);
@@ -556,7 +556,7 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
556 dbg("tipc_nametbl_insert_publ: created %x\n", seq); 556 dbg("tipc_nametbl_insert_publ: created %x\n", seq);
557 } 557 }
558 if (!seq) 558 if (!seq)
559 return 0; 559 return NULL;
560 560
561 assert(seq->type == type); 561 assert(seq->type == type);
562 return tipc_nameseq_insert_publ(seq, type, lower, upper, 562 return tipc_nameseq_insert_publ(seq, type, lower, upper,
@@ -570,7 +570,7 @@ struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
570 struct name_seq *seq = nametbl_find_seq(type); 570 struct name_seq *seq = nametbl_find_seq(type);
571 571
572 if (!seq) 572 if (!seq)
573 return 0; 573 return NULL;
574 574
575 dbg("Withdrawing <%u,%u> from %x\n", type, lower, node); 575 dbg("Withdrawing <%u,%u> from %x\n", type, lower, node);
576 publ = tipc_nameseq_remove_publ(seq, lower, node, ref, key); 576 publ = tipc_nameseq_remove_publ(seq, lower, node, ref, key);
@@ -594,7 +594,7 @@ struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
594u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode) 594u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode)
595{ 595{
596 struct sub_seq *sseq; 596 struct sub_seq *sseq;
597 struct publication *publ = 0; 597 struct publication *publ = NULL;
598 struct name_seq *seq; 598 struct name_seq *seq;
599 u32 ref; 599 u32 ref;
600 600
@@ -740,12 +740,12 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
740 if (table.local_publ_count >= tipc_max_publications) { 740 if (table.local_publ_count >= tipc_max_publications) {
741 warn("Failed publish: max %u local publication\n", 741 warn("Failed publish: max %u local publication\n",
742 tipc_max_publications); 742 tipc_max_publications);
743 return 0; 743 return NULL;
744 } 744 }
745 if ((type < TIPC_RESERVED_TYPES) && !atomic_read(&rsv_publ_ok)) { 745 if ((type < TIPC_RESERVED_TYPES) && !atomic_read(&rsv_publ_ok)) {
746 warn("Failed to publish reserved name <%u,%u,%u>\n", 746 warn("Failed to publish reserved name <%u,%u,%u>\n",
747 type, lower, upper); 747 type, lower, upper);
748 return 0; 748 return NULL;
749 } 749 }
750 750
751 write_lock_bh(&tipc_nametbl_lock); 751 write_lock_bh(&tipc_nametbl_lock);
@@ -983,6 +983,7 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info,
983 } 983 }
984} 984}
985 985
986#if 0
986void tipc_nametbl_print(struct print_buf *buf, const char *str) 987void tipc_nametbl_print(struct print_buf *buf, const char *str)
987{ 988{
988 tipc_printf(buf, str); 989 tipc_printf(buf, str);
@@ -990,6 +991,7 @@ void tipc_nametbl_print(struct print_buf *buf, const char *str)
990 nametbl_list(buf, 0, 0, 0, 0); 991 nametbl_list(buf, 0, 0, 0, 0);
991 read_unlock_bh(&tipc_nametbl_lock); 992 read_unlock_bh(&tipc_nametbl_lock);
992} 993}
994#endif
993 995
994#define MAX_NAME_TBL_QUERY 32768 996#define MAX_NAME_TBL_QUERY 32768
995 997
@@ -1023,10 +1025,12 @@ struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space)
1023 return buf; 1025 return buf;
1024} 1026}
1025 1027
1028#if 0
1026void tipc_nametbl_dump(void) 1029void tipc_nametbl_dump(void)
1027{ 1030{
1028 nametbl_list(TIPC_CONS, 0, 0, 0, 0); 1031 nametbl_list(TIPC_CONS, 0, 0, 0, 0);
1029} 1032}
1033#endif
1030 1034
1031int tipc_nametbl_init(void) 1035int tipc_nametbl_init(void)
1032{ 1036{
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 074891ad4f09..f7c8223ddf7d 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -116,7 +116,7 @@
116*/ 116*/
117 117
118rwlock_t tipc_net_lock = RW_LOCK_UNLOCKED; 118rwlock_t tipc_net_lock = RW_LOCK_UNLOCKED;
119struct network tipc_net = { 0 }; 119struct network tipc_net = { NULL };
120 120
121struct node *tipc_net_select_remote_node(u32 addr, u32 ref) 121struct node *tipc_net_select_remote_node(u32 addr, u32 ref)
122{ 122{
@@ -128,13 +128,14 @@ u32 tipc_net_select_router(u32 addr, u32 ref)
128 return tipc_zone_select_router(tipc_net.zones[tipc_zone(addr)], addr, ref); 128 return tipc_zone_select_router(tipc_net.zones[tipc_zone(addr)], addr, ref);
129} 129}
130 130
131 131#if 0
132u32 tipc_net_next_node(u32 a) 132u32 tipc_net_next_node(u32 a)
133{ 133{
134 if (tipc_net.zones[tipc_zone(a)]) 134 if (tipc_net.zones[tipc_zone(a)])
135 return tipc_zone_next_node(a); 135 return tipc_zone_next_node(a);
136 return 0; 136 return 0;
137} 137}
138#endif
138 139
139void tipc_net_remove_as_router(u32 router) 140void tipc_net_remove_as_router(u32 router)
140{ 141{
@@ -181,7 +182,7 @@ static void net_stop(void)
181 tipc_zone_delete(tipc_net.zones[z_num]); 182 tipc_zone_delete(tipc_net.zones[z_num]);
182 } 183 }
183 kfree(tipc_net.zones); 184 kfree(tipc_net.zones);
184 tipc_net.zones = 0; 185 tipc_net.zones = NULL;
185} 186}
186 187
187static void net_route_named_msg(struct sk_buff *buf) 188static void net_route_named_msg(struct sk_buff *buf)
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 6d65010e5fa1..0d5db06e203f 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -155,7 +155,7 @@ static void node_select_active_links(struct node *n_ptr)
155 u32 i; 155 u32 i;
156 u32 highest_prio = 0; 156 u32 highest_prio = 0;
157 157
158 active[0] = active[1] = 0; 158 active[0] = active[1] = NULL;
159 159
160 for (i = 0; i < MAX_BEARERS; i++) { 160 for (i = 0; i < MAX_BEARERS; i++) {
161 struct link *l_ptr = n_ptr->links[i]; 161 struct link *l_ptr = n_ptr->links[i];
@@ -214,7 +214,7 @@ int tipc_node_has_redundant_links(struct node *n_ptr)
214 (n_ptr->active_links[0] != n_ptr->active_links[1])); 214 (n_ptr->active_links[0] != n_ptr->active_links[1]));
215} 215}
216 216
217int tipc_node_has_active_routes(struct node *n_ptr) 217static int tipc_node_has_active_routes(struct node *n_ptr)
218{ 218{
219 return (n_ptr && (n_ptr->last_router >= 0)); 219 return (n_ptr && (n_ptr->last_router >= 0));
220} 220}
@@ -240,7 +240,7 @@ struct node *tipc_node_attach_link(struct link *l_ptr)
240 240
241 err("Attempt to create third link to %s\n", 241 err("Attempt to create third link to %s\n",
242 addr_string_fill(addr_string, n_ptr->addr)); 242 addr_string_fill(addr_string, n_ptr->addr));
243 return 0; 243 return NULL;
244 } 244 }
245 245
246 if (!n_ptr->links[bearer_id]) { 246 if (!n_ptr->links[bearer_id]) {
@@ -253,12 +253,12 @@ struct node *tipc_node_attach_link(struct link *l_ptr)
253 l_ptr->b_ptr->publ.name, 253 l_ptr->b_ptr->publ.name,
254 addr_string_fill(addr_string, l_ptr->addr)); 254 addr_string_fill(addr_string, l_ptr->addr));
255 } 255 }
256 return 0; 256 return NULL;
257} 257}
258 258
259void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr) 259void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr)
260{ 260{
261 n_ptr->links[l_ptr->b_ptr->identity] = 0; 261 n_ptr->links[l_ptr->b_ptr->identity] = NULL;
262 tipc_net.zones[tipc_zone(l_ptr->addr)]->links--; 262 tipc_net.zones[tipc_zone(l_ptr->addr)]->links--;
263 n_ptr->link_cnt--; 263 n_ptr->link_cnt--;
264} 264}
@@ -424,7 +424,7 @@ static void node_lost_contact(struct node *n_ptr)
424 424
425 /* Notify subscribers */ 425 /* Notify subscribers */
426 list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) { 426 list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) {
427 ns->node = 0; 427 ns->node = NULL;
428 list_del_init(&ns->nodesub_list); 428 list_del_init(&ns->nodesub_list);
429 tipc_k_signal((Handler)ns->handle_node_down, 429 tipc_k_signal((Handler)ns->handle_node_down,
430 (unsigned long)ns->usr_handle); 430 (unsigned long)ns->usr_handle);
@@ -443,7 +443,7 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
443 u32 router_addr; 443 u32 router_addr;
444 444
445 if (!tipc_addr_domain_valid(addr)) 445 if (!tipc_addr_domain_valid(addr))
446 return 0; 446 return NULL;
447 447
448 /* Look for direct link to destination processsor */ 448 /* Look for direct link to destination processsor */
449 n_ptr = tipc_node_find(addr); 449 n_ptr = tipc_node_find(addr);
@@ -452,7 +452,7 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
452 452
453 /* Cluster local system nodes *must* have direct links */ 453 /* Cluster local system nodes *must* have direct links */
454 if (!is_slave(addr) && in_own_cluster(addr)) 454 if (!is_slave(addr) && in_own_cluster(addr))
455 return 0; 455 return NULL;
456 456
457 /* Look for cluster local router with direct link to node */ 457 /* Look for cluster local router with direct link to node */
458 router_addr = tipc_node_select_router(n_ptr, selector); 458 router_addr = tipc_node_select_router(n_ptr, selector);
@@ -462,7 +462,7 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
462 /* Slave nodes can only be accessed within own cluster via a 462 /* Slave nodes can only be accessed within own cluster via a
463 known router with direct link -- if no router was found,give up */ 463 known router with direct link -- if no router was found,give up */
464 if (is_slave(addr)) 464 if (is_slave(addr))
465 return 0; 465 return NULL;
466 466
467 /* Inter zone/cluster -- find any direct link to remote cluster */ 467 /* Inter zone/cluster -- find any direct link to remote cluster */
468 addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); 468 addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
@@ -475,7 +475,7 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
475 if (router_addr) 475 if (router_addr)
476 return tipc_node_select(router_addr, selector); 476 return tipc_node_select(router_addr, selector);
477 477
478 return 0; 478 return NULL;
479} 479}
480 480
481/** 481/**
diff --git a/net/tipc/node.h b/net/tipc/node.h
index 29f7ae6992d4..781126e084ae 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -121,7 +121,7 @@ static inline struct node *tipc_node_find(u32 addr)
121 if (c_ptr) 121 if (c_ptr)
122 return c_ptr->nodes[tipc_node(addr)]; 122 return c_ptr->nodes[tipc_node(addr)];
123 } 123 }
124 return 0; 124 return NULL;
125} 125}
126 126
127static inline struct node *tipc_node_select(u32 addr, u32 selector) 127static inline struct node *tipc_node_select(u32 addr, u32 selector)
diff --git a/net/tipc/node_subscr.c b/net/tipc/node_subscr.c
index afeea121d8be..cff4068cc755 100644
--- a/net/tipc/node_subscr.c
+++ b/net/tipc/node_subscr.c
@@ -47,7 +47,7 @@
47void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr, 47void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr,
48 void *usr_handle, net_ev_handler handle_down) 48 void *usr_handle, net_ev_handler handle_down)
49{ 49{
50 node_sub->node = 0; 50 node_sub->node = NULL;
51 if (addr == tipc_own_addr) 51 if (addr == tipc_own_addr)
52 return; 52 return;
53 if (!tipc_addr_node_valid(addr)) { 53 if (!tipc_addr_node_valid(addr)) {
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 72aae52bfec1..67e96cb1e825 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -54,8 +54,8 @@
54 54
55#define MAX_REJECT_SIZE 1024 55#define MAX_REJECT_SIZE 1024
56 56
57static struct sk_buff *msg_queue_head = 0; 57static struct sk_buff *msg_queue_head = NULL;
58static struct sk_buff *msg_queue_tail = 0; 58static struct sk_buff *msg_queue_tail = NULL;
59 59
60spinlock_t tipc_port_list_lock = SPIN_LOCK_UNLOCKED; 60spinlock_t tipc_port_list_lock = SPIN_LOCK_UNLOCKED;
61static spinlock_t queue_lock = SPIN_LOCK_UNLOCKED; 61static spinlock_t queue_lock = SPIN_LOCK_UNLOCKED;
@@ -67,27 +67,22 @@ static struct sk_buff* port_build_peer_abort_msg(struct port *,u32 err);
67static void port_timeout(unsigned long ref); 67static void port_timeout(unsigned long ref);
68 68
69 69
70static inline u32 port_peernode(struct port *p_ptr) 70static u32 port_peernode(struct port *p_ptr)
71{ 71{
72 return msg_destnode(&p_ptr->publ.phdr); 72 return msg_destnode(&p_ptr->publ.phdr);
73} 73}
74 74
75static inline u32 port_peerport(struct port *p_ptr) 75static u32 port_peerport(struct port *p_ptr)
76{ 76{
77 return msg_destport(&p_ptr->publ.phdr); 77 return msg_destport(&p_ptr->publ.phdr);
78} 78}
79 79
80static inline u32 port_out_seqno(struct port *p_ptr) 80static u32 port_out_seqno(struct port *p_ptr)
81{ 81{
82 return msg_transp_seqno(&p_ptr->publ.phdr); 82 return msg_transp_seqno(&p_ptr->publ.phdr);
83} 83}
84 84
85static inline void port_set_out_seqno(struct port *p_ptr, u32 seqno) 85static void port_incr_out_seqno(struct port *p_ptr)
86{
87 msg_set_transp_seqno(&p_ptr->publ.phdr,seqno);
88}
89
90static inline void port_incr_out_seqno(struct port *p_ptr)
91{ 86{
92 struct tipc_msg *m = &p_ptr->publ.phdr; 87 struct tipc_msg *m = &p_ptr->publ.phdr;
93 88
@@ -258,11 +253,11 @@ u32 tipc_createport_raw(void *usr_handle,
258 p_ptr->publ.usr_handle = usr_handle; 253 p_ptr->publ.usr_handle = usr_handle;
259 INIT_LIST_HEAD(&p_ptr->wait_list); 254 INIT_LIST_HEAD(&p_ptr->wait_list);
260 INIT_LIST_HEAD(&p_ptr->subscription.nodesub_list); 255 INIT_LIST_HEAD(&p_ptr->subscription.nodesub_list);
261 p_ptr->congested_link = 0; 256 p_ptr->congested_link = NULL;
262 p_ptr->max_pkt = MAX_PKT_DEFAULT; 257 p_ptr->max_pkt = MAX_PKT_DEFAULT;
263 p_ptr->dispatcher = dispatcher; 258 p_ptr->dispatcher = dispatcher;
264 p_ptr->wakeup = wakeup; 259 p_ptr->wakeup = wakeup;
265 p_ptr->user_port = 0; 260 p_ptr->user_port = NULL;
266 k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref); 261 k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref);
267 spin_lock_bh(&tipc_port_list_lock); 262 spin_lock_bh(&tipc_port_list_lock);
268 INIT_LIST_HEAD(&p_ptr->publications); 263 INIT_LIST_HEAD(&p_ptr->publications);
@@ -276,9 +271,9 @@ u32 tipc_createport_raw(void *usr_handle,
276int tipc_deleteport(u32 ref) 271int tipc_deleteport(u32 ref)
277{ 272{
278 struct port *p_ptr; 273 struct port *p_ptr;
279 struct sk_buff *buf = 0; 274 struct sk_buff *buf = NULL;
280 275
281 tipc_withdraw(ref, 0, 0); 276 tipc_withdraw(ref, 0, NULL);
282 p_ptr = tipc_port_lock(ref); 277 p_ptr = tipc_port_lock(ref);
283 if (!p_ptr) 278 if (!p_ptr)
284 return -EINVAL; 279 return -EINVAL;
@@ -329,13 +324,13 @@ void *tipc_get_handle(const u32 ref)
329 324
330 p_ptr = tipc_port_lock(ref); 325 p_ptr = tipc_port_lock(ref);
331 if (!p_ptr) 326 if (!p_ptr)
332 return 0; 327 return NULL;
333 handle = p_ptr->publ.usr_handle; 328 handle = p_ptr->publ.usr_handle;
334 tipc_port_unlock(p_ptr); 329 tipc_port_unlock(p_ptr);
335 return handle; 330 return handle;
336} 331}
337 332
338static inline int port_unreliable(struct port *p_ptr) 333static int port_unreliable(struct port *p_ptr)
339{ 334{
340 return msg_src_droppable(&p_ptr->publ.phdr); 335 return msg_src_droppable(&p_ptr->publ.phdr);
341} 336}
@@ -364,7 +359,7 @@ int tipc_set_portunreliable(u32 ref, unsigned int isunreliable)
364 return TIPC_OK; 359 return TIPC_OK;
365} 360}
366 361
367static inline int port_unreturnable(struct port *p_ptr) 362static int port_unreturnable(struct port *p_ptr)
368{ 363{
369 return msg_dest_droppable(&p_ptr->publ.phdr); 364 return msg_dest_droppable(&p_ptr->publ.phdr);
370} 365}
@@ -475,7 +470,7 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
475 470
476 /* send self-abort message when rejecting on a connected port */ 471 /* send self-abort message when rejecting on a connected port */
477 if (msg_connected(msg)) { 472 if (msg_connected(msg)) {
478 struct sk_buff *abuf = 0; 473 struct sk_buff *abuf = NULL;
479 struct port *p_ptr = tipc_port_lock(msg_destport(msg)); 474 struct port *p_ptr = tipc_port_lock(msg_destport(msg));
480 475
481 if (p_ptr) { 476 if (p_ptr) {
@@ -510,7 +505,7 @@ int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
510static void port_timeout(unsigned long ref) 505static void port_timeout(unsigned long ref)
511{ 506{
512 struct port *p_ptr = tipc_port_lock(ref); 507 struct port *p_ptr = tipc_port_lock(ref);
513 struct sk_buff *buf = 0; 508 struct sk_buff *buf = NULL;
514 509
515 if (!p_ptr || !p_ptr->publ.connected) 510 if (!p_ptr || !p_ptr->publ.connected)
516 return; 511 return;
@@ -540,7 +535,7 @@ static void port_timeout(unsigned long ref)
540static void port_handle_node_down(unsigned long ref) 535static void port_handle_node_down(unsigned long ref)
541{ 536{
542 struct port *p_ptr = tipc_port_lock(ref); 537 struct port *p_ptr = tipc_port_lock(ref);
543 struct sk_buff* buf = 0; 538 struct sk_buff* buf = NULL;
544 539
545 if (!p_ptr) 540 if (!p_ptr)
546 return; 541 return;
@@ -555,7 +550,7 @@ static struct sk_buff *port_build_self_abort_msg(struct port *p_ptr, u32 err)
555 u32 imp = msg_importance(&p_ptr->publ.phdr); 550 u32 imp = msg_importance(&p_ptr->publ.phdr);
556 551
557 if (!p_ptr->publ.connected) 552 if (!p_ptr->publ.connected)
558 return 0; 553 return NULL;
559 if (imp < TIPC_CRITICAL_IMPORTANCE) 554 if (imp < TIPC_CRITICAL_IMPORTANCE)
560 imp++; 555 imp++;
561 return port_build_proto_msg(p_ptr->publ.ref, 556 return port_build_proto_msg(p_ptr->publ.ref,
@@ -575,7 +570,7 @@ static struct sk_buff *port_build_peer_abort_msg(struct port *p_ptr, u32 err)
575 u32 imp = msg_importance(&p_ptr->publ.phdr); 570 u32 imp = msg_importance(&p_ptr->publ.phdr);
576 571
577 if (!p_ptr->publ.connected) 572 if (!p_ptr->publ.connected)
578 return 0; 573 return NULL;
579 if (imp < TIPC_CRITICAL_IMPORTANCE) 574 if (imp < TIPC_CRITICAL_IMPORTANCE)
580 imp++; 575 imp++;
581 return port_build_proto_msg(port_peerport(p_ptr), 576 return port_build_proto_msg(port_peerport(p_ptr),
@@ -594,8 +589,8 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
594 struct tipc_msg *msg = buf_msg(buf); 589 struct tipc_msg *msg = buf_msg(buf);
595 struct port *p_ptr = tipc_port_lock(msg_destport(msg)); 590 struct port *p_ptr = tipc_port_lock(msg_destport(msg));
596 u32 err = TIPC_OK; 591 u32 err = TIPC_OK;
597 struct sk_buff *r_buf = 0; 592 struct sk_buff *r_buf = NULL;
598 struct sk_buff *abort_buf = 0; 593 struct sk_buff *abort_buf = NULL;
599 594
600 msg_dbg(msg, "PORT<RECV<:"); 595 msg_dbg(msg, "PORT<RECV<:");
601 596
@@ -804,7 +799,7 @@ static void port_dispatcher_sigh(void *dummy)
804 799
805 spin_lock_bh(&queue_lock); 800 spin_lock_bh(&queue_lock);
806 buf = msg_queue_head; 801 buf = msg_queue_head;
807 msg_queue_head = 0; 802 msg_queue_head = NULL;
808 spin_unlock_bh(&queue_lock); 803 spin_unlock_bh(&queue_lock);
809 804
810 while (buf) { 805 while (buf) {
@@ -991,8 +986,8 @@ static void port_wakeup_sh(unsigned long ref)
991{ 986{
992 struct port *p_ptr; 987 struct port *p_ptr;
993 struct user_port *up_ptr; 988 struct user_port *up_ptr;
994 tipc_continue_event cb = 0; 989 tipc_continue_event cb = NULL;
995 void *uh = 0; 990 void *uh = NULL;
996 991
997 p_ptr = tipc_port_lock(ref); 992 p_ptr = tipc_port_lock(ref);
998 if (p_ptr) { 993 if (p_ptr) {
@@ -1016,7 +1011,7 @@ static void port_wakeup(struct tipc_port *p_ptr)
1016void tipc_acknowledge(u32 ref, u32 ack) 1011void tipc_acknowledge(u32 ref, u32 ack)
1017{ 1012{
1018 struct port *p_ptr; 1013 struct port *p_ptr;
1019 struct sk_buff *buf = 0; 1014 struct sk_buff *buf = NULL;
1020 1015
1021 p_ptr = tipc_port_lock(ref); 1016 p_ptr = tipc_port_lock(ref);
1022 if (!p_ptr) 1017 if (!p_ptr)
@@ -1062,7 +1057,7 @@ int tipc_createport(u32 user_ref,
1062 if (up_ptr == NULL) { 1057 if (up_ptr == NULL) {
1063 return -ENOMEM; 1058 return -ENOMEM;
1064 } 1059 }
1065 ref = tipc_createport_raw(0, port_dispatcher, port_wakeup, importance); 1060 ref = tipc_createport_raw(NULL, port_dispatcher, port_wakeup, importance);
1066 p_ptr = tipc_port_lock(ref); 1061 p_ptr = tipc_port_lock(ref);
1067 if (!p_ptr) { 1062 if (!p_ptr) {
1068 kfree(up_ptr); 1063 kfree(up_ptr);
@@ -1273,7 +1268,7 @@ int tipc_disconnect(u32 ref)
1273int tipc_shutdown(u32 ref) 1268int tipc_shutdown(u32 ref)
1274{ 1269{
1275 struct port *p_ptr; 1270 struct port *p_ptr;
1276 struct sk_buff *buf = 0; 1271 struct sk_buff *buf = NULL;
1277 1272
1278 p_ptr = tipc_port_lock(ref); 1273 p_ptr = tipc_port_lock(ref);
1279 if (!p_ptr) 1274 if (!p_ptr)
diff --git a/net/tipc/ref.c b/net/tipc/ref.c
index 5a13c2defe4a..33bbf5095094 100644
--- a/net/tipc/ref.c
+++ b/net/tipc/ref.c
@@ -61,7 +61,7 @@
61 * because entry 0's reference field has the form XXXX|1--1. 61 * because entry 0's reference field has the form XXXX|1--1.
62 */ 62 */
63 63
64struct ref_table tipc_ref_table = { 0 }; 64struct ref_table tipc_ref_table = { NULL };
65 65
66static rwlock_t ref_table_lock = RW_LOCK_UNLOCKED; 66static rwlock_t ref_table_lock = RW_LOCK_UNLOCKED;
67 67
@@ -86,7 +86,7 @@ int tipc_ref_table_init(u32 requested_size, u32 start)
86 write_lock_bh(&ref_table_lock); 86 write_lock_bh(&ref_table_lock);
87 index_mask = sz - 1; 87 index_mask = sz - 1;
88 for (i = sz - 1; i >= 0; i--) { 88 for (i = sz - 1; i >= 0; i--) {
89 table[i].object = 0; 89 table[i].object = NULL;
90 table[i].lock = SPIN_LOCK_UNLOCKED; 90 table[i].lock = SPIN_LOCK_UNLOCKED;
91 table[i].data.next_plus_upper = (start & ~index_mask) + i - 1; 91 table[i].data.next_plus_upper = (start & ~index_mask) + i - 1;
92 } 92 }
@@ -108,7 +108,7 @@ void tipc_ref_table_stop(void)
108 return; 108 return;
109 109
110 vfree(tipc_ref_table.entries); 110 vfree(tipc_ref_table.entries);
111 tipc_ref_table.entries = 0; 111 tipc_ref_table.entries = NULL;
112} 112}
113 113
114/** 114/**
@@ -173,7 +173,7 @@ void tipc_ref_discard(u32 ref)
173 assert(entry->data.reference == ref); 173 assert(entry->data.reference == ref);
174 174
175 /* mark entry as unused */ 175 /* mark entry as unused */
176 entry->object = 0; 176 entry->object = NULL;
177 if (tipc_ref_table.first_free == 0) 177 if (tipc_ref_table.first_free == 0)
178 tipc_ref_table.first_free = index; 178 tipc_ref_table.first_free = index;
179 else 179 else
diff --git a/net/tipc/ref.h b/net/tipc/ref.h
index 4f8f9f40dcac..6d20006be45b 100644
--- a/net/tipc/ref.h
+++ b/net/tipc/ref.h
@@ -92,7 +92,7 @@ static inline void *tipc_ref_lock(u32 ref)
92 return r->object; 92 return r->object;
93 spin_unlock_bh(&r->lock); 93 spin_unlock_bh(&r->lock);
94 } 94 }
95 return 0; 95 return NULL;
96} 96}
97 97
98/** 98/**
@@ -125,7 +125,7 @@ static inline void *tipc_ref_deref(u32 ref)
125 if (likely(r->data.reference == ref)) 125 if (likely(r->data.reference == ref))
126 return r->object; 126 return r->object;
127 } 127 }
128 return 0; 128 return NULL;
129} 129}
130 130
131#endif 131#endif
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 67253bfcd702..648a734e6044 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -88,7 +88,7 @@ static atomic_t tipc_queue_size = ATOMIC_INIT(0);
88 * with non-socket interfaces. 88 * with non-socket interfaces.
89 * See net.c for description of locking policy. 89 * See net.c for description of locking policy.
90 */ 90 */
91static inline void sock_lock(struct tipc_sock* tsock) 91static void sock_lock(struct tipc_sock* tsock)
92{ 92{
93 spin_lock_bh(tsock->p->lock); 93 spin_lock_bh(tsock->p->lock);
94} 94}
@@ -96,7 +96,7 @@ static inline void sock_lock(struct tipc_sock* tsock)
96/* 96/*
97 * sock_unlock(): Unlock a port/socket pair 97 * sock_unlock(): Unlock a port/socket pair
98 */ 98 */
99static inline void sock_unlock(struct tipc_sock* tsock) 99static void sock_unlock(struct tipc_sock* tsock)
100{ 100{
101 spin_unlock_bh(tsock->p->lock); 101 spin_unlock_bh(tsock->p->lock);
102} 102}
@@ -119,7 +119,7 @@ static inline void sock_unlock(struct tipc_sock* tsock)
119 * Returns pollmask value 119 * Returns pollmask value
120 */ 120 */
121 121
122static inline u32 pollmask(struct socket *sock) 122static u32 pollmask(struct socket *sock)
123{ 123{
124 u32 mask; 124 u32 mask;
125 125
@@ -144,7 +144,7 @@ static inline u32 pollmask(struct socket *sock)
144 * @tsock: TIPC socket 144 * @tsock: TIPC socket
145 */ 145 */
146 146
147static inline void advance_queue(struct tipc_sock *tsock) 147static void advance_queue(struct tipc_sock *tsock)
148{ 148{
149 sock_lock(tsock); 149 sock_lock(tsock);
150 buf_discard(skb_dequeue(&tsock->sk.sk_receive_queue)); 150 buf_discard(skb_dequeue(&tsock->sk.sk_receive_queue));
@@ -178,7 +178,7 @@ static int tipc_create(struct socket *sock, int protocol)
178 if (unlikely(protocol != 0)) 178 if (unlikely(protocol != 0))
179 return -EPROTONOSUPPORT; 179 return -EPROTONOSUPPORT;
180 180
181 ref = tipc_createport_raw(0, &dispatch, &wakeupdispatch, TIPC_LOW_IMPORTANCE); 181 ref = tipc_createport_raw(NULL, &dispatch, &wakeupdispatch, TIPC_LOW_IMPORTANCE);
182 if (unlikely(!ref)) 182 if (unlikely(!ref))
183 return -ENOMEM; 183 return -ENOMEM;
184 184
@@ -265,7 +265,7 @@ static int release(struct socket *sock)
265 sock_lock(tsock); 265 sock_lock(tsock);
266 buf = skb_dequeue(&sk->sk_receive_queue); 266 buf = skb_dequeue(&sk->sk_receive_queue);
267 if (!buf) 267 if (!buf)
268 tsock->p->usr_handle = 0; 268 tsock->p->usr_handle = NULL;
269 sock_unlock(tsock); 269 sock_unlock(tsock);
270 if (!buf) 270 if (!buf)
271 break; 271 break;
@@ -319,7 +319,7 @@ static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
319 return -ERESTARTSYS; 319 return -ERESTARTSYS;
320 320
321 if (unlikely(!uaddr_len)) { 321 if (unlikely(!uaddr_len)) {
322 res = tipc_withdraw(tsock->p->ref, 0, 0); 322 res = tipc_withdraw(tsock->p->ref, 0, NULL);
323 goto exit; 323 goto exit;
324 } 324 }
325 325
@@ -412,7 +412,7 @@ static unsigned int poll(struct file *file, struct socket *sock,
412 * Returns 0 if permission is granted, otherwise errno 412 * Returns 0 if permission is granted, otherwise errno
413 */ 413 */
414 414
415static inline int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m) 415static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m)
416{ 416{
417 struct tipc_cfg_msg_hdr hdr; 417 struct tipc_cfg_msg_hdr hdr;
418 418
@@ -695,7 +695,7 @@ static int auto_connect(struct socket *sock, struct tipc_sock *tsock,
695 * Note: Address is not captured if not requested by receiver. 695 * Note: Address is not captured if not requested by receiver.
696 */ 696 */
697 697
698static inline void set_orig_addr(struct msghdr *m, struct tipc_msg *msg) 698static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg)
699{ 699{
700 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name; 700 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name;
701 701
@@ -721,7 +721,7 @@ static inline void set_orig_addr(struct msghdr *m, struct tipc_msg *msg)
721 * Returns 0 if successful, otherwise errno 721 * Returns 0 if successful, otherwise errno
722 */ 722 */
723 723
724static inline int anc_data_recv(struct msghdr *m, struct tipc_msg *msg, 724static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
725 struct tipc_port *tport) 725 struct tipc_port *tport)
726{ 726{
727 u32 anc_data[3]; 727 u32 anc_data[3];
@@ -1226,7 +1226,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1226{ 1226{
1227 struct tipc_sock *tsock = tipc_sk(sock->sk); 1227 struct tipc_sock *tsock = tipc_sk(sock->sk);
1228 struct sockaddr_tipc *dst = (struct sockaddr_tipc *)dest; 1228 struct sockaddr_tipc *dst = (struct sockaddr_tipc *)dest;
1229 struct msghdr m = {0,}; 1229 struct msghdr m = {NULL,};
1230 struct sk_buff *buf; 1230 struct sk_buff *buf;
1231 struct tipc_msg *msg; 1231 struct tipc_msg *msg;
1232 int res; 1232 int res;
@@ -1251,7 +1251,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1251 /* Send a 'SYN-' to destination */ 1251 /* Send a 'SYN-' to destination */
1252 1252
1253 m.msg_name = dest; 1253 m.msg_name = dest;
1254 if ((res = send_msg(0, sock, &m, 0)) < 0) { 1254 if ((res = send_msg(NULL, sock, &m, 0)) < 0) {
1255 sock->state = SS_DISCONNECTING; 1255 sock->state = SS_DISCONNECTING;
1256 return res; 1256 return res;
1257 } 1257 }
@@ -1367,9 +1367,9 @@ static int accept(struct socket *sock, struct socket *newsock, int flags)
1367 1367
1368 msg_dbg(msg,"<ACC<: "); 1368 msg_dbg(msg,"<ACC<: ");
1369 if (!msg_data_sz(msg)) { 1369 if (!msg_data_sz(msg)) {
1370 struct msghdr m = {0,}; 1370 struct msghdr m = {NULL,};
1371 1371
1372 send_packet(0, newsock, &m, 0); 1372 send_packet(NULL, newsock, &m, 0);
1373 advance_queue(tsock); 1373 advance_queue(tsock);
1374 } else { 1374 } else {
1375 sock_lock(tsock); 1375 sock_lock(tsock);
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index 5ff38b9f3194..c5f026c7fd38 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -86,7 +86,7 @@ static struct top_srv topsrv = { 0 };
86 * Returns converted value 86 * Returns converted value
87 */ 87 */
88 88
89static inline u32 htohl(u32 in, int swap) 89static u32 htohl(u32 in, int swap)
90{ 90{
91 char *c = (char *)&in; 91 char *c = (char *)&in;
92 92
@@ -381,7 +381,7 @@ static void subscr_named_msg_event(void *usr_handle,
381 struct tipc_name_seq const *dest) 381 struct tipc_name_seq const *dest)
382{ 382{
383 struct subscriber *subscriber; 383 struct subscriber *subscriber;
384 struct iovec msg_sect = {0, 0}; 384 struct iovec msg_sect = {NULL, 0};
385 spinlock_t *subscriber_lock; 385 spinlock_t *subscriber_lock;
386 386
387 dbg("subscr_named_msg_event: orig = %x own = %x,\n", 387 dbg("subscr_named_msg_event: orig = %x own = %x,\n",
@@ -413,13 +413,13 @@ static void subscr_named_msg_event(void *usr_handle,
413 tipc_createport(topsrv.user_ref, 413 tipc_createport(topsrv.user_ref,
414 (void *)(unsigned long)subscriber->ref, 414 (void *)(unsigned long)subscriber->ref,
415 importance, 415 importance,
416 0, 416 NULL,
417 0, 417 NULL,
418 subscr_conn_shutdown_event, 418 subscr_conn_shutdown_event,
419 0, 419 NULL,
420 0, 420 NULL,
421 subscr_conn_msg_event, 421 subscr_conn_msg_event,
422 0, 422 NULL,
423 &subscriber->port_ref); 423 &subscriber->port_ref);
424 if (subscriber->port_ref == 0) { 424 if (subscriber->port_ref == 0) {
425 warn("Memory squeeze; failed to create subscription port\n"); 425 warn("Memory squeeze; failed to create subscription port\n");
@@ -461,22 +461,22 @@ int tipc_subscr_start(void)
461 INIT_LIST_HEAD(&topsrv.subscriber_list); 461 INIT_LIST_HEAD(&topsrv.subscriber_list);
462 462
463 spin_lock_bh(&topsrv.lock); 463 spin_lock_bh(&topsrv.lock);
464 res = tipc_attach(&topsrv.user_ref, 0, 0); 464 res = tipc_attach(&topsrv.user_ref, NULL, NULL);
465 if (res) { 465 if (res) {
466 spin_unlock_bh(&topsrv.lock); 466 spin_unlock_bh(&topsrv.lock);
467 return res; 467 return res;
468 } 468 }
469 469
470 res = tipc_createport(topsrv.user_ref, 470 res = tipc_createport(topsrv.user_ref,
471 0, 471 NULL,
472 TIPC_CRITICAL_IMPORTANCE, 472 TIPC_CRITICAL_IMPORTANCE,
473 0, 473 NULL,
474 0, 474 NULL,
475 0, 475 NULL,
476 0, 476 NULL,
477 subscr_named_msg_event, 477 subscr_named_msg_event,
478 0, 478 NULL,
479 0, 479 NULL,
480 &topsrv.setup_port); 480 &topsrv.setup_port);
481 if (res) 481 if (res)
482 goto failed; 482 goto failed;
diff --git a/net/tipc/user_reg.c b/net/tipc/user_reg.c
index 106200d76587..3f3f933976e9 100644
--- a/net/tipc/user_reg.c
+++ b/net/tipc/user_reg.c
@@ -65,7 +65,7 @@ struct tipc_user {
65#define MAX_USERID 64 65#define MAX_USERID 64
66#define USER_LIST_SIZE ((MAX_USERID + 1) * sizeof(struct tipc_user)) 66#define USER_LIST_SIZE ((MAX_USERID + 1) * sizeof(struct tipc_user))
67 67
68static struct tipc_user *users = 0; 68static struct tipc_user *users = NULL;
69static u32 next_free_user = MAX_USERID + 1; 69static u32 next_free_user = MAX_USERID + 1;
70static spinlock_t reg_lock = SPIN_LOCK_UNLOCKED; 70static spinlock_t reg_lock = SPIN_LOCK_UNLOCKED;
71 71
@@ -149,7 +149,7 @@ void tipc_reg_stop(void)
149 reg_callback(&users[id]); 149 reg_callback(&users[id]);
150 } 150 }
151 kfree(users); 151 kfree(users);
152 users = 0; 152 users = NULL;
153} 153}
154 154
155/** 155/**
diff --git a/net/tipc/zone.c b/net/tipc/zone.c
index 7c11f7f83a21..2803e1b4f170 100644
--- a/net/tipc/zone.c
+++ b/net/tipc/zone.c
@@ -44,11 +44,11 @@
44 44
45struct _zone *tipc_zone_create(u32 addr) 45struct _zone *tipc_zone_create(u32 addr)
46{ 46{
47 struct _zone *z_ptr = 0; 47 struct _zone *z_ptr = NULL;
48 u32 z_num; 48 u32 z_num;
49 49
50 if (!tipc_addr_domain_valid(addr)) 50 if (!tipc_addr_domain_valid(addr))
51 return 0; 51 return NULL;
52 52
53 z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC); 53 z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC);
54 if (z_ptr != NULL) { 54 if (z_ptr != NULL) {
@@ -114,10 +114,10 @@ struct node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref
114 u32 c_num; 114 u32 c_num;
115 115
116 if (!z_ptr) 116 if (!z_ptr)
117 return 0; 117 return NULL;
118 c_ptr = z_ptr->clusters[tipc_cluster(addr)]; 118 c_ptr = z_ptr->clusters[tipc_cluster(addr)];
119 if (!c_ptr) 119 if (!c_ptr)
120 return 0; 120 return NULL;
121 n_ptr = tipc_cltr_select_node(c_ptr, ref); 121 n_ptr = tipc_cltr_select_node(c_ptr, ref);
122 if (n_ptr) 122 if (n_ptr)
123 return n_ptr; 123 return n_ptr;
@@ -126,12 +126,12 @@ struct node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref
126 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { 126 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
127 c_ptr = z_ptr->clusters[c_num]; 127 c_ptr = z_ptr->clusters[c_num];
128 if (!c_ptr) 128 if (!c_ptr)
129 return 0; 129 return NULL;
130 n_ptr = tipc_cltr_select_node(c_ptr, ref); 130 n_ptr = tipc_cltr_select_node(c_ptr, ref);
131 if (n_ptr) 131 if (n_ptr)
132 return n_ptr; 132 return n_ptr;
133 } 133 }
134 return 0; 134 return NULL;
135} 135}
136 136
137u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref) 137u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)