194 #include <linux/module.h>
195 #include <linux/slab.h>
205 #define GET_HASHBIN(x) ( x & HASHBIN_MASK )
219 h = (h<<4) + *name++;
220 if ((g = (h & 0xf0000000)))
241 if ( *queue ==
NULL ) {
251 element->
q_next = (*queue);
252 (*queue)->q_prev->q_next =
element;
253 element->
q_prev = (*queue)->q_prev;
277 if ( *queue ==
NULL ) {
281 }
else if ( (*queue)->q_next == *queue ) {
291 (*queue)->q_prev->q_next = (*queue)->q_next;
292 (*queue)->q_next->q_prev = (*queue)->q_prev;
293 *queue = (*queue)->
q_next;
318 if ( *queue ==
NULL ) {
322 }
else if ( (*queue)->q_next == *queue ) {
335 if ( (*queue) == element)
336 (*queue) = element->
q_next;
360 hashbin = kzalloc(
sizeof(*hashbin),
GFP_ATOMIC);
388 #ifdef CONFIG_LOCKDEP
389 static int hashbin_lock_depth = 0;
394 unsigned long flags = 0;
403 hashbin_lock_depth++);
411 queue = dequeue_first((
irda_queue_t**) &hashbin->hb_queue[i]);
415 queue = dequeue_first(
426 spin_unlock_irqrestore(&hashbin->
hb_spinlock, flags);
427 #ifdef CONFIG_LOCKDEP
428 hashbin_lock_depth--;
452 unsigned long flags = 0;
464 hashv =
hash( name );
482 enqueue_first( (
irda_queue_t**) &hashbin->hb_queue[ bin ],
488 spin_unlock_irqrestore(&hashbin->
hb_spinlock, flags);
504 unsigned long flags = 0;
513 if ( entry !=
NULL) {
525 dequeue_general( (
irda_queue_t**) &hashbin->hb_queue[ bin ],
541 spin_unlock_irqrestore(&hashbin->
hb_spinlock, flags);
564 int bin, found =
FALSE;
565 unsigned long flags = 0;
577 hashv =
hash( name );
588 entry = hashbin->hb_queue[ bin ];
594 if ( entry->
q_hash == hashv ) {
610 }
while ( entry != hashbin->hb_queue[ bin ] );
617 dequeue_general( (
irda_queue_t**) &hashbin->hb_queue[ bin ],
631 spin_unlock_irqrestore(&hashbin->
hb_spinlock, flags);
657 unsigned long flags = 0;
673 if((entry->
q_next == NULL) || (entry->
q_prev == NULL)) {
687 dequeue_general( (
irda_queue_t**) &hashbin->hb_queue[ bin ],
702 spin_unlock_irqrestore(&hashbin->
hb_spinlock, flags);
731 hashv =
hash( name );
737 entry = hashbin->hb_queue[ bin];
743 if ( entry->
q_hash == hashv ) {
756 }
while ( entry != hashbin->hb_queue[ bin ] );
774 unsigned long flags = 0;
786 spin_unlock_irqrestore(&hashbin->
hb_spinlock, flags);
805 unsigned long flags = 0;
828 spin_unlock_irqrestore(&hashbin->
hb_spinlock, flags);
848 if ( hashbin == NULL)
852 entry = hashbin->hb_queue[
i];
895 if ( entry != hashbin->hb_queue[ bin ]) {
912 entry = hashbin->hb_queue[
i];