diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-01-29 01:41:54 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-01-29 01:41:54 +0000 |
commit | f969d69ba9f952e5bdd38278e25e26a3e4a61a70 (patch) | |
tree | b3530d803df59d726afaabebc6626987dee1ca05 /net/irda/irlan/irlan_common.c | |
parent | a10ce7ef2066b455d69187643ddf2073bfc4db24 (diff) |
Merge with 2.3.27.
Diffstat (limited to 'net/irda/irlan/irlan_common.c')
-rw-r--r-- | net/irda/irlan/irlan_common.c | 96 |
1 files changed, 49 insertions, 47 deletions
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index 0e80c0db8..caa3550c1 100644 --- a/net/irda/irlan/irlan_common.c +++ b/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 @@ static __u32 ckey, skey; /* 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 @@ void irlan_watchdog_timer_expired(void *data) 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 @@ void irlan_watchdog_timer_expired(void *data) /* 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 @@ void irlan_watchdog_timer_expired(void *data) */ 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_watchdog_timer_expired(void *data) */ 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 @@ int __init irlan_init(void) struct irlan_cb *new; __u16 hints; - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); /* Allocate master structure */ irlan = hashbin_new(HB_LOCAL); @@ -176,10 +175,10 @@ int __init irlan_init(void) return -ENOMEM; } #ifdef CONFIG_PROC_FS - create_proc_entry("irlan", 0, proc_irda)->get_info = irlan_proc_read; + 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 @@ int __init irlan_init(void) void irlan_cleanup(void) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); irlmp_unregister_client(ckey); @@ -230,7 +229,7 @@ int irlan_register_netdev(struct irlan_cb *self) { 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 @@ int irlan_register_netdev(struct irlan_cb *self) 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 *irlan_open(__u32 saddr, __u32 daddr, int netdev) { struct irlan_cb *self; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); /* * Initialize the irlan structure. @@ -321,7 +320,7 @@ static void __irlan_close(struct irlan_cb *self) { 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 @@ static void __irlan_close(struct irlan_cb *self) /* 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 @@ void irlan_close(struct irlan_cb *self) { 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 @@ void irlan_connect_indication(void *instance, void *sap, struct qos_info *qos, 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 @@ void irlan_connect_indication(void *instance, void *sap, struct qos_info *qos, 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 @@ void irlan_connect_confirm(void *instance, void *sap, struct qos_info *qos, /* 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 @@ void irlan_disconnect_indication(void *instance, void *sap, LM_REASON reason, 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 @@ void irlan_disconnect_indication(void *instance, void *sap, LM_REASON reason, 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 @@ void irlan_disconnect_indication(void *instance, void *sap, LM_REASON reason, 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 @@ void irlan_open_data_tsap(struct irlan_cb *self) 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 @@ void irlan_open_data_tsap(struct irlan_cb *self) 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_open_data_tsap(struct irlan_cb *self) 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 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self) { 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 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self) 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 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self) */ 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 @@ void irlan_get_provider_info(struct irlan_cb *self) 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 @@ void irlan_open_data_channel(struct irlan_cb *self) 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 @@ void irlan_close_data_channel(struct irlan_cb *self) 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 @@ void irlan_open_unicast_addr(struct irlan_cb *self) 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 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status) 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 @@ void irlan_set_multicast_filter(struct irlan_cb *self, int status) 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 @@ void irlan_get_unicast_addr(struct irlan_cb *self) 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 @@ void irlan_get_media_char(struct irlan_cb *self) 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 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, 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 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, 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 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, /* 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 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) __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 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) 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 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) 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; } |