aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/irqueue.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2007-02-09 09:24:53 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-02-11 02:19:47 -0500
commit6819bc2e1e46c71711a8dddf4040e706b02973c0 (patch)
tree6baa6c808fd70a01d5e95c77b02d0a6c5409cc9e /net/irda/irqueue.c
parent981c0ff6900c981668a798fe9e0bc5ba32ee3fd4 (diff)
[NET] IRDA: Fix whitespace errors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/irda/irqueue.c')
-rw-r--r--net/irda/irqueue.c106
1 files changed, 53 insertions, 53 deletions
diff --git a/net/irda/irqueue.c b/net/irda/irqueue.c
index 1d26cd33ea13..92662330dbcf 100644
--- a/net/irda/irqueue.c
+++ b/net/irda/irqueue.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irqueue.c 3 * Filename: irqueue.c
4 * Version: 0.3 4 * Version: 0.3
5 * Description: General queue implementation 5 * Description: General queue implementation
@@ -10,28 +10,28 @@
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * Modified at: Thu Jan 4 14:29:10 CET 2001 11 * Modified at: Thu Jan 4 14:29:10 CET 2001
12 * Modified by: Marc Zyngier <mzyngier@freesurf.fr> 12 * Modified by: Marc Zyngier <mzyngier@freesurf.fr>
13 * 13 *
14 * Copyright (C) 1998-1999, Aage Kvalnes <aage@cs.uit.no> 14 * Copyright (C) 1998-1999, Aage Kvalnes <aage@cs.uit.no>
15 * Copyright (C) 1998, Dag Brattli, 15 * Copyright (C) 1998, Dag Brattli,
16 * All Rights Reserved. 16 * All Rights Reserved.
17 * 17 *
18 * This code is taken from the Vortex Operating System written by Aage 18 * This code is taken from the Vortex Operating System written by Aage
19 * Kvalnes. Aage has agreed that this code can use the GPL licence, 19 * Kvalnes. Aage has agreed that this code can use the GPL licence,
20 * although he does not use that licence in his own code. 20 * although he does not use that licence in his own code.
21 * 21 *
22 * This copyright does however _not_ include the ELF hash() function 22 * This copyright does however _not_ include the ELF hash() function
23 * which I currently don't know which licence or copyright it 23 * which I currently don't know which licence or copyright it
24 * has. Please inform me if you know. 24 * has. Please inform me if you know.
25 * 25 *
26 * This program is free software; you can redistribute it and/or 26 * This program is free software; you can redistribute it and/or
27 * modify it under the terms of the GNU General Public License as 27 * modify it under the terms of the GNU General Public License as
28 * published by the Free Software Foundation; either version 2 of 28 * published by the Free Software Foundation; either version 2 of
29 * the License, or (at your option) any later version. 29 * the License, or (at your option) any later version.
30 * 30 *
31 * Neither Dag Brattli nor University of Tromsų admit liability nor 31 * Neither Dag Brattli nor University of Tromsų admit liability nor
32 * provide warranty for any of this software. This material is 32 * provide warranty for any of this software. This material is
33 * provided "AS-IS" and at no charge. 33 * provided "AS-IS" and at no charge.
34 * 34 *
35 ********************************************************************/ 35 ********************************************************************/
36 36
37/* 37/*
@@ -213,7 +213,7 @@ static __u32 hash( const char* name)
213{ 213{
214 __u32 h = 0; 214 __u32 h = 0;
215 __u32 g; 215 __u32 g;
216 216
217 while(*name) { 217 while(*name) {
218 h = (h<<4) + *name++; 218 h = (h<<4) + *name++;
219 if ((g = (h & 0xf0000000))) 219 if ((g = (h & 0xf0000000)))
@@ -231,7 +231,7 @@ static __u32 hash( const char* name)
231 */ 231 */
232static void enqueue_first(irda_queue_t **queue, irda_queue_t* element) 232static void enqueue_first(irda_queue_t **queue, irda_queue_t* element)
233{ 233{
234 234
235 IRDA_DEBUG( 4, "%s()\n", __FUNCTION__); 235 IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
236 236
237 /* 237 /*
@@ -242,7 +242,7 @@ static void enqueue_first(irda_queue_t **queue, irda_queue_t* element)
242 * Queue is empty. Insert one element into the queue. 242 * Queue is empty. Insert one element into the queue.
243 */ 243 */
244 element->q_next = element->q_prev = *queue = element; 244 element->q_next = element->q_prev = *queue = element;
245 245
246 } else { 246 } else {
247 /* 247 /*
248 * Queue is not empty. Insert element into front of queue. 248 * Queue is not empty. Insert element into front of queue.
@@ -267,20 +267,20 @@ static irda_queue_t *dequeue_first(irda_queue_t **queue)
267 irda_queue_t *ret; 267 irda_queue_t *ret;
268 268
269 IRDA_DEBUG( 4, "dequeue_first()\n"); 269 IRDA_DEBUG( 4, "dequeue_first()\n");
270 270
271 /* 271 /*
272 * Set return value 272 * Set return value
273 */ 273 */
274 ret = *queue; 274 ret = *queue;
275 275
276 if ( *queue == NULL ) { 276 if ( *queue == NULL ) {
277 /* 277 /*
278 * Queue was empty. 278 * Queue was empty.
279 */ 279 */
280 } else if ( (*queue)->q_next == *queue ) { 280 } else if ( (*queue)->q_next == *queue ) {
281 /* 281 /*
282 * Queue only contained a single element. It will now be 282 * Queue only contained a single element. It will now be
283 * empty. 283 * empty.
284 */ 284 */
285 *queue = NULL; 285 *queue = NULL;
286 } else { 286 } else {
@@ -291,7 +291,7 @@ static irda_queue_t *dequeue_first(irda_queue_t **queue)
291 (*queue)->q_next->q_prev = (*queue)->q_prev; 291 (*queue)->q_next->q_prev = (*queue)->q_prev;
292 *queue = (*queue)->q_next; 292 *queue = (*queue)->q_next;
293 } 293 }
294 294
295 /* 295 /*
296 * Return the removed entry (or NULL of queue was empty). 296 * Return the removed entry (or NULL of queue was empty).
297 */ 297 */
@@ -306,25 +306,25 @@ static irda_queue_t *dequeue_first(irda_queue_t **queue)
306static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element) 306static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element)
307{ 307{
308 irda_queue_t *ret; 308 irda_queue_t *ret;
309 309
310 IRDA_DEBUG( 4, "dequeue_general()\n"); 310 IRDA_DEBUG( 4, "dequeue_general()\n");
311 311
312 /* 312 /*
313 * Set return value 313 * Set return value
314 */ 314 */
315 ret = *queue; 315 ret = *queue;
316 316
317 if ( *queue == NULL ) { 317 if ( *queue == NULL ) {
318 /* 318 /*
319 * Queue was empty. 319 * Queue was empty.
320 */ 320 */
321 } else if ( (*queue)->q_next == *queue ) { 321 } else if ( (*queue)->q_next == *queue ) {
322 /* 322 /*
323 * Queue only contained a single element. It will now be 323 * Queue only contained a single element. It will now be
324 * empty. 324 * empty.
325 */ 325 */
326 *queue = NULL; 326 *queue = NULL;
327 327
328 } else { 328 } else {
329 /* 329 /*
330 * Remove specific element. 330 * Remove specific element.
@@ -334,7 +334,7 @@ static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element
334 if ( (*queue) == element) 334 if ( (*queue) == element)
335 (*queue) = element->q_next; 335 (*queue) = element->q_next;
336 } 336 }
337 337
338 /* 338 /*
339 * Return the removed entry (or NULL of queue was empty). 339 * Return the removed entry (or NULL of queue was empty).
340 */ 340 */
@@ -352,7 +352,7 @@ static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element
352hashbin_t *hashbin_new(int type) 352hashbin_t *hashbin_new(int type)
353{ 353{
354 hashbin_t* hashbin; 354 hashbin_t* hashbin;
355 355
356 /* 356 /*
357 * Allocate new hashbin 357 * Allocate new hashbin
358 */ 358 */
@@ -380,8 +380,8 @@ EXPORT_SYMBOL(hashbin_new);
380/* 380/*
381 * Function hashbin_delete (hashbin, free_func) 381 * Function hashbin_delete (hashbin, free_func)
382 * 382 *
383 * Destroy hashbin, the free_func can be a user supplied special routine 383 * Destroy hashbin, the free_func can be a user supplied special routine
384 * for deallocating this structure if it's complex. If not the user can 384 * for deallocating this structure if it's complex. If not the user can
385 * just supply kfree, which should take care of the job. 385 * just supply kfree, which should take care of the job.
386 */ 386 */
387int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) 387int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func)
@@ -392,7 +392,7 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func)
392 392
393 IRDA_ASSERT(hashbin != NULL, return -1;); 393 IRDA_ASSERT(hashbin != NULL, return -1;);
394 IRDA_ASSERT(hashbin->magic == HB_MAGIC, return -1;); 394 IRDA_ASSERT(hashbin->magic == HB_MAGIC, return -1;);
395 395
396 /* Synchronize */ 396 /* Synchronize */
397 if ( hashbin->hb_type & HB_LOCK ) { 397 if ( hashbin->hb_type & HB_LOCK ) {
398 spin_lock_irqsave(&hashbin->hb_spinlock, flags); 398 spin_lock_irqsave(&hashbin->hb_spinlock, flags);
@@ -407,11 +407,11 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func)
407 while (queue ) { 407 while (queue ) {
408 if (free_func) 408 if (free_func)
409 (*free_func)(queue); 409 (*free_func)(queue);
410 queue = dequeue_first( 410 queue = dequeue_first(
411 (irda_queue_t**) &hashbin->hb_queue[i]); 411 (irda_queue_t**) &hashbin->hb_queue[i]);
412 } 412 }
413 } 413 }
414 414
415 /* Cleanup local data */ 415 /* Cleanup local data */
416 hashbin->hb_current = NULL; 416 hashbin->hb_current = NULL;
417 hashbin->magic = ~HB_MAGIC; 417 hashbin->magic = ~HB_MAGIC;
@@ -438,7 +438,7 @@ EXPORT_SYMBOL(hashbin_delete);
438 * Insert an entry into the hashbin 438 * Insert an entry into the hashbin
439 * 439 *
440 */ 440 */
441void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, 441void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv,
442 const char* name) 442 const char* name)
443{ 443{
444 unsigned long flags = 0; 444 unsigned long flags = 0;
@@ -460,14 +460,14 @@ void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv,
460 if ( hashbin->hb_type & HB_LOCK ) { 460 if ( hashbin->hb_type & HB_LOCK ) {
461 spin_lock_irqsave(&hashbin->hb_spinlock, flags); 461 spin_lock_irqsave(&hashbin->hb_spinlock, flags);
462 } /* Default is no-lock */ 462 } /* Default is no-lock */
463 463
464 /* 464 /*
465 * Store name and key 465 * Store name and key
466 */ 466 */
467 entry->q_hash = hashv; 467 entry->q_hash = hashv;
468 if ( name ) 468 if ( name )
469 strlcpy( entry->q_name, name, sizeof(entry->q_name)); 469 strlcpy( entry->q_name, name, sizeof(entry->q_name));
470 470
471 /* 471 /*
472 * Insert new entry first 472 * Insert new entry first
473 */ 473 */
@@ -482,7 +482,7 @@ void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv,
482} 482}
483EXPORT_SYMBOL(hashbin_insert); 483EXPORT_SYMBOL(hashbin_insert);
484 484
485/* 485/*
486 * Function hashbin_remove_first (hashbin) 486 * Function hashbin_remove_first (hashbin)
487 * 487 *
488 * Remove first entry of the hashbin 488 * Remove first entry of the hashbin
@@ -537,7 +537,7 @@ void *hashbin_remove_first( hashbin_t *hashbin)
537} 537}
538 538
539 539
540/* 540/*
541 * Function hashbin_remove (hashbin, hashv, name) 541 * Function hashbin_remove (hashbin, hashv, name)
542 * 542 *
543 * Remove entry with the given name 543 * Remove entry with the given name
@@ -561,7 +561,7 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name)
561 561
562 IRDA_ASSERT( hashbin != NULL, return NULL;); 562 IRDA_ASSERT( hashbin != NULL, return NULL;);
563 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); 563 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
564 564
565 /* 565 /*
566 * Locate hashbin 566 * Locate hashbin
567 */ 567 */
@@ -601,7 +601,7 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name)
601 entry = entry->q_next; 601 entry = entry->q_next;
602 } while ( entry != hashbin->hb_queue[ bin ] ); 602 } while ( entry != hashbin->hb_queue[ bin ] );
603 } 603 }
604 604
605 /* 605 /*
606 * If entry was found, dequeue it 606 * If entry was found, dequeue it
607 */ 607 */
@@ -622,18 +622,18 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name)
622 if ( hashbin->hb_type & HB_LOCK ) { 622 if ( hashbin->hb_type & HB_LOCK ) {
623 spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); 623 spin_unlock_irqrestore(&hashbin->hb_spinlock, flags);
624 } /* Default is no-lock */ 624 } /* Default is no-lock */
625 625
626 626
627 /* Return */ 627 /* Return */
628 if ( found ) 628 if ( found )
629 return entry; 629 return entry;
630 else 630 else
631 return NULL; 631 return NULL;
632 632
633} 633}
634EXPORT_SYMBOL(hashbin_remove); 634EXPORT_SYMBOL(hashbin_remove);
635 635
636/* 636/*
637 * Function hashbin_remove_this (hashbin, entry) 637 * Function hashbin_remove_this (hashbin, entry)
638 * 638 *
639 * Remove entry with the given name 639 * Remove entry with the given name
@@ -655,7 +655,7 @@ void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry)
655 IRDA_ASSERT( hashbin != NULL, return NULL;); 655 IRDA_ASSERT( hashbin != NULL, return NULL;);
656 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); 656 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
657 IRDA_ASSERT( entry != NULL, return NULL;); 657 IRDA_ASSERT( entry != NULL, return NULL;);
658 658
659 /* Synchronize */ 659 /* Synchronize */
660 if ( hashbin->hb_type & HB_LOCK ) { 660 if ( hashbin->hb_type & HB_LOCK ) {
661 spin_lock_irqsave(&hashbin->hb_spinlock, flags); 661 spin_lock_irqsave(&hashbin->hb_spinlock, flags);
@@ -722,7 +722,7 @@ void* hashbin_find( hashbin_t* hashbin, long hashv, const char* name )
722 if ( name ) 722 if ( name )
723 hashv = hash( name ); 723 hashv = hash( name );
724 bin = GET_HASHBIN( hashv ); 724 bin = GET_HASHBIN( hashv );
725 725
726 /* 726 /*
727 * Search for entry 727 * Search for entry
728 */ 728 */
@@ -829,7 +829,7 @@ void* hashbin_find_next( hashbin_t* hashbin, long hashv, const char* name,
829 * called before any calls to hashbin_get_next()! 829 * called before any calls to hashbin_get_next()!
830 * 830 *
831 */ 831 */
832irda_queue_t *hashbin_get_first( hashbin_t* hashbin) 832irda_queue_t *hashbin_get_first( hashbin_t* hashbin)
833{ 833{
834 irda_queue_t *entry; 834 irda_queue_t *entry;
835 int i; 835 int i;
@@ -860,7 +860,7 @@ EXPORT_SYMBOL(hashbin_get_first);
860 * Get next item in hashbin. A series of hashbin_get_next() calls must 860 * Get next item in hashbin. A series of hashbin_get_next() calls must
861 * be started by a call to hashbin_get_first(). The function returns 861 * be started by a call to hashbin_get_first(). The function returns
862 * NULL when all items have been traversed 862 * NULL when all items have been traversed
863 * 863 *
864 * The context of the search is stored within the hashbin, so you must 864 * The context of the search is stored within the hashbin, so you must
865 * protect yourself from concurrent enumerations. - Jean II 865 * protect yourself from concurrent enumerations. - Jean II
866 */ 866 */
@@ -876,13 +876,13 @@ irda_queue_t *hashbin_get_next( hashbin_t *hashbin)
876 if ( hashbin->hb_current == NULL) { 876 if ( hashbin->hb_current == NULL) {
877 IRDA_ASSERT( hashbin->hb_current != NULL, return NULL;); 877 IRDA_ASSERT( hashbin->hb_current != NULL, return NULL;);
878 return NULL; 878 return NULL;
879 } 879 }
880 entry = hashbin->hb_current->q_next; 880 entry = hashbin->hb_current->q_next;
881 bin = GET_HASHBIN( entry->q_hash); 881 bin = GET_HASHBIN( entry->q_hash);
882 882
883 /* 883 /*
884 * Make sure that we are not back at the beginning of the queue 884 * Make sure that we are not back at the beginning of the queue
885 * again 885 * again
886 */ 886 */
887 if ( entry != hashbin->hb_queue[ bin ]) { 887 if ( entry != hashbin->hb_queue[ bin ]) {
888 hashbin->hb_current = entry; 888 hashbin->hb_current = entry;
@@ -895,7 +895,7 @@ irda_queue_t *hashbin_get_next( hashbin_t *hashbin)
895 */ 895 */
896 if ( bin >= HASHBIN_SIZE) 896 if ( bin >= HASHBIN_SIZE)
897 return NULL; 897 return NULL;
898 898
899 /* 899 /*
900 * Move to next queue in hashbin 900 * Move to next queue in hashbin
901 */ 901 */
@@ -904,7 +904,7 @@ irda_queue_t *hashbin_get_next( hashbin_t *hashbin)
904 entry = hashbin->hb_queue[ i]; 904 entry = hashbin->hb_queue[ i];
905 if ( entry) { 905 if ( entry) {
906 hashbin->hb_current = entry; 906 hashbin->hb_current = entry;
907 907
908 return entry; 908 return entry;
909 } 909 }
910 } 910 }