/*
* Allocate new hashbin
*/
- hashbin = kmalloc( sizeof(hashbin_t), GFP_ATOMIC);
+ hashbin = kzalloc(sizeof(*hashbin), GFP_ATOMIC);
if (!hashbin)
return NULL;
/*
* Initialize structure
*/
- memset(hashbin, 0, sizeof(hashbin_t));
hashbin->hb_type = type;
hashbin->magic = HB_MAGIC;
//hashbin->hb_current = NULL;
unsigned long flags = 0;
int i;
- ASSERT(hashbin != NULL, return -1;);
- ASSERT(hashbin->magic == HB_MAGIC, return -1;);
+ IRDA_ASSERT(hashbin != NULL, return -1;);
+ IRDA_ASSERT(hashbin->magic == HB_MAGIC, return -1;);
/* Synchronize */
if ( hashbin->hb_type & HB_LOCK ) {
IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
- ASSERT( hashbin != NULL, return;);
- ASSERT( hashbin->magic == HB_MAGIC, return;);
+ IRDA_ASSERT( hashbin != NULL, return;);
+ IRDA_ASSERT( hashbin->magic == HB_MAGIC, return;);
/*
* Locate hashbin
IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
- ASSERT( hashbin != NULL, return NULL;);
- ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
+ IRDA_ASSERT( hashbin != NULL, return NULL;);
+ IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
/*
* Locate hashbin
IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
- ASSERT( hashbin != NULL, return NULL;);
- ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
- ASSERT( entry != NULL, return NULL;);
+ IRDA_ASSERT( hashbin != NULL, return NULL;);
+ IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
+ IRDA_ASSERT( entry != NULL, return NULL;);
/* Synchronize */
if ( hashbin->hb_type & HB_LOCK ) {
} /* Default is no-lock */
/* Check if valid and not already removed... */
- if((entry->q_next == NULL) || (entry->q_prev == NULL))
- return NULL;
+ if((entry->q_next == NULL) || (entry->q_prev == NULL)) {
+ entry = NULL;
+ goto out;
+ }
/*
* Locate hashbin
*/
if ( entry == hashbin->hb_current)
hashbin->hb_current = NULL;
-
+out:
/* Release lock */
if ( hashbin->hb_type & HB_LOCK ) {
spin_unlock_irqrestore(&hashbin->hb_spinlock, flags);
IRDA_DEBUG( 4, "hashbin_find()\n");
- ASSERT( hashbin != NULL, return NULL;);
- ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
+ IRDA_ASSERT( hashbin != NULL, return NULL;);
+ IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
/*
* Locate hashbin
return entry;
}
-EXPORT_SYMBOL(hashbin_find_next);
/*
* Function hashbin_get_first (hashbin)
irda_queue_t *entry;
int i;
- ASSERT( hashbin != NULL, return NULL;);
- ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
+ IRDA_ASSERT( hashbin != NULL, return NULL;);
+ IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
if ( hashbin == NULL)
return NULL;
int bin;
int i;
- ASSERT( hashbin != NULL, return NULL;);
- ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
+ IRDA_ASSERT( hashbin != NULL, return NULL;);
+ IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
if ( hashbin->hb_current == NULL) {
- ASSERT( hashbin->hb_current != NULL, return NULL;);
+ IRDA_ASSERT( hashbin->hb_current != NULL, return NULL;);
return NULL;
}
entry = hashbin->hb_current->q_next;