Commit d7bd8ce5 authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] kill warnings 13/19

irlap_event was abusing __FUNCTION__ too.
parent 6996a8ab
/********************************************************************* /*********************************************************************
* *
* Filename: irlap_event.c * Filename: irlap_event.c
* Version: 0.9 * Version: 0.9
* Description: IrLAP state machine implementation * Description: IrLAP state machine implementation
...@@ -8,19 +8,19 @@ ...@@ -8,19 +8,19 @@
* Created at: Sat Aug 16 00:59:29 1997 * Created at: Sat Aug 16 00:59:29 1997
* Modified at: Sat Dec 25 21:07:57 1999 * Modified at: Sat Dec 25 21:07:57 1999
* Modified by: Dag Brattli <dag@brattli.net> * Modified by: Dag Brattli <dag@brattli.net>
* *
* Copyright (c) 1998-2000 Dag Brattli <dag@brattli.net>, * Copyright (c) 1998-2000 Dag Brattli <dag@brattli.net>,
* Copyright (c) 1998 Thomas Davis <ratbert@radiks.net> * Copyright (c) 1998 Thomas Davis <ratbert@radiks.net>
* All Rights Reserved. * All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
* *
* Neither Dag Brattli nor University of Troms admit liability nor * Neither Dag Brattli nor University of Troms admit liability nor
* provide warranty for any of this software. This material is * provide warranty for any of this software. This material is
* provided "AS-IS" and at no charge. * provided "AS-IS" and at no charge.
* *
********************************************************************/ ********************************************************************/
...@@ -46,35 +46,35 @@ ...@@ -46,35 +46,35 @@
int sysctl_fast_poll_increase = 50; int sysctl_fast_poll_increase = 50;
#endif #endif
static int irlap_state_ndm (struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_ndm (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_query (struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_query (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_reply (struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_reply (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_conn (struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_conn (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_setup (struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_setup (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_offline(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_offline(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_xmit_p (struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_xmit_p (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_pclose (struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_pclose (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_nrm_p (struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_nrm_p (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_reset (struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_reset (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_nrm_s (struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_nrm_s (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_xmit_s (struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_xmit_s (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_sclose (struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_sclose (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info); struct sk_buff *skb, struct irlap_info *info);
static int irlap_state_reset_check(struct irlap_cb *, IRLAP_EVENT event, static int irlap_state_reset_check(struct irlap_cb *, IRLAP_EVENT event,
struct sk_buff *, struct irlap_info *); struct sk_buff *, struct irlap_info *);
#ifdef CONFIG_IRDA_DEBUG #ifdef CONFIG_IRDA_DEBUG
...@@ -138,8 +138,8 @@ const char *irlap_state[] = { ...@@ -138,8 +138,8 @@ const char *irlap_state[] = {
"LAP_RESET_CHECK", "LAP_RESET_CHECK",
}; };
static int (*state[])(struct irlap_cb *self, IRLAP_EVENT event, static int (*state[])(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) = struct sk_buff *skb, struct irlap_info *info) =
{ {
irlap_state_ndm, irlap_state_ndm,
irlap_state_query, irlap_state_query,
...@@ -167,10 +167,10 @@ static int (*state[])(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -167,10 +167,10 @@ static int (*state[])(struct irlap_cb *self, IRLAP_EVENT event,
static void irlap_poll_timer_expired(void *data) static void irlap_poll_timer_expired(void *data)
{ {
struct irlap_cb *self = (struct irlap_cb *) data; struct irlap_cb *self = (struct irlap_cb *) data;
ASSERT(self != NULL, return;); ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;); ASSERT(self->magic == LAP_MAGIC, return;);
irlap_do_event(self, POLL_TIMER_EXPIRED, NULL, NULL); irlap_do_event(self, POLL_TIMER_EXPIRED, NULL, NULL);
} }
...@@ -186,7 +186,7 @@ void irlap_start_poll_timer(struct irlap_cb *self, int timeout) ...@@ -186,7 +186,7 @@ void irlap_start_poll_timer(struct irlap_cb *self, int timeout)
ASSERT(self->magic == LAP_MAGIC, return;); ASSERT(self->magic == LAP_MAGIC, return;);
#ifdef CONFIG_IRDA_FAST_RR #ifdef CONFIG_IRDA_FAST_RR
/* /*
* Send out the RR frames faster if our own transmit queue is empty, or * Send out the RR frames faster if our own transmit queue is empty, or
* if the peer is busy. The effect is a much faster conversation * if the peer is busy. The effect is a much faster conversation
*/ */
...@@ -201,7 +201,7 @@ void irlap_start_poll_timer(struct irlap_cb *self, int timeout) ...@@ -201,7 +201,7 @@ void irlap_start_poll_timer(struct irlap_cb *self, int timeout)
* FIXME: this should be a more configurable * FIXME: this should be a more configurable
* function * function
*/ */
self->fast_RR_timeout += self->fast_RR_timeout +=
(sysctl_fast_poll_increase * HZ/1000); (sysctl_fast_poll_increase * HZ/1000);
/* Use this fast(er) timeout instead */ /* Use this fast(er) timeout instead */
...@@ -223,7 +223,7 @@ void irlap_start_poll_timer(struct irlap_cb *self, int timeout) ...@@ -223,7 +223,7 @@ void irlap_start_poll_timer(struct irlap_cb *self, int timeout)
if (timeout == 0) if (timeout == 0)
irlap_do_event(self, POLL_TIMER_EXPIRED, NULL, NULL); irlap_do_event(self, POLL_TIMER_EXPIRED, NULL, NULL);
else else
irda_start_timer(&self->poll_timer, timeout, self, irda_start_timer(&self->poll_timer, timeout, self,
irlap_poll_timer_expired); irlap_poll_timer_expired);
} }
...@@ -231,28 +231,28 @@ void irlap_start_poll_timer(struct irlap_cb *self, int timeout) ...@@ -231,28 +231,28 @@ void irlap_start_poll_timer(struct irlap_cb *self, int timeout)
* Function irlap_do_event (event, skb, info) * Function irlap_do_event (event, skb, info)
* *
* Rushes through the state machine without any delay. If state == XMIT * Rushes through the state machine without any delay. If state == XMIT
* then send queued data frames. * then send queued data frames.
*/ */
void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event, void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
int ret; int ret;
if (!self || self->magic != LAP_MAGIC) if (!self || self->magic != LAP_MAGIC)
return; return;
IRDA_DEBUG(3, __FUNCTION__ "(), event = %s, state = %s\n", IRDA_DEBUG(3, __FUNCTION__ "(), event = %s, state = %s\n",
irlap_event[event], irlap_state[self->state]); irlap_event[event], irlap_state[self->state]);
ret = (*state[self->state])(self, event, skb, info); ret = (*state[self->state])(self, event, skb, info);
/* /*
* Check if there are any pending events that needs to be executed * Check if there are any pending events that needs to be executed
*/ */
switch (self->state) { switch (self->state) {
case LAP_XMIT_P: /* FALLTHROUGH */ case LAP_XMIT_P: /* FALLTHROUGH */
case LAP_XMIT_S: case LAP_XMIT_S:
/* /*
* We just received the pf bit and are at the beginning * We just received the pf bit and are at the beginning
* of a new LAP transmit window. * of a new LAP transmit window.
* Check if there are any queued data frames, and do not * Check if there are any queued data frames, and do not
...@@ -299,15 +299,15 @@ void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -299,15 +299,15 @@ void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
self->local_busy = FALSE; self->local_busy = FALSE;
} else if (self->disconnect_pending) { } else if (self->disconnect_pending) {
self->disconnect_pending = FALSE; self->disconnect_pending = FALSE;
ret = (*state[self->state])(self, DISCONNECT_REQUEST, ret = (*state[self->state])(self, DISCONNECT_REQUEST,
NULL, NULL); NULL, NULL);
} }
break; break;
/* case LAP_NDM: */ /* case LAP_NDM: */
/* case LAP_CONN: */ /* case LAP_CONN: */
/* case LAP_RESET_WAIT: */ /* case LAP_RESET_WAIT: */
/* case LAP_RESET_CHECK: */ /* case LAP_RESET_CHECK: */
default: default:
break; break;
} }
...@@ -319,12 +319,12 @@ void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -319,12 +319,12 @@ void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
* Switches state and provides debug information * Switches state and provides debug information
* *
*/ */
static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state) static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
{ {
/* /*
if (!self || self->magic != LAP_MAGIC) if (!self || self->magic != LAP_MAGIC)
return; return;
IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]); IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]);
*/ */
self->state = state; self->state = state;
...@@ -336,8 +336,8 @@ static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state) ...@@ -336,8 +336,8 @@ static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
* NDM (Normal Disconnected Mode) state * NDM (Normal Disconnected Mode) state
* *
*/ */
static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
discovery_t *discovery_rsp; discovery_t *discovery_rsp;
int ret = 0; int ret = 0;
...@@ -355,14 +355,14 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -355,14 +355,14 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
* postpone the event... - Jean II */ * postpone the event... - Jean II */
IRDA_DEBUG(0, __FUNCTION__ IRDA_DEBUG(0, __FUNCTION__
"(), CONNECT_REQUEST: media busy!\n"); "(), CONNECT_REQUEST: media busy!\n");
/* Always switch state before calling upper layers */ /* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM); irlap_next_state(self, LAP_NDM);
irlap_disconnect_indication(self, LAP_MEDIA_BUSY); irlap_disconnect_indication(self, LAP_MEDIA_BUSY);
} else { } else {
irlap_send_snrm_frame(self, &self->qos_rx); irlap_send_snrm_frame(self, &self->qos_rx);
/* Start Final-bit timer */ /* Start Final-bit timer */
irlap_start_final_timer(self, self->final_timeout); irlap_start_final_timer(self, self->final_timeout);
...@@ -372,10 +372,10 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -372,10 +372,10 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
break; break;
case RECV_SNRM_CMD: case RECV_SNRM_CMD:
/* Check if the frame contains and I field */ /* Check if the frame contains and I field */
if (info) { if (info) {
self->daddr = info->daddr; self->daddr = info->daddr;
self->caddr = info->caddr; self->caddr = info->caddr;
irlap_next_state(self, LAP_CONN); irlap_next_state(self, LAP_CONN);
irlap_connect_indication(self, skb); irlap_connect_indication(self, skb);
...@@ -384,21 +384,21 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -384,21 +384,21 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
"contain an I field!\n"); "contain an I field!\n");
} }
break; break;
case DISCOVERY_REQUEST: case DISCOVERY_REQUEST:
ASSERT(info != NULL, return -1;); ASSERT(info != NULL, return -1;);
if (self->media_busy) { if (self->media_busy) {
IRDA_DEBUG(0, __FUNCTION__ "(), media busy!\n"); IRDA_DEBUG(0, __FUNCTION__ "(), media busy!\n");
/* irlap->log.condition = MEDIA_BUSY; */ /* irlap->log.condition = MEDIA_BUSY; */
/* This will make IrLMP try again */ /* This will make IrLMP try again */
irlap_discovery_confirm(self, NULL); irlap_discovery_confirm(self, NULL);
/* Note : the discovery log is not cleaned up here, /* Note : the discovery log is not cleaned up here,
* it will be done in irlap_discovery_request() * it will be done in irlap_discovery_request()
* Jean II */ * Jean II */
return 0; return 0;
} }
self->S = info->S; self->S = info->S;
self->s = info->s; self->s = info->s;
irlap_send_discovery_xid_frame(self, info->S, info->s, TRUE, irlap_send_discovery_xid_frame(self, info->S, info->s, TRUE,
...@@ -419,17 +419,17 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -419,17 +419,17 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
if (self->slot == info->s) { if (self->slot == info->s) {
discovery_rsp = irlmp_get_discovery_response(); discovery_rsp = irlmp_get_discovery_response();
discovery_rsp->daddr = info->daddr; discovery_rsp->daddr = info->daddr;
irlap_send_discovery_xid_frame(self, info->S, irlap_send_discovery_xid_frame(self, info->S,
self->slot, self->slot,
FALSE, FALSE,
discovery_rsp); discovery_rsp);
self->frame_sent = TRUE; self->frame_sent = TRUE;
} else } else
self->frame_sent = FALSE; self->frame_sent = FALSE;
/* /*
* Remember to multiply the query timeout value with * Remember to multiply the query timeout value with
* the number of slots used * the number of slots used
*/ */
irlap_start_query_timer(self, QUERY_TIMEOUT*info->S); irlap_start_query_timer(self, QUERY_TIMEOUT*info->S);
...@@ -453,7 +453,7 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -453,7 +453,7 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
IRDA_DEBUG(1, __FUNCTION__ "(), Receiving final discovery request, missed the discovery slots :-(\n"); IRDA_DEBUG(1, __FUNCTION__ "(), Receiving final discovery request, missed the discovery slots :-(\n");
/* Last discovery request -> in the log */ /* Last discovery request -> in the log */
irlap_discovery_indication(self, info->discovery); irlap_discovery_indication(self, info->discovery);
} }
break; break;
case MEDIA_BUSY_TIMER_EXPIRED: case MEDIA_BUSY_TIMER_EXPIRED:
...@@ -472,7 +472,7 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -472,7 +472,7 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
/* We don't send the frame, just post an event. /* We don't send the frame, just post an event.
* Also, previously this code was in timer.c... * Also, previously this code was in timer.c...
* Jean II */ * Jean II */
ret = (*state[self->state])(self, SEND_UI_FRAME, ret = (*state[self->state])(self, SEND_UI_FRAME,
NULL, NULL); NULL, NULL);
} }
#endif /* CONFIG_IRDA_ULTRA */ #endif /* CONFIG_IRDA_ULTRA */
...@@ -488,7 +488,7 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -488,7 +488,7 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
irlap_disconnect_indication(self, LAP_DISC_INDICATION); irlap_disconnect_indication(self, LAP_DISC_INDICATION);
else else
ret = (*state[self->state])(self, ret = (*state[self->state])(self,
CONNECT_REQUEST, CONNECT_REQUEST,
NULL, NULL); NULL, NULL);
self->disconnect_pending = FALSE; self->disconnect_pending = FALSE;
} }
...@@ -506,13 +506,13 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -506,13 +506,13 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
break; break;
#ifdef CONFIG_IRDA_ULTRA #ifdef CONFIG_IRDA_ULTRA
case SEND_UI_FRAME: case SEND_UI_FRAME:
{ {
int i; int i;
/* Only allowed to repeat an operation twice */ /* Only allowed to repeat an operation twice */
for (i=0; ((i<2) && (self->media_busy == FALSE)); i++) { for (i=0; ((i<2) && (self->media_busy == FALSE)); i++) {
skb = skb_dequeue(&self->txq_ultra); skb = skb_dequeue(&self->txq_ultra);
if (skb) if (skb)
irlap_send_ui_frame(self, skb, CBROADCAST, irlap_send_ui_frame(self, skb, CBROADCAST,
CMD_FRAME); CMD_FRAME);
else else
break; break;
...@@ -526,7 +526,7 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -526,7 +526,7 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
case RECV_UI_FRAME: case RECV_UI_FRAME:
/* Only accept broadcast frames in NDM mode */ /* Only accept broadcast frames in NDM mode */
if (info->caddr != CBROADCAST) { if (info->caddr != CBROADCAST) {
IRDA_DEBUG(0, __FUNCTION__ IRDA_DEBUG(0, __FUNCTION__
"(), not a broadcast frame!\n"); "(), not a broadcast frame!\n");
} else } else
irlap_unitdata_indication(self, skb); irlap_unitdata_indication(self, skb);
...@@ -536,7 +536,7 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -536,7 +536,7 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
/* Remove test frame header */ /* Remove test frame header */
skb_pull(skb, sizeof(struct test_frame)); skb_pull(skb, sizeof(struct test_frame));
/* /*
* Send response. This skb will not be sent out again, and * Send response. This skb will not be sent out again, and
* will only be used to send out the same info as the cmd * will only be used to send out the same info as the cmd
*/ */
...@@ -546,12 +546,12 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -546,12 +546,12 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
IRDA_DEBUG(0, __FUNCTION__ "() not implemented!\n"); IRDA_DEBUG(0, __FUNCTION__ "() not implemented!\n");
break; break;
default: default:
IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n", IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]); irlap_event[event]);
ret = -1; ret = -1;
break; break;
} }
return ret; return ret;
} }
...@@ -561,8 +561,8 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -561,8 +561,8 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
* QUERY state * QUERY state
* *
*/ */
static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
int ret = 0; int ret = 0;
...@@ -574,16 +574,16 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -574,16 +574,16 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event,
ASSERT(info != NULL, return -1;); ASSERT(info != NULL, return -1;);
ASSERT(info->discovery != NULL, return -1;); ASSERT(info->discovery != NULL, return -1;);
IRDA_DEBUG(4, __FUNCTION__ "(), daddr=%08x\n", IRDA_DEBUG(4, __FUNCTION__ "(), daddr=%08x\n",
info->discovery->daddr); info->discovery->daddr);
if (!self->discovery_log) { if (!self->discovery_log) {
WARNING(__FUNCTION__ "(), discovery log is gone! " WARNING("%s: discovery log is gone! "
"maybe the discovery timeout has been set to " "maybe the discovery timeout has been set to "
"short?\n"); "short?\n", __FUNCTION__);
break; break;
} }
hashbin_insert(self->discovery_log, hashbin_insert(self->discovery_log,
(irda_queue_t *) info->discovery, (irda_queue_t *) info->discovery,
info->discovery->daddr, NULL); info->discovery->daddr, NULL);
...@@ -609,17 +609,17 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -609,17 +609,17 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event,
/* Last discovery request ? */ /* Last discovery request ? */
if (info->s == 0xff) if (info->s == 0xff)
irlap_discovery_indication(self, info->discovery); irlap_discovery_indication(self, info->discovery);
break; break;
case SLOT_TIMER_EXPIRED: case SLOT_TIMER_EXPIRED:
/* /*
* Wait a little longer if we detect an incoming frame. This * Wait a little longer if we detect an incoming frame. This
* is not mentioned in the spec, but is a good thing to do, * is not mentioned in the spec, but is a good thing to do,
* since we want to work even with devices that violate the * since we want to work even with devices that violate the
* timing requirements. * timing requirements.
*/ */
if (irda_device_is_receiving(self->netdev) && !self->add_wait) { if (irda_device_is_receiving(self->netdev) && !self->add_wait) {
IRDA_DEBUG(2, __FUNCTION__ IRDA_DEBUG(2, __FUNCTION__
"(), device is slow to answer, " "(), device is slow to answer, "
"waiting some more!\n"); "waiting some more!\n");
irlap_start_slot_timer(self, MSECS_TO_JIFFIES(10)); irlap_start_slot_timer(self, MSECS_TO_JIFFIES(10));
...@@ -629,25 +629,25 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -629,25 +629,25 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event,
self->add_wait = FALSE; self->add_wait = FALSE;
if (self->s < self->S) { if (self->s < self->S) {
irlap_send_discovery_xid_frame(self, self->S, irlap_send_discovery_xid_frame(self, self->S,
self->s, TRUE, self->s, TRUE,
self->discovery_cmd); self->discovery_cmd);
self->s++; self->s++;
irlap_start_slot_timer(self, self->slot_timeout); irlap_start_slot_timer(self, self->slot_timeout);
/* Keep state */ /* Keep state */
irlap_next_state(self, LAP_QUERY); irlap_next_state(self, LAP_QUERY);
} else { } else {
/* This is the final slot! */ /* This is the final slot! */
irlap_send_discovery_xid_frame(self, self->S, 0xff, irlap_send_discovery_xid_frame(self, self->S, 0xff,
TRUE, TRUE,
self->discovery_cmd); self->discovery_cmd);
/* Always switch state before calling upper layers */ /* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM); irlap_next_state(self, LAP_NDM);
/* /*
* We are now finished with the discovery procedure, * We are now finished with the discovery procedure,
* so now we must return the results * so now we must return the results
*/ */
irlap_discovery_confirm(self, self->discovery_log); irlap_discovery_confirm(self, self->discovery_log);
...@@ -657,7 +657,7 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -657,7 +657,7 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event,
} }
break; break;
default: default:
IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n", IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]); irlap_event[event]);
ret = -1; ret = -1;
...@@ -671,10 +671,10 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -671,10 +671,10 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event,
* *
* REPLY, we have received a XID discovery frame from a device and we * REPLY, we have received a XID discovery frame from a device and we
* are waiting for the right time slot to send a response XID frame * are waiting for the right time slot to send a response XID frame
* *
*/ */
static int irlap_state_reply(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_reply(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
discovery_t *discovery_rsp; discovery_t *discovery_rsp;
int ret=0; int ret=0;
...@@ -695,13 +695,13 @@ static int irlap_state_reply(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -695,13 +695,13 @@ static int irlap_state_reply(struct irlap_cb *self, IRLAP_EVENT event,
/* Last frame? */ /* Last frame? */
if (info->s == 0xff) { if (info->s == 0xff) {
del_timer(&self->query_timer); del_timer(&self->query_timer);
/* info->log.condition = REMOTE; */ /* info->log.condition = REMOTE; */
/* Always switch state before calling upper layers */ /* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM); irlap_next_state(self, LAP_NDM);
irlap_discovery_indication(self, info->discovery); irlap_discovery_indication(self, info->discovery);
} else if ((info->s >= self->slot) && (!self->frame_sent)) { } else if ((info->s >= self->slot) && (!self->frame_sent)) {
discovery_rsp = irlmp_get_discovery_response(); discovery_rsp = irlmp_get_discovery_response();
discovery_rsp->daddr = info->daddr; discovery_rsp->daddr = info->daddr;
...@@ -709,7 +709,7 @@ static int irlap_state_reply(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -709,7 +709,7 @@ static int irlap_state_reply(struct irlap_cb *self, IRLAP_EVENT event,
irlap_send_discovery_xid_frame(self, info->S, irlap_send_discovery_xid_frame(self, info->S,
self->slot, FALSE, self->slot, FALSE,
discovery_rsp); discovery_rsp);
self->frame_sent = TRUE; self->frame_sent = TRUE;
irlap_next_state(self, LAP_REPLY); irlap_next_state(self, LAP_REPLY);
} }
...@@ -728,11 +728,11 @@ static int irlap_state_reply(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -728,11 +728,11 @@ static int irlap_state_reply(struct irlap_cb *self, IRLAP_EVENT event,
* Function irlap_state_conn (event, skb, info) * Function irlap_state_conn (event, skb, info)
* *
* CONN, we have received a SNRM command and is waiting for the upper * CONN, we have received a SNRM command and is waiting for the upper
* layer to accept or refuse connection * layer to accept or refuse connection
* *
*/ */
static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
int ret = 0; int ret = 0;
...@@ -751,20 +751,20 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -751,20 +751,20 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event,
irlap_initiate_connection_state(self); irlap_initiate_connection_state(self);
/* /*
* Applying the parameters now will make sure we change speed * Applying the parameters now will make sure we change speed
* *after* we have sent the next frame * *after* we have sent the next frame
*/ */
irlap_apply_connection_parameters(self, FALSE); irlap_apply_connection_parameters(self, FALSE);
/* /*
* Sending this frame will force a speed change after it has * Sending this frame will force a speed change after it has
* been sent (i.e. the frame will be sent at 9600). * been sent (i.e. the frame will be sent at 9600).
*/ */
irlap_send_ua_response_frame(self, &self->qos_rx); irlap_send_ua_response_frame(self, &self->qos_rx);
#if 0 #if 0
/* /*
* We are allowed to send two frames, but this may increase * We are allowed to send two frames, but this may increase
* the connect latency, so lets not do it for now. * the connect latency, so lets not do it for now.
*/ */
...@@ -787,20 +787,20 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -787,20 +787,20 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event,
#endif #endif
/* /*
* The WD-timer could be set to the duration of the P-timer * The WD-timer could be set to the duration of the P-timer
* for this case, but it is recommended to use twice the * for this case, but it is recommended to use twice the
* value (note 3 IrLAP p. 60). * value (note 3 IrLAP p. 60).
*/ */
irlap_start_wd_timer(self, self->wd_timeout); irlap_start_wd_timer(self, self->wd_timeout);
irlap_next_state(self, LAP_NRM_S); irlap_next_state(self, LAP_NRM_S);
break; break;
case RECV_DISCOVERY_XID_CMD: case RECV_DISCOVERY_XID_CMD:
IRDA_DEBUG(3, __FUNCTION__ IRDA_DEBUG(3, __FUNCTION__
"(), event RECV_DISCOVER_XID_CMD!\n"); "(), event RECV_DISCOVER_XID_CMD!\n");
irlap_next_state(self, LAP_NDM); irlap_next_state(self, LAP_NDM);
break; break;
case DISCONNECT_REQUEST: case DISCONNECT_REQUEST:
IRDA_DEBUG(0, __FUNCTION__ "(), Disconnect request!\n"); IRDA_DEBUG(0, __FUNCTION__ "(), Disconnect request!\n");
irlap_send_dm_frame(self); irlap_send_dm_frame(self);
...@@ -810,11 +810,11 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -810,11 +810,11 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event,
default: default:
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event, IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event,
irlap_event[event]); irlap_event[event]);
ret = -1; ret = -1;
break; break;
} }
return ret; return ret;
} }
...@@ -825,26 +825,26 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -825,26 +825,26 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event,
* a remote peer layer and is awaiting a reply . * a remote peer layer and is awaiting a reply .
* *
*/ */
static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
int ret = 0; int ret = 0;
IRDA_DEBUG(4, __FUNCTION__ "()\n"); IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return -1;); ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;); ASSERT(self->magic == LAP_MAGIC, return -1;);
switch (event) { switch (event) {
case FINAL_TIMER_EXPIRED: case FINAL_TIMER_EXPIRED:
if (self->retry_count < self->N3) { if (self->retry_count < self->N3) {
/* /*
* Perform random backoff, Wait a random number of time units, minimum * Perform random backoff, Wait a random number of time units, minimum
* duration half the time taken to transmitt a SNRM frame, maximum duration * duration half the time taken to transmitt a SNRM frame, maximum duration
* 1.5 times the time taken to transmit a SNRM frame. So this time should * 1.5 times the time taken to transmit a SNRM frame. So this time should
* between 15 msecs and 45 msecs. * between 15 msecs and 45 msecs.
*/ */
irlap_start_backoff_timer(self, MSECS_TO_JIFFIES(20 + irlap_start_backoff_timer(self, MSECS_TO_JIFFIES(20 +
(jiffies % 30))); (jiffies % 30)));
} else { } else {
/* Always switch state before calling upper layers */ /* Always switch state before calling upper layers */
...@@ -877,18 +877,18 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -877,18 +877,18 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
skb_pull(skb, sizeof(struct snrm_frame)); skb_pull(skb, sizeof(struct snrm_frame));
irlap_qos_negotiate(self, skb); irlap_qos_negotiate(self, skb);
/* Send UA frame and then change link settings */ /* Send UA frame and then change link settings */
irlap_apply_connection_parameters(self, FALSE); irlap_apply_connection_parameters(self, FALSE);
irlap_send_ua_response_frame(self, &self->qos_rx); irlap_send_ua_response_frame(self, &self->qos_rx);
irlap_next_state(self, LAP_NRM_S); irlap_next_state(self, LAP_NRM_S);
irlap_connect_confirm(self, skb); irlap_connect_confirm(self, skb);
/* /*
* The WD-timer could be set to the duration of the * The WD-timer could be set to the duration of the
* P-timer for this case, but it is recommended * P-timer for this case, but it is recommended
* to use twice the value (note 3 IrLAP p. 60). * to use twice the value (note 3 IrLAP p. 60).
*/ */
irlap_start_wd_timer(self, self->wd_timeout); irlap_start_wd_timer(self, self->wd_timeout);
} else { } else {
...@@ -915,7 +915,7 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -915,7 +915,7 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
/* Set the new link setting *now* (before the rr frame) */ /* Set the new link setting *now* (before the rr frame) */
irlap_apply_connection_parameters(self, TRUE); irlap_apply_connection_parameters(self, TRUE);
self->retry_count = 0; self->retry_count = 0;
/* Wait for turnaround time to give a chance to the other /* Wait for turnaround time to give a chance to the other
* device to be ready to receive us. * device to be ready to receive us.
* Note : the time to switch speed is typically larger * Note : the time to switch speed is typically larger
...@@ -933,7 +933,7 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -933,7 +933,7 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
irlap_connect_confirm(self, skb); irlap_connect_confirm(self, skb);
break; break;
case RECV_DM_RSP: /* FALLTHROUGH */ case RECV_DM_RSP: /* FALLTHROUGH */
case RECV_DISC_CMD: case RECV_DISC_CMD:
del_timer(&self->final_timer); del_timer(&self->final_timer);
irlap_next_state(self, LAP_NDM); irlap_next_state(self, LAP_NDM);
...@@ -941,11 +941,11 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -941,11 +941,11 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
break; break;
default: default:
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event, IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event,
irlap_event[event]); irlap_event[event]);
ret = -1; ret = -1;
break; break;
} }
return ret; return ret;
} }
...@@ -955,8 +955,8 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -955,8 +955,8 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
* OFFLINE state, not used for now! * OFFLINE state, not used for now!
* *
*/ */
static int irlap_state_offline(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_offline(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
IRDA_DEBUG( 0, __FUNCTION__ "(), Unknown event\n"); IRDA_DEBUG( 0, __FUNCTION__ "(), Unknown event\n");
...@@ -965,31 +965,31 @@ static int irlap_state_offline(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -965,31 +965,31 @@ static int irlap_state_offline(struct irlap_cb *self, IRLAP_EVENT event,
/* /*
* Function irlap_state_xmit_p (self, event, skb, info) * Function irlap_state_xmit_p (self, event, skb, info)
* *
* XMIT, Only the primary station has right to transmit, and we * XMIT, Only the primary station has right to transmit, and we
* therefore do not expect to receive any transmissions from other * therefore do not expect to receive any transmissions from other
* stations. * stations.
* *
*/ */
static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
int ret = 0; int ret = 0;
switch (event) { switch (event) {
case SEND_I_CMD: case SEND_I_CMD:
/* /*
* Only send frame if send-window > 0. * Only send frame if send-window > 0.
*/ */
if ((self->window > 0) && (!self->remote_busy)) { if ((self->window > 0) && (!self->remote_busy)) {
#ifdef CONFIG_IRDA_DYNAMIC_WINDOW #ifdef CONFIG_IRDA_DYNAMIC_WINDOW
/* /*
* Test if we have transmitted more bytes over the * Test if we have transmitted more bytes over the
* link than its possible to do with the current * link than its possible to do with the current
* speed and turn-around-time. * speed and turn-around-time.
*/ */
if (skb->len > self->bytes_left) { if (skb->len > self->bytes_left) {
IRDA_DEBUG(4, __FUNCTION__ IRDA_DEBUG(4, __FUNCTION__
"(), Not allowed to transmit more " "(), Not allowed to transmit more "
"bytes!\n"); "bytes!\n");
skb_queue_head(&self->txq, skb_get(skb)); skb_queue_head(&self->txq, skb_get(skb));
...@@ -1009,18 +1009,18 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1009,18 +1009,18 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event,
* Send data with poll bit cleared only if window > 1 * Send data with poll bit cleared only if window > 1
* and there is more frames after this one to be sent * and there is more frames after this one to be sent
*/ */
if ((self->window > 1) && if ((self->window > 1) &&
skb_queue_len( &self->txq) > 0) skb_queue_len( &self->txq) > 0)
{ {
irlap_send_data_primary(self, skb); irlap_send_data_primary(self, skb);
irlap_next_state(self, LAP_XMIT_P); irlap_next_state(self, LAP_XMIT_P);
} else { } else {
irlap_send_data_primary_poll(self, skb); irlap_send_data_primary_poll(self, skb);
irlap_next_state(self, LAP_NRM_P); irlap_next_state(self, LAP_NRM_P);
/* /*
* Make sure state machine does not try to send * Make sure state machine does not try to send
* any more frames * any more frames
*/ */
ret = -EPROTO; ret = -EPROTO;
} }
...@@ -1029,12 +1029,12 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1029,12 +1029,12 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event,
self->fast_RR = FALSE; self->fast_RR = FALSE;
#endif /* CONFIG_IRDA_FAST_RR */ #endif /* CONFIG_IRDA_FAST_RR */
} else { } else {
IRDA_DEBUG(4, __FUNCTION__ IRDA_DEBUG(4, __FUNCTION__
"(), Unable to send! remote busy?\n"); "(), Unable to send! remote busy?\n");
skb_queue_head(&self->txq, skb_get(skb)); skb_queue_head(&self->txq, skb_get(skb));
/* /*
* The next ret is important, because it tells * The next ret is important, because it tells
* irlap_next_state _not_ to deliver more frames * irlap_next_state _not_ to deliver more frames
*/ */
ret = -EPROTO; ret = -EPROTO;
...@@ -1067,7 +1067,7 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1067,7 +1067,7 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event,
* when we return... - Jean II */ * when we return... - Jean II */
break; break;
default: default:
IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n", IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]); irlap_event[event]);
ret = -EINVAL; ret = -EINVAL;
...@@ -1081,15 +1081,15 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1081,15 +1081,15 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event,
* *
* PCLOSE state * PCLOSE state
*/ */
static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
int ret = 0; int ret = 0;
IRDA_DEBUG(1, __FUNCTION__ "()\n"); IRDA_DEBUG(1, __FUNCTION__ "()\n");
ASSERT(self != NULL, return -1;); ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;); ASSERT(self->magic == LAP_MAGIC, return -1;);
switch (event) { switch (event) {
case RECV_UA_RSP: /* FALLTHROUGH */ case RECV_UA_RSP: /* FALLTHROUGH */
...@@ -1101,7 +1101,7 @@ static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1101,7 +1101,7 @@ static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event,
/* Always switch state before calling upper layers */ /* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM); irlap_next_state(self, LAP_NDM);
irlap_disconnect_indication(self, LAP_DISC_INDICATION); irlap_disconnect_indication(self, LAP_DISC_INDICATION);
break; break;
case FINAL_TIMER_EXPIRED: case FINAL_TIMER_EXPIRED:
...@@ -1124,7 +1124,7 @@ static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1124,7 +1124,7 @@ static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event,
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d\n", event); IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d\n", event);
ret = -1; ret = -1;
break; break;
} }
return ret; return ret;
} }
...@@ -1138,8 +1138,8 @@ static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1138,8 +1138,8 @@ static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event,
* transmit any frames and is expecting to receive frames only from the * transmit any frames and is expecting to receive frames only from the
* secondary to which transmission permissions has been given. * secondary to which transmission permissions has been given.
*/ */
static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
int ret = 0; int ret = 0;
int ns_status; int ns_status;
...@@ -1149,7 +1149,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1149,7 +1149,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
case RECV_I_RSP: /* Optimize for the common case */ case RECV_I_RSP: /* Optimize for the common case */
/* FIXME: must check for remote_busy below */ /* FIXME: must check for remote_busy below */
#ifdef CONFIG_IRDA_FAST_RR #ifdef CONFIG_IRDA_FAST_RR
/* /*
* Reset the fast_RR so we can use the fast RR code with * Reset the fast_RR so we can use the fast RR code with
* full speed the next time since peer may have more frames * full speed the next time since peer may have more frames
* to transmitt * to transmitt
...@@ -1161,19 +1161,19 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1161,19 +1161,19 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
ns_status = irlap_validate_ns_received(self, info->ns); ns_status = irlap_validate_ns_received(self, info->ns);
nr_status = irlap_validate_nr_received(self, info->nr); nr_status = irlap_validate_nr_received(self, info->nr);
/* /*
* Check for expected I(nformation) frame * Check for expected I(nformation) frame
*/ */
if ((ns_status == NS_EXPECTED) && (nr_status == NR_EXPECTED)) { if ((ns_status == NS_EXPECTED) && (nr_status == NR_EXPECTED)) {
/* poll bit cleared? */ /* poll bit cleared? */
if (!info->pf) { if (!info->pf) {
self->vr = (self->vr + 1) % 8; self->vr = (self->vr + 1) % 8;
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received( self, info->nr); irlap_update_nr_received( self, info->nr);
self->ack_required = TRUE; self->ack_required = TRUE;
/* Keep state, do not move this line */ /* Keep state, do not move this line */
irlap_next_state(self, LAP_NRM_P); irlap_next_state(self, LAP_NRM_P);
...@@ -1182,18 +1182,18 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1182,18 +1182,18 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
del_timer(&self->final_timer); del_timer(&self->final_timer);
self->vr = (self->vr + 1) % 8; self->vr = (self->vr + 1) % 8;
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
/* /*
* Got expected NR, so reset the * Got expected NR, so reset the
* retry_count. This is not done by IrLAP, * retry_count. This is not done by IrLAP,
* which is strange! * which is strange!
*/ */
self->retry_count = 0; self->retry_count = 0;
self->ack_required = TRUE; self->ack_required = TRUE;
irlap_wait_min_turn_around(self, &self->qos_tx); irlap_wait_min_turn_around(self, &self->qos_tx);
/* Call higher layer *before* changing state /* Call higher layer *before* changing state
...@@ -1218,16 +1218,16 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1218,16 +1218,16 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
irlap_start_poll_timer(self, self->poll_timeout); irlap_start_poll_timer(self, self->poll_timeout);
} }
break; break;
} }
/* Unexpected next to send (Ns) */ /* Unexpected next to send (Ns) */
if ((ns_status == NS_UNEXPECTED) && (nr_status == NR_EXPECTED)) if ((ns_status == NS_UNEXPECTED) && (nr_status == NR_EXPECTED))
{ {
if (!info->pf) { if (!info->pf) {
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
/* /*
* Wait until the last frame before doing * Wait until the last frame before doing
* anything * anything
*/ */
...@@ -1236,57 +1236,57 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1236,57 +1236,57 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
} else { } else {
IRDA_DEBUG(4, __FUNCTION__ IRDA_DEBUG(4, __FUNCTION__
"(), missing or duplicate frame!\n"); "(), missing or duplicate frame!\n");
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
irlap_wait_min_turn_around(self, &self->qos_tx); irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_send_rr_frame(self, CMD_FRAME); irlap_send_rr_frame(self, CMD_FRAME);
self->ack_required = FALSE; self->ack_required = FALSE;
irlap_start_final_timer(self, self->final_timeout); irlap_start_final_timer(self, self->final_timeout);
irlap_next_state(self, LAP_NRM_P); irlap_next_state(self, LAP_NRM_P);
} }
break; break;
} }
/* /*
* Unexpected next to receive (Nr) * Unexpected next to receive (Nr)
*/ */
if ((ns_status == NS_EXPECTED) && (nr_status == NR_UNEXPECTED)) if ((ns_status == NS_EXPECTED) && (nr_status == NR_UNEXPECTED))
{ {
if (info->pf) { if (info->pf) {
self->vr = (self->vr + 1) % 8; self->vr = (self->vr + 1) % 8;
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
/* Resend rejected frames */ /* Resend rejected frames */
irlap_resend_rejected_frames(self, CMD_FRAME); irlap_resend_rejected_frames(self, CMD_FRAME);
self->ack_required = FALSE; self->ack_required = FALSE;
irlap_start_final_timer(self, self->final_timeout); irlap_start_final_timer(self, self->final_timeout);
/* Keep state, do not move this line */ /* Keep state, do not move this line */
irlap_next_state(self, LAP_NRM_P); irlap_next_state(self, LAP_NRM_P);
irlap_data_indication(self, skb, FALSE); irlap_data_indication(self, skb, FALSE);
} else { } else {
/* /*
* Do not resend frames until the last * Do not resend frames until the last
* frame has arrived from the other * frame has arrived from the other
* device. This is not documented in * device. This is not documented in
* IrLAP!! * IrLAP!!
*/ */
self->vr = (self->vr + 1) % 8; self->vr = (self->vr + 1) % 8;
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
self->ack_required = FALSE; self->ack_required = FALSE;
/* Keep state, do not move this line!*/ /* Keep state, do not move this line!*/
irlap_next_state(self, LAP_NRM_P); irlap_next_state(self, LAP_NRM_P);
irlap_data_indication(self, skb, FALSE); irlap_data_indication(self, skb, FALSE);
} }
...@@ -1296,15 +1296,15 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1296,15 +1296,15 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
* Unexpected next to send (Ns) and next to receive (Nr) * Unexpected next to send (Ns) and next to receive (Nr)
* Not documented by IrLAP! * Not documented by IrLAP!
*/ */
if ((ns_status == NS_UNEXPECTED) && if ((ns_status == NS_UNEXPECTED) &&
(nr_status == NR_UNEXPECTED)) (nr_status == NR_UNEXPECTED))
{ {
IRDA_DEBUG(4, __FUNCTION__ IRDA_DEBUG(4, __FUNCTION__
"(), unexpected nr and ns!\n"); "(), unexpected nr and ns!\n");
if (info->pf) { if (info->pf) {
/* Resend rejected frames */ /* Resend rejected frames */
irlap_resend_rejected_frames(self, CMD_FRAME); irlap_resend_rejected_frames(self, CMD_FRAME);
/* Give peer some time to retransmit! */ /* Give peer some time to retransmit! */
irlap_start_final_timer(self, self->final_timeout); irlap_start_final_timer(self, self->final_timeout);
...@@ -1313,7 +1313,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1313,7 +1313,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
} else { } else {
/* Update Nr received */ /* Update Nr received */
/* irlap_update_nr_received( info->nr); */ /* irlap_update_nr_received( info->nr); */
self->ack_required = FALSE; self->ack_required = FALSE;
} }
break; break;
...@@ -1325,23 +1325,23 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1325,23 +1325,23 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
if ((nr_status == NR_INVALID) || (ns_status == NS_INVALID)) { if ((nr_status == NR_INVALID) || (ns_status == NS_INVALID)) {
if (info->pf) { if (info->pf) {
del_timer(&self->final_timer); del_timer(&self->final_timer);
irlap_next_state(self, LAP_RESET_WAIT); irlap_next_state(self, LAP_RESET_WAIT);
irlap_disconnect_indication(self, LAP_RESET_INDICATION); irlap_disconnect_indication(self, LAP_RESET_INDICATION);
self->xmitflag = TRUE; self->xmitflag = TRUE;
} else { } else {
del_timer(&self->final_timer); del_timer(&self->final_timer);
irlap_disconnect_indication(self, LAP_RESET_INDICATION); irlap_disconnect_indication(self, LAP_RESET_INDICATION);
self->xmitflag = FALSE; self->xmitflag = FALSE;
} }
break; break;
} }
IRDA_DEBUG(1, __FUNCTION__ "(), Not implemented!\n"); IRDA_DEBUG(1, __FUNCTION__ "(), Not implemented!\n");
IRDA_DEBUG(1, __FUNCTION__ IRDA_DEBUG(1, __FUNCTION__
"(), event=%s, ns_status=%d, nr_status=%d\n", "(), event=%s, ns_status=%d, nr_status=%d\n",
irlap_event[ event], ns_status, nr_status); irlap_event[ event], ns_status, nr_status);
break; break;
case RECV_UI_FRAME: case RECV_UI_FRAME:
...@@ -1353,34 +1353,34 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1353,34 +1353,34 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
del_timer(&self->final_timer); del_timer(&self->final_timer);
irlap_data_indication(self, skb, TRUE); irlap_data_indication(self, skb, TRUE);
irlap_next_state(self, LAP_XMIT_P); irlap_next_state(self, LAP_XMIT_P);
printk(__FUNCTION__ "(): RECV_UI_FRAME: next state %s\n", irlap_state[self->state]); printk("%s: RECV_UI_FRAME: next state %s\n", __FUNCTION__, irlap_state[self->state]);
irlap_start_poll_timer(self, self->poll_timeout); irlap_start_poll_timer(self, self->poll_timeout);
} }
break; break;
case RECV_RR_RSP: case RECV_RR_RSP:
/* /*
* If you get a RR, the remote isn't busy anymore, * If you get a RR, the remote isn't busy anymore,
* no matter what the NR * no matter what the NR
*/ */
self->remote_busy = FALSE; self->remote_busy = FALSE;
/* /*
* Nr as expected? * Nr as expected?
*/ */
ret = irlap_validate_nr_received(self, info->nr); ret = irlap_validate_nr_received(self, info->nr);
if (ret == NR_EXPECTED) { if (ret == NR_EXPECTED) {
/* Stop final timer */ /* Stop final timer */
del_timer(&self->final_timer); del_timer(&self->final_timer);
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
/* /*
* Got expected NR, so reset the retry_count. This * Got expected NR, so reset the retry_count. This
* is not done by the IrLAP standard , which is * is not done by the IrLAP standard , which is
* strange! DB. * strange! DB.
*/ */
self->retry_count = 0; self->retry_count = 0;
irlap_wait_min_turn_around(self, &self->qos_tx); irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_next_state(self, LAP_XMIT_P); irlap_next_state(self, LAP_XMIT_P);
...@@ -1388,22 +1388,22 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1388,22 +1388,22 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
/* Start poll timer */ /* Start poll timer */
irlap_start_poll_timer(self, self->poll_timeout); irlap_start_poll_timer(self, self->poll_timeout);
} else if (ret == NR_UNEXPECTED) { } else if (ret == NR_UNEXPECTED) {
ASSERT(info != NULL, return -1;); ASSERT(info != NULL, return -1;);
/* /*
* Unexpected nr! * Unexpected nr!
*/ */
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
IRDA_DEBUG(4, "RECV_RR_FRAME: Retrans:%d, nr=%d, va=%d, " IRDA_DEBUG(4, "RECV_RR_FRAME: Retrans:%d, nr=%d, va=%d, "
"vs=%d, vr=%d\n", "vs=%d, vr=%d\n",
self->retry_count, info->nr, self->va, self->retry_count, info->nr, self->va,
self->vs, self->vr); self->vs, self->vr);
/* Resend rejected frames */ /* Resend rejected frames */
irlap_resend_rejected_frames(self, CMD_FRAME); irlap_resend_rejected_frames(self, CMD_FRAME);
irlap_next_state(self, LAP_NRM_P); irlap_next_state(self, LAP_NRM_P);
} else if (ret == NR_INVALID) { } else if (ret == NR_INVALID) {
IRDA_DEBUG(1, __FUNCTION__ "(), Received RR with " IRDA_DEBUG(1, __FUNCTION__ "(), Received RR with "
...@@ -1426,7 +1426,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1426,7 +1426,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
irlap_next_state(self, LAP_XMIT_P); irlap_next_state(self, LAP_XMIT_P);
/* Start poll timer */ /* Start poll timer */
irlap_start_poll_timer(self, self->poll_timeout); irlap_start_poll_timer(self, self->poll_timeout);
break; break;
...@@ -1437,7 +1437,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1437,7 +1437,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
irlap_reset_indication(self); irlap_reset_indication(self);
break; break;
case FINAL_TIMER_EXPIRED: case FINAL_TIMER_EXPIRED:
/* /*
* We are allowed to wait for additional 300 ms if * We are allowed to wait for additional 300 ms if
* final timer expires when we are in the middle * final timer expires when we are in the middle
* of receiving a frame (page 45, IrLAP). Check that * of receiving a frame (page 45, IrLAP). Check that
...@@ -1449,8 +1449,8 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1449,8 +1449,8 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
irlap_start_final_timer(self, MSECS_TO_JIFFIES(300)); irlap_start_final_timer(self, MSECS_TO_JIFFIES(300));
/* /*
* Don't allow this to happen one more time in a row, * Don't allow this to happen one more time in a row,
* or else we can get a pretty tight loop here if * or else we can get a pretty tight loop here if
* if we only receive half a frame. DB. * if we only receive half a frame. DB.
*/ */
self->add_wait = TRUE; self->add_wait = TRUE;
...@@ -1463,9 +1463,9 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1463,9 +1463,9 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
/* Retry sending the pf bit to the secondary */ /* Retry sending the pf bit to the secondary */
irlap_wait_min_turn_around(self, &self->qos_tx); irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_send_rr_frame(self, CMD_FRAME); irlap_send_rr_frame(self, CMD_FRAME);
irlap_start_final_timer(self, self->final_timeout); irlap_start_final_timer(self, self->final_timeout);
self->retry_count++; self->retry_count++;
IRDA_DEBUG(4, "irlap_state_nrm_p: FINAL_TIMER_EXPIRED:" IRDA_DEBUG(4, "irlap_state_nrm_p: FINAL_TIMER_EXPIRED:"
" retry_count=%d\n", self->retry_count); " retry_count=%d\n", self->retry_count);
...@@ -1515,7 +1515,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1515,7 +1515,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
irlap_disconnect_request(self); irlap_disconnect_request(self);
break; break;
default: default:
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %s\n", IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]); irlap_event[event]);
ret = -1; ret = -1;
...@@ -1531,16 +1531,16 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1531,16 +1531,16 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
* awaiting reset of disconnect request. * awaiting reset of disconnect request.
* *
*/ */
static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
int ret = 0; int ret = 0;
IRDA_DEBUG(3, __FUNCTION__ "(), event = %s\n", irlap_event[event]); IRDA_DEBUG(3, __FUNCTION__ "(), event = %s\n", irlap_event[event]);
ASSERT(self != NULL, return -1;); ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;); ASSERT(self->magic == LAP_MAGIC, return -1;);
switch (event) { switch (event) {
case RESET_REQUEST: case RESET_REQUEST:
if (self->xmitflag) { if (self->xmitflag) {
...@@ -1562,11 +1562,11 @@ static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1562,11 +1562,11 @@ static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event,
irlap_next_state( self, LAP_PCLOSE); irlap_next_state( self, LAP_PCLOSE);
break; break;
default: default:
IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n", IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]); irlap_event[event]);
ret = -1; ret = -1;
break; break;
} }
return ret; return ret;
} }
...@@ -1578,16 +1578,16 @@ static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1578,16 +1578,16 @@ static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event,
* reply. * reply.
* *
*/ */
static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
int ret = 0; int ret = 0;
IRDA_DEBUG(3, __FUNCTION__ "(), event = %s\n", irlap_event[event]); IRDA_DEBUG(3, __FUNCTION__ "(), event = %s\n", irlap_event[event]);
ASSERT(self != NULL, return -1;); ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;); ASSERT(self->magic == LAP_MAGIC, return -1;);
switch (event) { switch (event) {
case RECV_DISC_CMD: case RECV_DISC_CMD:
del_timer(&self->final_timer); del_timer(&self->final_timer);
...@@ -1602,12 +1602,12 @@ static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1602,12 +1602,12 @@ static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event,
break; break;
case RECV_UA_RSP: case RECV_UA_RSP:
del_timer(&self->final_timer); del_timer(&self->final_timer);
/* Initiate connection state */ /* Initiate connection state */
irlap_initiate_connection_state(self); irlap_initiate_connection_state(self);
irlap_reset_confirm(); irlap_reset_confirm();
self->remote_busy = FALSE; self->remote_busy = FALSE;
irlap_next_state(self, LAP_XMIT_P); irlap_next_state(self, LAP_XMIT_P);
...@@ -1628,16 +1628,16 @@ static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1628,16 +1628,16 @@ static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event,
irlap_next_state(self, LAP_RESET); irlap_next_state(self, LAP_RESET);
} else if (self->retry_count >= self->N3) { } else if (self->retry_count >= self->N3) {
irlap_apply_default_connection_parameters(self); irlap_apply_default_connection_parameters(self);
/* Always switch state before calling upper layers */ /* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM); irlap_next_state(self, LAP_NDM);
irlap_disconnect_indication(self, LAP_NO_RESPONSE); irlap_disconnect_indication(self, LAP_NO_RESPONSE);
} }
break; break;
case RECV_SNRM_CMD: case RECV_SNRM_CMD:
/* /*
* SNRM frame is not allowed to contain an I-field in this * SNRM frame is not allowed to contain an I-field in this
* state * state
*/ */
if (!info) { if (!info) {
...@@ -1649,47 +1649,47 @@ static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1649,47 +1649,47 @@ static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event,
irlap_start_wd_timer(self, self->wd_timeout); irlap_start_wd_timer(self, self->wd_timeout);
irlap_next_state(self, LAP_NDM); irlap_next_state(self, LAP_NDM);
} else { } else {
IRDA_DEBUG(0, __FUNCTION__ IRDA_DEBUG(0, __FUNCTION__
"(), SNRM frame contained an I field!\n"); "(), SNRM frame contained an I field!\n");
} }
break; break;
default: default:
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %s\n", IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]); irlap_event[event]);
ret = -1; ret = -1;
break; break;
} }
return ret; return ret;
} }
/* /*
* Function irlap_state_xmit_s (event, skb, info) * Function irlap_state_xmit_s (event, skb, info)
* *
* XMIT_S, The secondary station has been given the right to transmit, * XMIT_S, The secondary station has been given the right to transmit,
* and we therefor do not expect to receive any transmissions from other * and we therefor do not expect to receive any transmissions from other
* stations. * stations.
*/ */
static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
int ret = 0; int ret = 0;
IRDA_DEBUG(4, __FUNCTION__ "(), event=%s\n", irlap_event[event]); IRDA_DEBUG(4, __FUNCTION__ "(), event=%s\n", irlap_event[event]);
ASSERT(self != NULL, return -ENODEV;); ASSERT(self != NULL, return -ENODEV;);
ASSERT(self->magic == LAP_MAGIC, return -EBADR;); ASSERT(self->magic == LAP_MAGIC, return -EBADR;);
switch (event) { switch (event) {
case SEND_I_CMD: case SEND_I_CMD:
/* /*
* Send frame only if send window > 1 * Send frame only if send window > 1
*/ */
if ((self->window > 0) && (!self->remote_busy)) { if ((self->window > 0) && (!self->remote_busy)) {
#ifdef CONFIG_IRDA_DYNAMIC_WINDOW #ifdef CONFIG_IRDA_DYNAMIC_WINDOW
/* /*
* Test if we have transmitted more bytes over the * Test if we have transmitted more bytes over the
* link than its possible to do with the current * link than its possible to do with the current
* speed and turn-around-time. * speed and turn-around-time.
*/ */
if (skb->len > self->bytes_left) { if (skb->len > self->bytes_left) {
...@@ -1697,7 +1697,7 @@ static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1697,7 +1697,7 @@ static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event,
/* /*
* Switch to NRM_S, this is only possible * Switch to NRM_S, this is only possible
* when we are in secondary mode, since we * when we are in secondary mode, since we
* must be sure that we don't miss any RR * must be sure that we don't miss any RR
* frames * frames
*/ */
...@@ -1715,18 +1715,18 @@ static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1715,18 +1715,18 @@ static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event,
* Send data with final bit cleared only if window > 1 * Send data with final bit cleared only if window > 1
* and there is more frames to be sent * and there is more frames to be sent
*/ */
if ((self->window > 1) && if ((self->window > 1) &&
skb_queue_len(&self->txq) > 0) skb_queue_len(&self->txq) > 0)
{ {
irlap_send_data_secondary(self, skb); irlap_send_data_secondary(self, skb);
irlap_next_state(self, LAP_XMIT_S); irlap_next_state(self, LAP_XMIT_S);
} else { } else {
irlap_send_data_secondary_final(self, skb); irlap_send_data_secondary_final(self, skb);
irlap_next_state(self, LAP_NRM_S); irlap_next_state(self, LAP_NRM_S);
/* /*
* Make sure state machine does not try to send * Make sure state machine does not try to send
* any more frames * any more frames
*/ */
ret = -EPROTO; ret = -EPROTO;
} }
...@@ -1747,7 +1747,7 @@ static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1747,7 +1747,7 @@ static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event,
* when we return... - Jean II */ * when we return... - Jean II */
break; break;
default: default:
IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n", IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]); irlap_event[event]);
ret = -EINVAL; ret = -EINVAL;
...@@ -1759,12 +1759,12 @@ static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1759,12 +1759,12 @@ static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event,
/* /*
* Function irlap_state_nrm_s (event, skb, info) * Function irlap_state_nrm_s (event, skb, info)
* *
* NRM_S (Normal Response Mode as Secondary) state, in this state we are * NRM_S (Normal Response Mode as Secondary) state, in this state we are
* expecting to receive frames from the primary station * expecting to receive frames from the primary station
* *
*/ */
static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
int ns_status; int ns_status;
int nr_status; int nr_status;
...@@ -1779,28 +1779,28 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1779,28 +1779,28 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
case RECV_I_CMD: /* Optimize for the common case */ case RECV_I_CMD: /* Optimize for the common case */
/* FIXME: must check for remote_busy below */ /* FIXME: must check for remote_busy below */
IRDA_DEBUG(4, __FUNCTION__ "(), event=%s nr=%d, vs=%d, ns=%d, " IRDA_DEBUG(4, __FUNCTION__ "(), event=%s nr=%d, vs=%d, ns=%d, "
"vr=%d, pf=%d\n", irlap_event[event], info->nr, "vr=%d, pf=%d\n", irlap_event[event], info->nr,
self->vs, info->ns, self->vr, info->pf); self->vs, info->ns, self->vr, info->pf);
self->retry_count = 0; self->retry_count = 0;
ns_status = irlap_validate_ns_received(self, info->ns); ns_status = irlap_validate_ns_received(self, info->ns);
nr_status = irlap_validate_nr_received(self, info->nr); nr_status = irlap_validate_nr_received(self, info->nr);
/* /*
* Check for expected I(nformation) frame * Check for expected I(nformation) frame
*/ */
if ((ns_status == NS_EXPECTED) && (nr_status == NR_EXPECTED)) { if ((ns_status == NS_EXPECTED) && (nr_status == NR_EXPECTED)) {
/* /*
* poll bit cleared? * poll bit cleared?
*/ */
if (!info->pf) { if (!info->pf) {
self->vr = (self->vr + 1) % 8; self->vr = (self->vr + 1) % 8;
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
self->ack_required = TRUE; self->ack_required = TRUE;
/* /*
* Starting WD-timer here is optional, but * Starting WD-timer here is optional, but
* not recommended. Note 6 IrLAP p. 83 * not recommended. Note 6 IrLAP p. 83
...@@ -1815,18 +1815,18 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1815,18 +1815,18 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
break; break;
} else { } else {
self->vr = (self->vr + 1) % 8; self->vr = (self->vr + 1) % 8;
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
/* /*
* We should wait before sending RR, and * We should wait before sending RR, and
* also before changing to XMIT_S * also before changing to XMIT_S
* state. (note 1, IrLAP p. 82) * state. (note 1, IrLAP p. 82)
*/ */
irlap_wait_min_turn_around(self, &self->qos_tx); irlap_wait_min_turn_around(self, &self->qos_tx);
/* /*
* Give higher layers a chance to * Give higher layers a chance to
* immediately reply with some data before * immediately reply with some data before
* we decide if we should send a RR frame * we decide if we should send a RR frame
...@@ -1835,17 +1835,17 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1835,17 +1835,17 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
irlap_data_indication(self, skb, FALSE); irlap_data_indication(self, skb, FALSE);
/* Any pending data requests? */ /* Any pending data requests? */
if ((skb_queue_len(&self->txq) > 0) && if ((skb_queue_len(&self->txq) > 0) &&
(self->window > 0)) (self->window > 0))
{ {
self->ack_required = TRUE; self->ack_required = TRUE;
del_timer(&self->wd_timer); del_timer(&self->wd_timer);
irlap_next_state(self, LAP_XMIT_S); irlap_next_state(self, LAP_XMIT_S);
} else { } else {
irlap_send_rr_frame(self, RSP_FRAME); irlap_send_rr_frame(self, RSP_FRAME);
irlap_start_wd_timer(self, irlap_start_wd_timer(self,
self->wd_timeout); self->wd_timeout);
/* Keep the state */ /* Keep the state */
...@@ -1862,33 +1862,33 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1862,33 +1862,33 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
/* Unexpected next to send, with final bit cleared */ /* Unexpected next to send, with final bit cleared */
if (!info->pf) { if (!info->pf) {
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
irlap_start_wd_timer(self, self->wd_timeout); irlap_start_wd_timer(self, self->wd_timeout);
} else { } else {
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
irlap_wait_min_turn_around(self, &self->qos_tx); irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_send_rr_frame(self, CMD_FRAME); irlap_send_rr_frame(self, CMD_FRAME);
irlap_start_wd_timer(self, self->wd_timeout); irlap_start_wd_timer(self, self->wd_timeout);
} }
break; break;
} }
/* /*
* Unexpected Next to Receive(NR) ? * Unexpected Next to Receive(NR) ?
*/ */
if ((ns_status == NS_EXPECTED) && (nr_status == NR_UNEXPECTED)) if ((ns_status == NS_EXPECTED) && (nr_status == NR_UNEXPECTED))
{ {
if (info->pf) { if (info->pf) {
IRDA_DEBUG(4, "RECV_I_RSP: frame(s) lost\n"); IRDA_DEBUG(4, "RECV_I_RSP: frame(s) lost\n");
self->vr = (self->vr + 1) % 8; self->vr = (self->vr + 1) % 8;
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
/* Resend rejected frames */ /* Resend rejected frames */
irlap_resend_rejected_frames(self, RSP_FRAME); irlap_resend_rejected_frames(self, RSP_FRAME);
...@@ -1905,10 +1905,10 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1905,10 +1905,10 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
*/ */
if (!info->pf) { if (!info->pf) {
self->vr = (self->vr + 1) % 8; self->vr = (self->vr + 1) % 8;
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
/* Keep state, do not move this line */ /* Keep state, do not move this line */
irlap_next_state(self, LAP_NRM_S); irlap_next_state(self, LAP_NRM_S);
...@@ -1917,7 +1917,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1917,7 +1917,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
} }
break; break;
} }
if (ret == NR_INVALID) { if (ret == NR_INVALID) {
IRDA_DEBUG(0, "NRM_S, NR_INVALID not implemented!\n"); IRDA_DEBUG(0, "NRM_S, NR_INVALID not implemented!\n");
} }
...@@ -1926,7 +1926,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1926,7 +1926,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
} }
break; break;
case RECV_UI_FRAME: case RECV_UI_FRAME:
/* /*
* poll bit cleared? * poll bit cleared?
*/ */
if (!info->pf) { if (!info->pf) {
...@@ -1936,11 +1936,11 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1936,11 +1936,11 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
/* /*
* Any pending data requests? * Any pending data requests?
*/ */
if ((skb_queue_len(&self->txq) > 0) && if ((skb_queue_len(&self->txq) > 0) &&
(self->window > 0) && !self->remote_busy) (self->window > 0) && !self->remote_busy)
{ {
irlap_data_indication(self, skb, TRUE); irlap_data_indication(self, skb, TRUE);
del_timer(&self->wd_timer); del_timer(&self->wd_timer);
irlap_next_state(self, LAP_XMIT_S); irlap_next_state(self, LAP_XMIT_S);
...@@ -1951,7 +1951,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1951,7 +1951,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
irlap_send_rr_frame(self, RSP_FRAME); irlap_send_rr_frame(self, RSP_FRAME);
self->ack_required = FALSE; self->ack_required = FALSE;
irlap_start_wd_timer(self, self->wd_timeout); irlap_start_wd_timer(self, self->wd_timeout);
/* Keep the state */ /* Keep the state */
...@@ -1962,28 +1962,28 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1962,28 +1962,28 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
case RECV_RR_CMD: case RECV_RR_CMD:
self->retry_count = 0; self->retry_count = 0;
/* /*
* Nr as expected? * Nr as expected?
*/ */
nr_status = irlap_validate_nr_received(self, info->nr); nr_status = irlap_validate_nr_received(self, info->nr);
if (nr_status == NR_EXPECTED) { if (nr_status == NR_EXPECTED) {
if ((skb_queue_len( &self->txq) > 0) && if ((skb_queue_len( &self->txq) > 0) &&
(self->window > 0)) { (self->window > 0)) {
self->remote_busy = FALSE; self->remote_busy = FALSE;
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
del_timer(&self->wd_timer); del_timer(&self->wd_timer);
irlap_wait_min_turn_around(self, &self->qos_tx); irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_next_state(self, LAP_XMIT_S); irlap_next_state(self, LAP_XMIT_S);
} else { } else {
self->remote_busy = FALSE; self->remote_busy = FALSE;
/* Update Nr received */ /* Update Nr received */
irlap_update_nr_received(self, info->nr); irlap_update_nr_received(self, info->nr);
irlap_wait_min_turn_around(self, &self->qos_tx); irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_start_wd_timer(self, self->wd_timeout); irlap_start_wd_timer(self, self->wd_timeout);
/* Note : if the link is idle (this case), /* Note : if the link is idle (this case),
* we never go in XMIT_S, so we never get a * we never go in XMIT_S, so we never get a
* chance to process any DISCONNECT_REQUEST. * chance to process any DISCONNECT_REQUEST.
...@@ -1997,7 +1997,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -1997,7 +1997,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
} else { } else {
/* Just send back pf bit */ /* Just send back pf bit */
irlap_send_rr_frame(self, RSP_FRAME); irlap_send_rr_frame(self, RSP_FRAME);
irlap_next_state(self, LAP_NRM_S); irlap_next_state(self, LAP_NRM_S);
} }
} }
...@@ -2009,11 +2009,11 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -2009,11 +2009,11 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
irlap_start_wd_timer(self, self->wd_timeout); irlap_start_wd_timer(self, self->wd_timeout);
/* Keep state */ /* Keep state */
irlap_next_state(self, LAP_NRM_S); irlap_next_state(self, LAP_NRM_S);
} else { } else {
IRDA_DEBUG(1, __FUNCTION__ IRDA_DEBUG(1, __FUNCTION__
"(), invalid nr not implemented!\n"); "(), invalid nr not implemented!\n");
} }
break; break;
case RECV_SNRM_CMD: case RECV_SNRM_CMD:
/* SNRM frame is not allowed to contain an I-field */ /* SNRM frame is not allowed to contain an I-field */
...@@ -2021,12 +2021,12 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -2021,12 +2021,12 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
del_timer(&self->wd_timer); del_timer(&self->wd_timer);
IRDA_DEBUG(1, __FUNCTION__ "(), received SNRM cmd\n"); IRDA_DEBUG(1, __FUNCTION__ "(), received SNRM cmd\n");
irlap_next_state(self, LAP_RESET_CHECK); irlap_next_state(self, LAP_RESET_CHECK);
irlap_reset_indication(self); irlap_reset_indication(self);
} else { } else {
IRDA_DEBUG(0, __FUNCTION__ IRDA_DEBUG(0, __FUNCTION__
"(), SNRM frame contained an I-field!\n"); "(), SNRM frame contained an I-field!\n");
} }
break; break;
case RECV_REJ_CMD: case RECV_REJ_CMD:
...@@ -2057,7 +2057,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -2057,7 +2057,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
* which explain why we use (self->N2 / 2) here !!! * which explain why we use (self->N2 / 2) here !!!
* Jean II * Jean II
*/ */
IRDA_DEBUG(1, __FUNCTION__ "(), retry_count = %d\n", IRDA_DEBUG(1, __FUNCTION__ "(), retry_count = %d\n",
self->retry_count); self->retry_count);
if (self->retry_count < (self->N2 / 2)) { if (self->retry_count < (self->N2 / 2)) {
...@@ -2070,7 +2070,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -2070,7 +2070,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
STATUS_NO_ACTIVITY); STATUS_NO_ACTIVITY);
} else { } else {
irlap_apply_default_connection_parameters(self); irlap_apply_default_connection_parameters(self);
/* Always switch state before calling upper layers */ /* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM); irlap_next_state(self, LAP_NDM);
irlap_disconnect_indication(self, LAP_NO_RESPONSE); irlap_disconnect_indication(self, LAP_NO_RESPONSE);
...@@ -2110,7 +2110,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -2110,7 +2110,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
irlap_send_test_frame(self, self->caddr, info->daddr, skb); irlap_send_test_frame(self, self->caddr, info->daddr, skb);
break; break;
default: default:
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n", IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
event, irlap_event[event]); event, irlap_event[event]);
ret = -EINVAL; ret = -EINVAL;
...@@ -2121,12 +2121,9 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -2121,12 +2121,9 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
/* /*
* Function irlap_state_sclose (self, event, skb, info) * Function irlap_state_sclose (self, event, skb, info)
*
*
*
*/ */
static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info) struct sk_buff *skb, struct irlap_info *info)
{ {
int ret = 0; int ret = 0;
...@@ -2134,7 +2131,7 @@ static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -2134,7 +2131,7 @@ static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event,
ASSERT(self != NULL, return -ENODEV;); ASSERT(self != NULL, return -ENODEV;);
ASSERT(self->magic == LAP_MAGIC, return -EBADR;); ASSERT(self->magic == LAP_MAGIC, return -EBADR;);
switch (event) { switch (event) {
case RECV_DISC_CMD: case RECV_DISC_CMD:
/* Always switch state before calling upper layers */ /* Always switch state before calling upper layers */
...@@ -2156,7 +2153,7 @@ static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -2156,7 +2153,7 @@ static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event,
del_timer(&self->wd_timer); del_timer(&self->wd_timer);
irlap_apply_default_connection_parameters(self); irlap_apply_default_connection_parameters(self);
irlap_disconnect_indication(self, LAP_DISC_INDICATION); irlap_disconnect_indication(self, LAP_DISC_INDICATION);
break; break;
case WD_TIMER_EXPIRED: case WD_TIMER_EXPIRED:
...@@ -2164,11 +2161,11 @@ static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -2164,11 +2161,11 @@ static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event,
irlap_next_state(self, LAP_NDM); irlap_next_state(self, LAP_NDM);
irlap_apply_default_connection_parameters(self); irlap_apply_default_connection_parameters(self);
irlap_disconnect_indication(self, LAP_DISC_INDICATION); irlap_disconnect_indication(self, LAP_DISC_INDICATION);
break; break;
default: default:
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n", IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
event, irlap_event[event]); event, irlap_event[event]);
ret = -EINVAL; ret = -EINVAL;
...@@ -2178,24 +2175,24 @@ static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event, ...@@ -2178,24 +2175,24 @@ static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event,
return -1; return -1;
} }
static int irlap_state_reset_check( struct irlap_cb *self, IRLAP_EVENT event, static int irlap_state_reset_check( struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct sk_buff *skb,
struct irlap_info *info) struct irlap_info *info)
{ {
int ret = 0; int ret = 0;
IRDA_DEBUG(1, __FUNCTION__ "(), event=%s\n", irlap_event[event]); IRDA_DEBUG(1, __FUNCTION__ "(), event=%s\n", irlap_event[event]);
ASSERT(self != NULL, return -ENODEV;); ASSERT(self != NULL, return -ENODEV;);
ASSERT(self->magic == LAP_MAGIC, return -EBADR;); ASSERT(self->magic == LAP_MAGIC, return -EBADR;);
switch (event) { switch (event) {
case RESET_RESPONSE: case RESET_RESPONSE:
irlap_send_ua_response_frame(self, &self->qos_rx); irlap_send_ua_response_frame(self, &self->qos_rx);
irlap_initiate_connection_state(self); irlap_initiate_connection_state(self);
irlap_start_wd_timer(self, WD_TIMEOUT); irlap_start_wd_timer(self, WD_TIMEOUT);
irlap_flush_all_queues(self); irlap_flush_all_queues(self);
irlap_next_state(self, LAP_NRM_S); irlap_next_state(self, LAP_NRM_S);
break; break;
case DISCONNECT_REQUEST: case DISCONNECT_REQUEST:
...@@ -2205,7 +2202,7 @@ static int irlap_state_reset_check( struct irlap_cb *self, IRLAP_EVENT event, ...@@ -2205,7 +2202,7 @@ static int irlap_state_reset_check( struct irlap_cb *self, IRLAP_EVENT event,
irlap_next_state(self, LAP_SCLOSE); irlap_next_state(self, LAP_SCLOSE);
break; break;
default: default:
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n", IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
event, irlap_event[event]); event, irlap_event[event]);
ret = -EINVAL; ret = -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment