void __exit irlmp_cleanup(void)
{
/* Check for main structure */
- ASSERT(irlmp != NULL, return;);
- ASSERT(irlmp->magic == LMP_MAGIC, return;);
+ IRDA_ASSERT(irlmp != NULL, return;);
+ IRDA_ASSERT(irlmp->magic == LMP_MAGIC, return;);
del_timer(&irlmp->discovery_timer);
{
struct lsap_cb *self;
- ASSERT(notify != NULL, return NULL;);
- ASSERT(irlmp != NULL, return NULL;);
- ASSERT(irlmp->magic == LMP_MAGIC, return NULL;);
- ASSERT(notify->instance != NULL, return NULL;);
+ IRDA_ASSERT(notify != NULL, return NULL;);
+ IRDA_ASSERT(irlmp != NULL, return NULL;);
+ IRDA_ASSERT(irlmp->magic == LMP_MAGIC, return NULL;);
+ IRDA_ASSERT(notify->instance != NULL, return NULL;);
/* Does the client care which Source LSAP selector it gets? */
if (slsap_sel == LSAP_ANY) {
/* Allocate new instance of a LSAP connection */
self = kmalloc(sizeof(struct lsap_cb), GFP_ATOMIC);
if (self == NULL) {
- ERROR("%s: can't allocate memory\n", __FUNCTION__);
+ IRDA_ERROR("%s: can't allocate memory\n", __FUNCTION__);
return NULL;
}
memset(self, 0, sizeof(struct lsap_cb));
{
IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
+ IRDA_ASSERT(self != NULL, return;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
/*
* Set some of the variables to preset values
struct lap_cb *lap;
struct lsap_cb *lsap = NULL;
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
+ IRDA_ASSERT(self != NULL, return;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
/*
* Find out if we should remove this LSAP from a link or from the
*/
lap = self->lap;
if (lap) {
- ASSERT(lap->magic == LMP_LAP_MAGIC, return;);
+ IRDA_ASSERT(lap->magic == LMP_LAP_MAGIC, return;);
/* We might close a LSAP before it has completed the
* connection setup. In those case, higher layers won't
* send a proper disconnect request. Harmless, except
{
struct lap_cb *lap;
- ASSERT(irlmp != NULL, return;);
- ASSERT(irlmp->magic == LMP_MAGIC, return;);
- ASSERT(notify != NULL, return;);
+ IRDA_ASSERT(irlmp != NULL, return;);
+ IRDA_ASSERT(irlmp->magic == LMP_MAGIC, return;);
+ IRDA_ASSERT(notify != NULL, return;);
/*
* Allocate new instance of a LSAP connection
*/
lap = kmalloc(sizeof(struct lap_cb), GFP_KERNEL);
if (lap == NULL) {
- ERROR("%s: unable to kmalloc\n", __FUNCTION__);
+ IRDA_ERROR("%s: unable to kmalloc\n", __FUNCTION__);
return;
}
memset(lap, 0, sizeof(struct lap_cb));
#endif
lap->lsaps = hashbin_new(HB_LOCK);
if (lap->lsaps == NULL) {
- WARNING("%s(), unable to kmalloc lsaps\n", __FUNCTION__);
+ IRDA_WARNING("%s(), unable to kmalloc lsaps\n", __FUNCTION__);
kfree(lap);
return;
}
* will be triggered anymore. Jean II */
link = hashbin_remove(irlmp->links, saddr, NULL);
if (link) {
- ASSERT(link->magic == LMP_LAP_MAGIC, return;);
+ IRDA_ASSERT(link->magic == LMP_LAP_MAGIC, return;);
/* Kill all the LSAPs on this link. Jean II */
link->reason = LAP_DISC_INDICATION;
struct lsap_cb *lsap;
int ret;
- ASSERT(self != NULL, return -EBADR;);
- ASSERT(self->magic == LMP_LSAP_MAGIC, return -EBADR;);
+ IRDA_ASSERT(self != NULL, return -EBADR;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return -EBADR;);
IRDA_DEBUG(2,
"%s(), slsap_sel=%02x, dlsap_sel=%02x, saddr=%08x, daddr=%08x\n",
}
/* Make room for MUX control header (3 bytes) */
- ASSERT(skb_headroom(tx_skb) >= LMP_CONTROL_HEADER, return -1;);
+ IRDA_ASSERT(skb_headroom(tx_skb) >= LMP_CONTROL_HEADER, return -1;);
skb_push(tx_skb, LMP_CONTROL_HEADER);
self->dlsap_sel = dlsap_sel;
*/
lsap = hashbin_remove(irlmp->unconnected_lsaps, (long) self, NULL);
- ASSERT(lsap != NULL, return -1;);
- ASSERT(lsap->magic == LMP_LSAP_MAGIC, return -1;);
- ASSERT(lsap->lap != NULL, return -1;);
- ASSERT(lsap->lap->magic == LMP_LAP_MAGIC, return -1;);
+ IRDA_ASSERT(lsap != NULL, return -1;);
+ IRDA_ASSERT(lsap->magic == LMP_LSAP_MAGIC, return -1;);
+ IRDA_ASSERT(lsap->lap != NULL, return -1;);
+ IRDA_ASSERT(lsap->lap->magic == LMP_LAP_MAGIC, return -1;);
hashbin_insert(self->lap->lsaps, (irda_queue_t *) self, (long) self,
NULL);
int lap_header_size;
int max_header_size;
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
- ASSERT(skb != NULL, return;);
- ASSERT(self->lap != NULL, return;);
+ IRDA_ASSERT(self != NULL, return;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
+ IRDA_ASSERT(skb != NULL, return;);
+ IRDA_ASSERT(self->lap != NULL, return;);
IRDA_DEBUG(2, "%s(), slsap_sel=%02x, dlsap_sel=%02x\n",
__FUNCTION__, self->slsap_sel, self->dlsap_sel);
*/
int irlmp_connect_response(struct lsap_cb *self, struct sk_buff *userdata)
{
- ASSERT(self != NULL, return -1;);
- ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
- ASSERT(userdata != NULL, return -1;);
+ IRDA_ASSERT(self != NULL, return -1;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
+ IRDA_ASSERT(userdata != NULL, return -1;);
/* We set the connected bit and move the lsap to the connected list
* in the state machine itself. Jean II */
__FUNCTION__, self->slsap_sel, self->dlsap_sel);
/* Make room for MUX control header (3 bytes) */
- ASSERT(skb_headroom(userdata) >= LMP_CONTROL_HEADER, return -1;);
+ IRDA_ASSERT(skb_headroom(userdata) >= LMP_CONTROL_HEADER, return -1;);
skb_push(userdata, LMP_CONTROL_HEADER);
irlmp_do_lsap_event(self, LM_CONNECT_RESPONSE, userdata);
IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
- ASSERT(skb != NULL, return;);
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
- ASSERT(self->lap != NULL, return;);
+ IRDA_ASSERT(skb != NULL, return;);
+ IRDA_ASSERT(self != NULL, return;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
+ IRDA_ASSERT(self->lap != NULL, return;);
self->qos = *self->lap->qos;
{
struct lsap_cb *lsap;
- ASSERT(self != NULL, return -1;);
- ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
- ASSERT(userdata != NULL, return -1;);
+ IRDA_ASSERT(self != NULL, return -1;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
+ IRDA_ASSERT(userdata != NULL, return -1;);
/* Already disconnected ?
* There is a race condition between irlmp_disconnect_indication()
* Remove LSAP from list of connected LSAPs for the particular link
* and insert it into the list of unconnected LSAPs
*/
- ASSERT(self->lap != NULL, return -1;);
- ASSERT(self->lap->magic == LMP_LAP_MAGIC, return -1;);
- ASSERT(self->lap->lsaps != NULL, return -1;);
+ IRDA_ASSERT(self->lap != NULL, return -1;);
+ IRDA_ASSERT(self->lap->magic == LMP_LAP_MAGIC, return -1;);
+ IRDA_ASSERT(self->lap->lsaps != NULL, return -1;);
lsap = hashbin_remove(self->lap->lsaps, (long) self, NULL);
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP
self->lap->cache.valid = FALSE;
#endif
- ASSERT(lsap != NULL, return -1;);
- ASSERT(lsap->magic == LMP_LSAP_MAGIC, return -1;);
- ASSERT(lsap == self, return -1;);
+ IRDA_ASSERT(lsap != NULL, return -1;);
+ IRDA_ASSERT(lsap->magic == LMP_LSAP_MAGIC, return -1;);
+ IRDA_ASSERT(lsap == self, return -1;);
hashbin_insert(irlmp->unconnected_lsaps, (irda_queue_t *) self,
(long) self, NULL);
struct lsap_cb *lsap;
IRDA_DEBUG(1, "%s(), reason=%s\n", __FUNCTION__, irlmp_reasons[reason]);
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
+ IRDA_ASSERT(self != NULL, return;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
IRDA_DEBUG(3, "%s(), slsap_sel=%02x, dlsap_sel=%02x\n",
__FUNCTION__, self->slsap_sel, self->dlsap_sel);
/*
* Remove association between this LSAP and the link it used
*/
- ASSERT(self->lap != NULL, return;);
- ASSERT(self->lap->lsaps != NULL, return;);
+ IRDA_ASSERT(self->lap != NULL, return;);
+ IRDA_ASSERT(self->lap->lsaps != NULL, return;);
lsap = hashbin_remove(self->lap->lsaps, (long) self, NULL);
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP
self->lap->cache.valid = FALSE;
#endif
- ASSERT(lsap != NULL, return;);
- ASSERT(lsap == self, return;);
+ IRDA_ASSERT(lsap != NULL, return;);
+ IRDA_ASSERT(lsap == self, return;);
hashbin_insert(irlmp->unconnected_lsaps, (irda_queue_t *) lsap,
(long) lsap, NULL);
*/
lap = (struct lap_cb *) hashbin_get_first(irlmp->links);
while (lap != NULL) {
- ASSERT(lap->magic == LMP_LAP_MAGIC, return;);
+ IRDA_ASSERT(lap->magic == LMP_LAP_MAGIC, return;);
if (lap->lap_state == LAP_STANDBY) {
/* Expire discoveries discovered on this link */
/* Make sure the value is sane */
if ((nslots != 1) && (nslots != 6) && (nslots != 8) && (nslots != 16)){
- WARNING("%s: invalid value for number of slots!\n",
- __FUNCTION__);
+ IRDA_WARNING("%s: invalid value for number of slots!\n",
+ __FUNCTION__);
nslots = sysctl_discovery_slots = 8;
}
*/
lap = (struct lap_cb *) hashbin_get_first(irlmp->links);
while (lap != NULL) {
- ASSERT(lap->magic == LMP_LAP_MAGIC, return;);
+ IRDA_ASSERT(lap->magic == LMP_LAP_MAGIC, return;);
if (lap->lap_state == LAP_STANDBY) {
/* Try to discover */
IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
- ASSERT(log != NULL, return;);
+ IRDA_ASSERT(log != NULL, return;);
if (!(HASHBIN_GET_SIZE(log)))
return;
IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
- ASSERT(expiries != NULL, return;);
+ IRDA_ASSERT(expiries != NULL, return;);
/* For each client - notify callback may touch client list */
client = (irlmp_client_t *) hashbin_get_first(irlmp->clients);
{
IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
- ASSERT(irlmp != NULL, return NULL;);
+ IRDA_ASSERT(irlmp != NULL, return NULL;);
u16ho(irlmp->discovery_rsp.data.hints) = irlmp->hints.word;
{
int ret;
- ASSERT(self != NULL, return -1;);
- ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
+ IRDA_ASSERT(self != NULL, return -1;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
/* Make room for MUX header */
- ASSERT(skb_headroom(userdata) >= LMP_HEADER, return -1;);
+ IRDA_ASSERT(skb_headroom(userdata) >= LMP_HEADER, return -1;);
skb_push(userdata, LMP_HEADER);
ret = irlmp_do_lsap_event(self, LM_DATA_REQUEST, userdata);
IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
- ASSERT(userdata != NULL, return -1;);
+ IRDA_ASSERT(userdata != NULL, return -1;);
/* Make room for MUX header */
- ASSERT(skb_headroom(userdata) >= LMP_HEADER, return -1;);
+ IRDA_ASSERT(skb_headroom(userdata) >= LMP_HEADER, return -1;);
skb_push(userdata, LMP_HEADER);
ret = irlmp_do_lsap_event(self, LM_UDATA_REQUEST, userdata);
{
IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
- ASSERT(skb != NULL, return;);
+ IRDA_ASSERT(self != NULL, return;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
+ IRDA_ASSERT(skb != NULL, return;);
/* Hide LMP header from layer above */
skb_pull(skb, LMP_HEADER);
IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
- ASSERT(userdata != NULL, return -1;);
+ IRDA_ASSERT(userdata != NULL, return -1;);
/* Make room for MUX and PID header */
- ASSERT(skb_headroom(userdata) >= LMP_HEADER+LMP_PID_HEADER,
- return -1;);
+ IRDA_ASSERT(skb_headroom(userdata) >= LMP_HEADER+LMP_PID_HEADER,
+ return -1;);
/* Insert protocol identifier */
skb_push(userdata, LMP_PID_HEADER);
/* Try to send Connectionless packets out on all links */
lap = (struct lap_cb *) hashbin_get_first(irlmp->links);
while (lap != NULL) {
- ASSERT(lap->magic == LMP_LAP_MAGIC, return -1;);
+ IRDA_ASSERT(lap->magic == LMP_LAP_MAGIC, return -1;);
clone_skb = skb_clone(userdata, GFP_ATOMIC);
if (!clone_skb) {
{
IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
- ASSERT(skb != NULL, return;);
+ IRDA_ASSERT(self != NULL, return;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
+ IRDA_ASSERT(skb != NULL, return;);
/* Hide LMP and PID header from layer above */
skb_pull(skb, LMP_HEADER+LMP_PID_HEADER);
curr = (struct lsap_cb *) hashbin_get_first( self->lsaps);
while (NULL != hashbin_find_next(self->lsaps, (long) curr, NULL,
(void *) &next) ) {
- ASSERT(curr->magic == LMP_LSAP_MAGIC, return;);
+ IRDA_ASSERT(curr->magic == LMP_LSAP_MAGIC, return;);
/*
* Inform service user if he has requested it
*/
struct lsap_cb *curr;
int lsap_todo;
- ASSERT(self->magic == LMP_LAP_MAGIC, return;);
- ASSERT(flow == FLOW_START, return;);
+ IRDA_ASSERT(self->magic == LMP_LAP_MAGIC, return;);
+ IRDA_ASSERT(flow == FLOW_START, return;);
/* Get the number of lsap. That's the only safe way to know
* that we have looped around... - Jean II */
irlmp_client_t *client;
IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
- ASSERT(irlmp != NULL, return NULL;);
+ IRDA_ASSERT(irlmp != NULL, return NULL;);
/* Make a new registration */
client = kmalloc(sizeof(irlmp_client_t), GFP_ATOMIC);
struct lap_cb *lap;
unsigned long flags;
- ASSERT(irlmp != NULL, return TRUE;);
- ASSERT(irlmp->magic == LMP_MAGIC, return TRUE;);
- ASSERT(slsap_sel != LSAP_ANY, return TRUE;);
+ IRDA_ASSERT(irlmp != NULL, return TRUE;);
+ IRDA_ASSERT(irlmp->magic == LMP_MAGIC, return TRUE;);
+ IRDA_ASSERT(slsap_sel != LSAP_ANY, return TRUE;);
IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
spin_lock_irqsave(&irlmp->links->hb_spinlock, flags);
lap = (struct lap_cb *) hashbin_get_first(irlmp->links);
while (lap != NULL) {
- ASSERT(lap->magic == LMP_LAP_MAGIC, goto errlap;);
+ IRDA_ASSERT(lap->magic == LMP_LAP_MAGIC, goto errlap;);
/* Careful for priority inversions here !
* irlmp->links is never taken while another IrDA
/* For this IrLAP, check all the LSAPs */
self = (struct lsap_cb *) hashbin_get_first(lap->lsaps);
while (self != NULL) {
- ASSERT(self->magic == LMP_LSAP_MAGIC, goto errlsap;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC,
+ goto errlsap;);
if ((self->slsap_sel == slsap_sel)) {
IRDA_DEBUG(4, "Source LSAP selector=%02x in use\n",
self = (struct lsap_cb *) hashbin_get_first(irlmp->unconnected_lsaps);
while (self != NULL) {
- ASSERT(self->magic == LMP_LSAP_MAGIC, goto erruncon;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, goto erruncon;);
if ((self->slsap_sel == slsap_sel)) {
IRDA_DEBUG(4, "Source LSAP selector=%02x in use (unconnected)\n",
self->slsap_sel);
* Jean II */
errlsap:
spin_unlock(&lap->lsaps->hb_spinlock);
-errlap:
+IRDA_ASSERT_LABEL(errlap:)
spin_unlock_irqrestore(&irlmp->links->hb_spinlock, flags);
return TRUE;
__u8 lsap_sel;
int wrapped = 0;
- ASSERT(irlmp != NULL, return -1;);
- ASSERT(irlmp->magic == LMP_MAGIC, return -1;);
+ IRDA_ASSERT(irlmp != NULL, return -1;);
+ IRDA_ASSERT(irlmp->magic == LMP_MAGIC, return -1;);
/* Most users don't really care which LSAPs they are given,
* and therefore we automatically give them a free LSAP.
/* Make sure we terminate the loop */
if (wrapped++) {
- ERROR("%s: no more free LSAPs !\n",
- __FUNCTION__);
+ IRDA_ERROR("%s: no more free LSAPs !\n",
+ __FUNCTION__);
return 0;
}
}
seq_puts(seq, "\nRegistered Link Layers:\n");
else if (iter->hashbin == irlmp->unconnected_lsaps) {
self = v;
- ASSERT(self->magic == LMP_LSAP_MAGIC, return -EINVAL; );
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return -EINVAL; );
seq_printf(seq, "lsap state: %s, ",
irlsap_state[ self->lsap_state]);
seq_printf(seq,
for (self = (struct lsap_cb *) hashbin_get_first(lap->lsaps);
self != NULL;
self = (struct lsap_cb *)hashbin_get_next(lap->lsaps)) {
- ASSERT(self->magic == LMP_LSAP_MAGIC, break;);
+ IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC,
+ goto outloop;);
seq_printf(seq, " lsap state: %s, ",
irlsap_state[ self->lsap_state]);
seq_printf(seq,
seq_putc(seq, '\n');
}
+ IRDA_ASSERT_LABEL(outloop:)
spin_unlock(&lap->lsaps->hb_spinlock);
seq_putc(seq, '\n');
} else
int rc = -ENOMEM;
struct irlmp_iter_state *s;
- ASSERT(irlmp != NULL, return -EINVAL;);
+ IRDA_ASSERT(irlmp != NULL, return -EINVAL;);
s = kmalloc(sizeof(*s), GFP_KERNEL);
if (!s)