patch-2.3.26 linux/net/irda/irlan/irlan_common.c
Next file: linux/net/irda/irlan/irlan_eth.c
Previous file: linux/net/irda/irlan/irlan_client_event.c
Back to the patch index
Back to the overall index
- Lines: 402
- Date:
Tue Nov 2 17:07:55 1999
- Orig file:
v2.3.25/linux/net/irda/irlan/irlan_common.c
- Orig date:
Mon Nov 1 13:56:27 1999
diff -u --recursive --new-file v2.3.25/linux/net/irda/irlan/irlan_common.c linux/net/irda/irlan/irlan_common.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sun Aug 31 20:14:37 1997
- * Modified at: Tue Oct 5 11:36:11 1999
+ * Modified at: Sun Oct 31 19:43:50 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>,
@@ -61,7 +61,6 @@
/* Module parameters */
static int eth = 0; /* Use "eth" or "irlan" name for devices */
static int access = ACCESS_PEER; /* PEER, DIRECT or HOSTED */
-static int timeout = IRLAN_TIMEOUT;
static char *irlan_state[] = {
"IRLAN_IDLE",
@@ -114,7 +113,7 @@
struct irmanager_event mgr_event;
struct irlan_cb *self;
- DEBUG(0, __FUNCTION__ "()\n");
+ IRDA_DEBUG(0, __FUNCTION__ "()\n");
self = (struct irlan_cb *) data;
@@ -123,7 +122,7 @@
/* Check if device still configured */
if (self->dev.start) {
- DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), notifying irmanager to stop irlan!\n");
mgr_event.event = EVENT_IRLAN_STOP;
sprintf(mgr_event.devname, "%s", self->ifname);
@@ -137,7 +136,7 @@
*/
self->notify_irmanager = FALSE;
} else {
- DEBUG(0, __FUNCTION__ "(), closing instance!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), closing instance!\n");
/*irlan_close(self);*/
}
}
@@ -150,7 +149,7 @@
*/
void irlan_start_watchdog_timer(struct irlan_cb *self, int timeout)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
irda_start_timer(&self->watchdog_timer, timeout, (void *) self,
irlan_watchdog_timer_expired);
@@ -167,7 +166,7 @@
struct irlan_cb *new;
__u16 hints;
- DEBUG(4, __FUNCTION__"()\n");
+ IRDA_DEBUG(4, __FUNCTION__"()\n");
/* Allocate master structure */
irlan = hashbin_new(HB_LOCAL);
@@ -179,7 +178,7 @@
create_proc_info_entry("irlan", 0, proc_irda, irlan_proc_read);
#endif /* CONFIG_PROC_FS */
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
hints = irlmp_service_to_hint(S_LAN);
@@ -205,7 +204,7 @@
void irlan_cleanup(void)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
irlmp_unregister_client(ckey);
@@ -230,7 +229,7 @@
{
int i=0;
- DEBUG(0, __FUNCTION__ "()\n");
+ IRDA_DEBUG(0, __FUNCTION__ "()\n");
/* Check if we should call the device eth<x> or irlan<x> */
if (!eth) {
@@ -242,7 +241,7 @@
self->dev.name = self->ifname;
if (register_netdev(&self->dev) != 0) {
- DEBUG(2, __FUNCTION__ "(), register_netdev() failed!\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), register_netdev() failed!\n");
return -1;
}
self->netdev_registered = TRUE;
@@ -260,7 +259,7 @@
{
struct irlan_cb *self;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
/*
* Initialize the irlan structure.
@@ -321,7 +320,7 @@
{
struct sk_buff *skb;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -331,6 +330,9 @@
/* Close all open connections and remove TSAPs */
irlan_close_tsaps(self);
+
+ if (self->client.iriap)
+ iriap_close(self->client.iriap);
/* Remove frames queued on the control channel */
while ((skb = skb_dequeue(&self->client.txq))) {
@@ -356,21 +358,21 @@
{
struct irlan_cb *entry;
- DEBUG(0, __FUNCTION__ "()\n");
+ IRDA_DEBUG(0, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRLAN_MAGIC, return;);
/* Check if device is still configured */
if (self->dev.start) {
- DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), Device still configured, closing later!\n");
/* Give it a chance to reconnect */
irlan_start_watchdog_timer(self, IRLAN_TIMEOUT);
return;
}
- DEBUG(2, __FUNCTION__ "(), daddr=%08x\n", self->daddr);
+ IRDA_DEBUG(2, __FUNCTION__ "(), daddr=%08x\n", self->daddr);
entry = hashbin_remove(irlan, self->daddr, NULL);
ASSERT(entry == self, return;);
@@ -391,7 +393,7 @@
struct irlan_cb *self;
struct tsap_cb *tsap;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
self = (struct irlan_cb *) instance;
tsap = (struct tsap_cb *) sap;
@@ -403,7 +405,7 @@
self->max_sdu_size = max_sdu_size;
self->max_header_size = max_header_size;
- DEBUG(0, "IrLAN, We are now connected!\n");
+ IRDA_DEBUG(0, "IrLAN, We are now connected!\n");
del_timer(&self->watchdog_timer);
@@ -438,7 +440,7 @@
/* TODO: we could set the MTU depending on the max_sdu_size */
- DEBUG(2, "IrLAN, We are now connected!\n");
+ IRDA_DEBUG(2, "IrLAN, We are now connected!\n");
del_timer(&self->watchdog_timer);
/*
@@ -470,7 +472,7 @@
struct irlan_cb *self;
struct tsap_cb *tsap;
- DEBUG(0, __FUNCTION__ "(), reason=%d\n", reason);
+ IRDA_DEBUG(0, __FUNCTION__ "(), reason=%d\n", reason);
self = (struct irlan_cb *) instance;
tsap = (struct tsap_cb *) sap;
@@ -482,7 +484,7 @@
ASSERT(tsap == self->tsap_data, return;);
- DEBUG(2, "IrLAN, data channel disconnected by peer!\n");
+ IRDA_DEBUG(2, "IrLAN, data channel disconnected by peer!\n");
switch(reason) {
case LM_USER_REQUEST: /* User request */
@@ -492,13 +494,13 @@
irlan_start_watchdog_timer(self, IRLAN_TIMEOUT);
break;
case LM_CONNECT_FAILURE: /* Failed to establish IrLAP connection */
- DEBUG(2, __FUNCTION__ "(), LM_CONNECT_FAILURE not impl\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), LM_CONNECT_FAILURE not impl\n");
break;
case LM_LAP_RESET: /* IrLAP reset */
- DEBUG(2, __FUNCTION__ "(), LM_CONNECT_FAILURE not impl\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), LM_CONNECT_FAILURE not impl\n");
break;
case LM_INIT_DISCONNECT:
- DEBUG(2, __FUNCTION__ "(), LM_CONNECT_FAILURE not impl\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), LM_CONNECT_FAILURE not impl\n");
break;
default:
break;
@@ -513,7 +515,7 @@
struct tsap_cb *tsap;
notify_t notify;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -535,7 +537,7 @@
tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, ¬ify);
if (!tsap) {
- DEBUG(2, __FUNCTION__ "(), Got no tsap!\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), Got no tsap!\n");
return;
}
self->tsap_data = tsap;
@@ -549,7 +551,7 @@
void irlan_close_tsaps(struct irlan_cb *self)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -634,7 +636,7 @@
{
struct sk_buff *skb;
- DEBUG(3, __FUNCTION__ "()\n");
+ IRDA_DEBUG(3, __FUNCTION__ "()\n");
if (irda_lock(&self->client.tx_busy) == FALSE)
return -EBUSY;
@@ -653,7 +655,7 @@
dev_kfree_skb(skb);
return -1;
}
- DEBUG(3, __FUNCTION__ "(), sending ...\n");
+ IRDA_DEBUG(3, __FUNCTION__ "(), sending ...\n");
return irttp_data_request(self->client.tsap_ctrl, skb);
}
@@ -666,7 +668,7 @@
*/
void irlan_ctrl_data_request(struct irlan_cb *self, struct sk_buff *skb)
{
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
/* Queue command */
skb_queue_tail(&self->client.txq, skb);
@@ -686,7 +688,7 @@
struct sk_buff *skb;
__u8 *frame;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -719,7 +721,7 @@
struct sk_buff *skb;
__u8 *frame;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -752,7 +754,7 @@
struct sk_buff *skb;
__u8 *frame;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -791,7 +793,7 @@
struct sk_buff *skb;
__u8 *frame;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -830,7 +832,7 @@
struct sk_buff *skb;
__u8 *frame;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -870,7 +872,7 @@
struct sk_buff *skb;
__u8 *frame;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -911,7 +913,7 @@
struct sk_buff *skb;
__u8 *frame;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -947,7 +949,7 @@
struct sk_buff *skb;
__u8 *frame;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -1034,7 +1036,7 @@
int n=0;
if (skb == NULL) {
- DEBUG(2, __FUNCTION__ "(), Got NULL skb\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), Got NULL skb\n");
return 0;
}
@@ -1051,7 +1053,7 @@
ASSERT(value_len > 0, return 0;);
break;
default:
- DEBUG(2, __FUNCTION__ "(), Unknown parameter type!\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), Unknown parameter type!\n");
return 0;
break;
}
@@ -1061,7 +1063,7 @@
/* Make space for data */
if (skb_tailroom(skb) < (param_len+value_len+3)) {
- DEBUG(2, __FUNCTION__ "(), No more space at end of skb\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), No more space at end of skb\n");
return 0;
}
skb_put(skb, param_len+value_len+3);
@@ -1108,13 +1110,13 @@
__u16 val_len;
int n=0;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
/* get length of parameter name (1 byte) */
name_len = buf[n++];
if (name_len > 254) {
- DEBUG(2, __FUNCTION__ "(), name_len > 254\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), name_len > 254\n");
return -RSP_INVALID_COMMAND_FORMAT;
}
@@ -1131,7 +1133,7 @@
le16_to_cpus(&val_len); n+=2;
if (val_len > 1016) {
- DEBUG(2, __FUNCTION__ "(), parameter length to long\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), parameter length to long\n");
return -RSP_INVALID_COMMAND_FORMAT;
}
*len = val_len;
@@ -1141,8 +1143,8 @@
value[val_len] = '\0';
n+=val_len;
- DEBUG(4, "Parameter: %s ", name);
- DEBUG(4, "Value: %s\n", value);
+ IRDA_DEBUG(4, "Parameter: %s ", name);
+ IRDA_DEBUG(4, "Value: %s\n", value);
return n;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)