aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/subscr.c
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2012-04-30 15:29:02 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-04-30 15:53:56 -0400
commit617d3c7a50b3dc15f558d60013047aede79dc055 (patch)
tree03908b63390eae5046618595b29f9ff30aea667a /net/tipc/subscr.c
parentaad585473fe1e4b07f2ec1e2432475937f90c385 (diff)
tipc: compress out gratuitous extra carriage returns
Some of the comment blocks are floating in limbo between two functions, or between blocks of code. Delete the extra line feeds between any comment and its associated following block of code, to be consistent with the majority of the rest of the kernel. Also delete trailing newlines at EOF and fix a couple trivial typos in existing comments. This is a 100% cosmetic change with no runtime impact. We get rid of over 500 lines of non-code, and being blank line deletes, they won't even show up as noise in git blame. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/subscr.c')
-rw-r--r--net/tipc/subscr.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index af93ea924f60..f976e9cd6a72 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -46,7 +46,6 @@
46 * @subscriber_list: adjacent subscribers in top. server's list of subscribers 46 * @subscriber_list: adjacent subscribers in top. server's list of subscribers
47 * @subscription_list: list of subscription objects for this subscriber 47 * @subscription_list: list of subscription objects for this subscriber
48 */ 48 */
49
50struct tipc_subscriber { 49struct tipc_subscriber {
51 u32 port_ref; 50 u32 port_ref;
52 spinlock_t *lock; 51 spinlock_t *lock;
@@ -61,7 +60,6 @@ struct tipc_subscriber {
61 * @subscriber_list: list of ports subscribing to service 60 * @subscriber_list: list of ports subscribing to service
62 * @lock: spinlock govering access to subscriber list 61 * @lock: spinlock govering access to subscriber list
63 */ 62 */
64
65struct top_srv { 63struct top_srv {
66 u32 setup_port; 64 u32 setup_port;
67 atomic_t subscription_count; 65 atomic_t subscription_count;
@@ -78,7 +76,6 @@ static struct top_srv topsrv;
78 * 76 *
79 * Returns converted value 77 * Returns converted value
80 */ 78 */
81
82static u32 htohl(u32 in, int swap) 79static u32 htohl(u32 in, int swap)
83{ 80{
84 return swap ? swab32(in) : in; 81 return swap ? swab32(in) : in;
@@ -90,7 +87,6 @@ static u32 htohl(u32 in, int swap)
90 * Note: Must not hold subscriber's server port lock, since tipc_send() will 87 * Note: Must not hold subscriber's server port lock, since tipc_send() will
91 * try to take the lock if the message is rejected and returned! 88 * try to take the lock if the message is rejected and returned!
92 */ 89 */
93
94static void subscr_send_event(struct tipc_subscription *sub, 90static void subscr_send_event(struct tipc_subscription *sub,
95 u32 found_lower, 91 u32 found_lower,
96 u32 found_upper, 92 u32 found_upper,
@@ -116,7 +112,6 @@ static void subscr_send_event(struct tipc_subscription *sub,
116 * 112 *
117 * Returns 1 if there is overlap, otherwise 0. 113 * Returns 1 if there is overlap, otherwise 0.
118 */ 114 */
119
120int tipc_subscr_overlap(struct tipc_subscription *sub, 115int tipc_subscr_overlap(struct tipc_subscription *sub,
121 u32 found_lower, 116 u32 found_lower,
122 u32 found_upper) 117 u32 found_upper)
@@ -136,7 +131,6 @@ int tipc_subscr_overlap(struct tipc_subscription *sub,
136 * 131 *
137 * Protected by nameseq.lock in name_table.c 132 * Protected by nameseq.lock in name_table.c
138 */ 133 */
139
140void tipc_subscr_report_overlap(struct tipc_subscription *sub, 134void tipc_subscr_report_overlap(struct tipc_subscription *sub,
141 u32 found_lower, 135 u32 found_lower,
142 u32 found_upper, 136 u32 found_upper,
@@ -156,43 +150,35 @@ void tipc_subscr_report_overlap(struct tipc_subscription *sub,
156/** 150/**
157 * subscr_timeout - subscription timeout has occurred 151 * subscr_timeout - subscription timeout has occurred
158 */ 152 */
159
160static void subscr_timeout(struct tipc_subscription *sub) 153static void subscr_timeout(struct tipc_subscription *sub)
161{ 154{
162 struct tipc_port *server_port; 155 struct tipc_port *server_port;
163 156
164 /* Validate server port reference (in case subscriber is terminating) */ 157 /* Validate server port reference (in case subscriber is terminating) */
165
166 server_port = tipc_port_lock(sub->server_ref); 158 server_port = tipc_port_lock(sub->server_ref);
167 if (server_port == NULL) 159 if (server_port == NULL)
168 return; 160 return;
169 161
170 /* Validate timeout (in case subscription is being cancelled) */ 162 /* Validate timeout (in case subscription is being cancelled) */
171
172 if (sub->timeout == TIPC_WAIT_FOREVER) { 163 if (sub->timeout == TIPC_WAIT_FOREVER) {
173 tipc_port_unlock(server_port); 164 tipc_port_unlock(server_port);
174 return; 165 return;
175 } 166 }
176 167
177 /* Unlink subscription from name table */ 168 /* Unlink subscription from name table */
178
179 tipc_nametbl_unsubscribe(sub); 169 tipc_nametbl_unsubscribe(sub);
180 170
181 /* Unlink subscription from subscriber */ 171 /* Unlink subscription from subscriber */
182
183 list_del(&sub->subscription_list); 172 list_del(&sub->subscription_list);
184 173
185 /* Release subscriber's server port */ 174 /* Release subscriber's server port */
186
187 tipc_port_unlock(server_port); 175 tipc_port_unlock(server_port);
188 176
189 /* Notify subscriber of timeout */ 177 /* Notify subscriber of timeout */
190
191 subscr_send_event(sub, sub->evt.s.seq.lower, sub->evt.s.seq.upper, 178 subscr_send_event(sub, sub->evt.s.seq.lower, sub->evt.s.seq.upper,
192 TIPC_SUBSCR_TIMEOUT, 0, 0); 179 TIPC_SUBSCR_TIMEOUT, 0, 0);
193 180
194 /* Now destroy subscription */ 181 /* Now destroy subscription */
195
196 k_term_timer(&sub->timer); 182 k_term_timer(&sub->timer);
197 kfree(sub); 183 kfree(sub);
198 atomic_dec(&topsrv.subscription_count); 184 atomic_dec(&topsrv.subscription_count);
@@ -203,7 +189,6 @@ static void subscr_timeout(struct tipc_subscription *sub)
203 * 189 *
204 * Called with subscriber port locked. 190 * Called with subscriber port locked.
205 */ 191 */
206
207static void subscr_del(struct tipc_subscription *sub) 192static void subscr_del(struct tipc_subscription *sub)
208{ 193{
209 tipc_nametbl_unsubscribe(sub); 194 tipc_nametbl_unsubscribe(sub);
@@ -222,7 +207,6 @@ static void subscr_del(struct tipc_subscription *sub)
222 * a new object reference in the interim that uses this lock; this routine will 207 * a new object reference in the interim that uses this lock; this routine will
223 * simply wait for it to be released, then claim it.) 208 * simply wait for it to be released, then claim it.)
224 */ 209 */
225
226static void subscr_terminate(struct tipc_subscriber *subscriber) 210static void subscr_terminate(struct tipc_subscriber *subscriber)
227{ 211{
228 u32 port_ref; 212 u32 port_ref;
@@ -230,18 +214,15 @@ static void subscr_terminate(struct tipc_subscriber *subscriber)
230 struct tipc_subscription *sub_temp; 214 struct tipc_subscription *sub_temp;
231 215
232 /* Invalidate subscriber reference */ 216 /* Invalidate subscriber reference */
233
234 port_ref = subscriber->port_ref; 217 port_ref = subscriber->port_ref;
235 subscriber->port_ref = 0; 218 subscriber->port_ref = 0;
236 spin_unlock_bh(subscriber->lock); 219 spin_unlock_bh(subscriber->lock);
237 220
238 /* Sever connection to subscriber */ 221 /* Sever connection to subscriber */
239
240 tipc_shutdown(port_ref); 222 tipc_shutdown(port_ref);
241 tipc_deleteport(port_ref); 223 tipc_deleteport(port_ref);
242 224
243 /* Destroy any existing subscriptions for subscriber */ 225 /* Destroy any existing subscriptions for subscriber */
244
245 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, 226 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list,
246 subscription_list) { 227 subscription_list) {
247 if (sub->timeout != TIPC_WAIT_FOREVER) { 228 if (sub->timeout != TIPC_WAIT_FOREVER) {
@@ -252,17 +233,14 @@ static void subscr_terminate(struct tipc_subscriber *subscriber)
252 } 233 }
253 234
254 /* Remove subscriber from topology server's subscriber list */ 235 /* Remove subscriber from topology server's subscriber list */
255
256 spin_lock_bh(&topsrv.lock); 236 spin_lock_bh(&topsrv.lock);
257 list_del(&subscriber->subscriber_list); 237 list_del(&subscriber->subscriber_list);
258 spin_unlock_bh(&topsrv.lock); 238 spin_unlock_bh(&topsrv.lock);
259 239
260 /* Reclaim subscriber lock */ 240 /* Reclaim subscriber lock */
261
262 spin_lock_bh(subscriber->lock); 241 spin_lock_bh(subscriber->lock);
263 242
264 /* Now destroy subscriber */ 243 /* Now destroy subscriber */
265
266 kfree(subscriber); 244 kfree(subscriber);
267} 245}
268 246
@@ -275,7 +253,6 @@ static void subscr_terminate(struct tipc_subscriber *subscriber)
275 * 253 *
276 * Note that fields of 's' use subscriber's endianness! 254 * Note that fields of 's' use subscriber's endianness!
277 */ 255 */
278
279static void subscr_cancel(struct tipc_subscr *s, 256static void subscr_cancel(struct tipc_subscr *s,
280 struct tipc_subscriber *subscriber) 257 struct tipc_subscriber *subscriber)
281{ 258{
@@ -284,7 +261,6 @@ static void subscr_cancel(struct tipc_subscr *s,
284 int found = 0; 261 int found = 0;
285 262
286 /* Find first matching subscription, exit if not found */ 263 /* Find first matching subscription, exit if not found */
287
288 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, 264 list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list,
289 subscription_list) { 265 subscription_list) {
290 if (!memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) { 266 if (!memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) {
@@ -296,7 +272,6 @@ static void subscr_cancel(struct tipc_subscr *s,
296 return; 272 return;
297 273
298 /* Cancel subscription timer (if used), then delete subscription */ 274 /* Cancel subscription timer (if used), then delete subscription */
299
300 if (sub->timeout != TIPC_WAIT_FOREVER) { 275 if (sub->timeout != TIPC_WAIT_FOREVER) {
301 sub->timeout = TIPC_WAIT_FOREVER; 276 sub->timeout = TIPC_WAIT_FOREVER;
302 spin_unlock_bh(subscriber->lock); 277 spin_unlock_bh(subscriber->lock);
@@ -312,7 +287,6 @@ static void subscr_cancel(struct tipc_subscr *s,
312 * 287 *
313 * Called with subscriber port locked. 288 * Called with subscriber port locked.
314 */ 289 */
315
316static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s, 290static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
317 struct tipc_subscriber *subscriber) 291 struct tipc_subscriber *subscriber)
318{ 292{
@@ -320,11 +294,9 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
320 int swap; 294 int swap;
321 295
322 /* Determine subscriber's endianness */ 296 /* Determine subscriber's endianness */
323
324 swap = !(s->filter & (TIPC_SUB_PORTS | TIPC_SUB_SERVICE)); 297 swap = !(s->filter & (TIPC_SUB_PORTS | TIPC_SUB_SERVICE));
325 298
326 /* Detect & process a subscription cancellation request */ 299 /* Detect & process a subscription cancellation request */
327
328 if (s->filter & htohl(TIPC_SUB_CANCEL, swap)) { 300 if (s->filter & htohl(TIPC_SUB_CANCEL, swap)) {
329 s->filter &= ~htohl(TIPC_SUB_CANCEL, swap); 301 s->filter &= ~htohl(TIPC_SUB_CANCEL, swap);
330 subscr_cancel(s, subscriber); 302 subscr_cancel(s, subscriber);
@@ -332,7 +304,6 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
332 } 304 }
333 305
334 /* Refuse subscription if global limit exceeded */ 306 /* Refuse subscription if global limit exceeded */
335
336 if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) { 307 if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) {
337 warn("Subscription rejected, subscription limit reached (%u)\n", 308 warn("Subscription rejected, subscription limit reached (%u)\n",
338 tipc_max_subscriptions); 309 tipc_max_subscriptions);
@@ -341,7 +312,6 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
341 } 312 }
342 313
343 /* Allocate subscription object */ 314 /* Allocate subscription object */
344
345 sub = kmalloc(sizeof(*sub), GFP_ATOMIC); 315 sub = kmalloc(sizeof(*sub), GFP_ATOMIC);
346 if (!sub) { 316 if (!sub) {
347 warn("Subscription rejected, no memory\n"); 317 warn("Subscription rejected, no memory\n");
@@ -350,7 +320,6 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
350 } 320 }
351 321
352 /* Initialize subscription object */ 322 /* Initialize subscription object */
353
354 sub->seq.type = htohl(s->seq.type, swap); 323 sub->seq.type = htohl(s->seq.type, swap);
355 sub->seq.lower = htohl(s->seq.lower, swap); 324 sub->seq.lower = htohl(s->seq.lower, swap);
356 sub->seq.upper = htohl(s->seq.upper, swap); 325 sub->seq.upper = htohl(s->seq.upper, swap);
@@ -384,7 +353,6 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
384 * 353 *
385 * Called with subscriber's server port unlocked. 354 * Called with subscriber's server port unlocked.
386 */ 355 */
387
388static void subscr_conn_shutdown_event(void *usr_handle, 356static void subscr_conn_shutdown_event(void *usr_handle,
389 u32 port_ref, 357 u32 port_ref,
390 struct sk_buff **buf, 358 struct sk_buff **buf,
@@ -408,7 +376,6 @@ static void subscr_conn_shutdown_event(void *usr_handle,
408 * 376 *
409 * Called with subscriber's server port unlocked. 377 * Called with subscriber's server port unlocked.
410 */ 378 */
411
412static void subscr_conn_msg_event(void *usr_handle, 379static void subscr_conn_msg_event(void *usr_handle,
413 u32 port_ref, 380 u32 port_ref,
414 struct sk_buff **buf, 381 struct sk_buff **buf,
@@ -423,7 +390,6 @@ static void subscr_conn_msg_event(void *usr_handle,
423 * Lock subscriber's server port (& make a local copy of lock pointer, 390 * Lock subscriber's server port (& make a local copy of lock pointer,
424 * in case subscriber is deleted while processing subscription request) 391 * in case subscriber is deleted while processing subscription request)
425 */ 392 */
426
427 if (tipc_port_lock(port_ref) == NULL) 393 if (tipc_port_lock(port_ref) == NULL)
428 return; 394 return;
429 395
@@ -451,7 +417,6 @@ static void subscr_conn_msg_event(void *usr_handle,
451 * timeout code cannot delete the subscription, 417 * timeout code cannot delete the subscription,
452 * so the subscription object is still protected. 418 * so the subscription object is still protected.
453 */ 419 */
454
455 tipc_nametbl_subscribe(sub); 420 tipc_nametbl_subscribe(sub);
456 } 421 }
457 } 422 }
@@ -460,7 +425,6 @@ static void subscr_conn_msg_event(void *usr_handle,
460/** 425/**
461 * subscr_named_msg_event - handle request to establish a new subscriber 426 * subscr_named_msg_event - handle request to establish a new subscriber
462 */ 427 */
463
464static void subscr_named_msg_event(void *usr_handle, 428static void subscr_named_msg_event(void *usr_handle,
465 u32 port_ref, 429 u32 port_ref,
466 struct sk_buff **buf, 430 struct sk_buff **buf,
@@ -474,7 +438,6 @@ static void subscr_named_msg_event(void *usr_handle,
474 u32 server_port_ref; 438 u32 server_port_ref;
475 439
476 /* Create subscriber object */ 440 /* Create subscriber object */
477
478 subscriber = kzalloc(sizeof(struct tipc_subscriber), GFP_ATOMIC); 441 subscriber = kzalloc(sizeof(struct tipc_subscriber), GFP_ATOMIC);
479 if (subscriber == NULL) { 442 if (subscriber == NULL) {
480 warn("Subscriber rejected, no memory\n"); 443 warn("Subscriber rejected, no memory\n");
@@ -484,7 +447,6 @@ static void subscr_named_msg_event(void *usr_handle,
484 INIT_LIST_HEAD(&subscriber->subscriber_list); 447 INIT_LIST_HEAD(&subscriber->subscriber_list);
485 448
486 /* Create server port & establish connection to subscriber */ 449 /* Create server port & establish connection to subscriber */
487
488 tipc_createport(subscriber, 450 tipc_createport(subscriber,
489 importance, 451 importance,
490 NULL, 452 NULL,
@@ -503,26 +465,21 @@ static void subscr_named_msg_event(void *usr_handle,
503 tipc_connect2port(subscriber->port_ref, orig); 465 tipc_connect2port(subscriber->port_ref, orig);
504 466
505 /* Lock server port (& save lock address for future use) */ 467 /* Lock server port (& save lock address for future use) */
506
507 subscriber->lock = tipc_port_lock(subscriber->port_ref)->lock; 468 subscriber->lock = tipc_port_lock(subscriber->port_ref)->lock;
508 469
509 /* Add subscriber to topology server's subscriber list */ 470 /* Add subscriber to topology server's subscriber list */
510
511 spin_lock_bh(&topsrv.lock); 471 spin_lock_bh(&topsrv.lock);
512 list_add(&subscriber->subscriber_list, &topsrv.subscriber_list); 472 list_add(&subscriber->subscriber_list, &topsrv.subscriber_list);
513 spin_unlock_bh(&topsrv.lock); 473 spin_unlock_bh(&topsrv.lock);
514 474
515 /* Unlock server port */ 475 /* Unlock server port */
516
517 server_port_ref = subscriber->port_ref; 476 server_port_ref = subscriber->port_ref;
518 spin_unlock_bh(subscriber->lock); 477 spin_unlock_bh(subscriber->lock);
519 478
520 /* Send an ACK- to complete connection handshaking */ 479 /* Send an ACK- to complete connection handshaking */
521
522 tipc_send(server_port_ref, 0, NULL, 0); 480 tipc_send(server_port_ref, 0, NULL, 0);
523 481
524 /* Handle optional subscription request */ 482 /* Handle optional subscription request */
525
526 if (size != 0) { 483 if (size != 0) {
527 subscr_conn_msg_event(subscriber, server_port_ref, 484 subscr_conn_msg_event(subscriber, server_port_ref,
528 buf, data, size); 485 buf, data, size);