aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/irda/af_irda.c12
-rw-r--r--net/irda/discovery.c58
-rw-r--r--net/irda/ircomm/ircomm_core.c98
-rw-r--r--net/irda/ircomm/ircomm_event.c72
-rw-r--r--net/irda/ircomm/ircomm_lmp.c110
-rw-r--r--net/irda/ircomm/ircomm_param.c94
-rw-r--r--net/irda/ircomm/ircomm_ttp.c88
-rw-r--r--net/irda/ircomm/ircomm_tty.c288
-rw-r--r--net/irda/ircomm/ircomm_tty_attach.c236
-rw-r--r--net/irda/ircomm/ircomm_tty_ioctl.c86
-rw-r--r--net/irda/irda_device.c22
-rw-r--r--net/irda/iriap.c20
-rw-r--r--net/irda/irias_object.c6
-rw-r--r--net/irda/irlan/irlan_client.c150
-rw-r--r--net/irda/irlan/irlan_client_event.c190
-rw-r--r--net/irda/irlan/irlan_common.c318
-rw-r--r--net/irda/irlan/irlan_eth.c102
-rw-r--r--net/irda/irlan/irlan_event.c26
-rw-r--r--net/irda/irlan/irlan_filter.c48
-rw-r--r--net/irda/irlan/irlan_provider.c102
-rw-r--r--net/irda/irlan/irlan_provider_event.c68
-rw-r--r--net/irda/irlap.c14
-rw-r--r--net/irda/irlap_event.c6
-rw-r--r--net/irda/irlap_frame.c6
-rw-r--r--net/irda/irlmp.c16
-rw-r--r--net/irda/irlmp_event.c2
-rw-r--r--net/irda/irlmp_frame.c122
-rw-r--r--net/irda/irmod.c42
-rw-r--r--net/irda/irnet/irnet.h4
-rw-r--r--net/irda/irnet/irnet_irda.c38
-rw-r--r--net/irda/irnet/irnet_irda.h2
-rw-r--r--net/irda/irnet/irnet_ppp.c10
-rw-r--r--net/irda/irproc.c40
-rw-r--r--net/irda/irqueue.c106
-rw-r--r--net/irda/irsysctl.c24
-rw-r--r--net/irda/irttp.c40
-rw-r--r--net/irda/parameters.c2
-rw-r--r--net/irda/qos.c150
-rw-r--r--net/irda/timer.c62
-rw-r--r--net/irda/wrapper.c2
40 files changed, 1441 insertions, 1441 deletions
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 7e1aea89ef05..eabd6838f50a 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -138,7 +138,7 @@ static void irda_disconnect_indication(void *instance, void *sap,
138 sk->sk_shutdown |= SEND_SHUTDOWN; 138 sk->sk_shutdown |= SEND_SHUTDOWN;
139 139
140 sk->sk_state_change(sk); 140 sk->sk_state_change(sk);
141 sock_orphan(sk); 141 sock_orphan(sk);
142 release_sock(sk); 142 release_sock(sk);
143 143
144 /* Close our TSAP. 144 /* Close our TSAP.
@@ -158,7 +158,7 @@ static void irda_disconnect_indication(void *instance, void *sap,
158 irttp_close_tsap(self->tsap); 158 irttp_close_tsap(self->tsap);
159 self->tsap = NULL; 159 self->tsap = NULL;
160 } 160 }
161 } 161 }
162 162
163 /* Note : once we are there, there is not much you want to do 163 /* Note : once we are there, there is not much you want to do
164 * with the socket anymore, apart from closing it. 164 * with the socket anymore, apart from closing it.
@@ -1211,7 +1211,7 @@ static int irda_release(struct socket *sock)
1211 1211
1212 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 1212 IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
1213 1213
1214 if (sk == NULL) 1214 if (sk == NULL)
1215 return 0; 1215 return 0;
1216 1216
1217 lock_sock(sk); 1217 lock_sock(sk);
@@ -1259,7 +1259,7 @@ static int irda_release(struct socket *sock)
1259 * memory leak is now gone... - Jean II 1259 * memory leak is now gone... - Jean II
1260 */ 1260 */
1261 1261
1262 return 0; 1262 return 0;
1263} 1263}
1264 1264
1265/* 1265/*
@@ -1312,7 +1312,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
1312 len = self->max_data_size; 1312 len = self->max_data_size;
1313 } 1313 }
1314 1314
1315 skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16, 1315 skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16,
1316 msg->msg_flags & MSG_DONTWAIT, &err); 1316 msg->msg_flags & MSG_DONTWAIT, &err);
1317 if (!skb) 1317 if (!skb)
1318 return -ENOBUFS; 1318 return -ENOBUFS;
@@ -1714,7 +1714,7 @@ static int irda_shutdown(struct socket *sock, int how)
1714 self->daddr = DEV_ADDR_ANY; /* Until we get re-connected */ 1714 self->daddr = DEV_ADDR_ANY; /* Until we get re-connected */
1715 self->saddr = 0x0; /* so IrLMP assign us any link */ 1715 self->saddr = 0x0; /* so IrLMP assign us any link */
1716 1716
1717 return 0; 1717 return 0;
1718} 1718}
1719 1719
1720/* 1720/*
diff --git a/net/irda/discovery.c b/net/irda/discovery.c
index 89fd2a2cbca6..789478bc3009 100644
--- a/net/irda/discovery.c
+++ b/net/irda/discovery.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: discovery.c 3 * Filename: discovery.c
4 * Version: 0.1 4 * Version: 0.1
5 * Description: Routines for handling discoveries at the IrLMP layer 5 * Description: Routines for handling discoveries at the IrLMP layer
@@ -10,24 +10,24 @@
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * Modified at: Fri May 28 3:11 CST 1999 11 * Modified at: Fri May 28 3:11 CST 1999
12 * Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl> 12 * Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
13 * 13 *
14 * Copyright (c) 1999 Dag Brattli, All Rights Reserved. 14 * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as 17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * This program is distributed in the hope that it will be useful, 21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details. 24 * GNU General Public License for more details.
25 * 25 *
26 * You should have received a copy of the GNU General Public License 26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software 27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA 29 * MA 02111-1307 USA
30 * 30 *
31 ********************************************************************/ 31 ********************************************************************/
32 32
33#include <linux/string.h> 33#include <linux/string.h>
@@ -65,9 +65,9 @@ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new)
65 65
66 spin_lock_irqsave(&cachelog->hb_spinlock, flags); 66 spin_lock_irqsave(&cachelog->hb_spinlock, flags);
67 67
68 /* 68 /*
69 * Remove all discoveries of devices that has previously been 69 * Remove all discoveries of devices that has previously been
70 * discovered on the same link with the same name (info), or the 70 * discovered on the same link with the same name (info), or the
71 * same daddr. We do this since some devices (mostly PDAs) change 71 * same daddr. We do this since some devices (mostly PDAs) change
72 * their device address between every discovery. 72 * their device address between every discovery.
73 */ 73 */
@@ -79,10 +79,10 @@ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new)
79 discovery = (discovery_t *) hashbin_get_next(cachelog); 79 discovery = (discovery_t *) hashbin_get_next(cachelog);
80 80
81 if ((node->data.saddr == new->data.saddr) && 81 if ((node->data.saddr == new->data.saddr) &&
82 ((node->data.daddr == new->data.daddr) || 82 ((node->data.daddr == new->data.daddr) ||
83 (strcmp(node->data.info, new->data.info) == 0))) 83 (strcmp(node->data.info, new->data.info) == 0)))
84 { 84 {
85 /* This discovery is a previous discovery 85 /* This discovery is a previous discovery
86 * from the same device, so just remove it 86 * from the same device, so just remove it
87 */ 87 */
88 hashbin_remove_this(cachelog, (irda_queue_t *) node); 88 hashbin_remove_this(cachelog, (irda_queue_t *) node);
@@ -134,7 +134,7 @@ void irlmp_add_discovery_log(hashbin_t *cachelog, hashbin_t *log)
134 134
135 discovery = (discovery_t *) hashbin_remove_first(log); 135 discovery = (discovery_t *) hashbin_remove_first(log);
136 } 136 }
137 137
138 /* Delete the now empty log */ 138 /* Delete the now empty log */
139 hashbin_delete(log, (FREE_FUNC) kfree); 139 hashbin_delete(log, (FREE_FUNC) kfree);
140} 140}
@@ -232,7 +232,7 @@ void irlmp_dump_discoveries(hashbin_t *log)
232 while (discovery != NULL) { 232 while (discovery != NULL) {
233 IRDA_DEBUG(0, "Discovery:\n"); 233 IRDA_DEBUG(0, "Discovery:\n");
234 IRDA_DEBUG(0, " daddr=%08x\n", discovery->data.daddr); 234 IRDA_DEBUG(0, " daddr=%08x\n", discovery->data.daddr);
235 IRDA_DEBUG(0, " saddr=%08x\n", discovery->data.saddr); 235 IRDA_DEBUG(0, " saddr=%08x\n", discovery->data.saddr);
236 IRDA_DEBUG(0, " nickname=%s\n", discovery->data.info); 236 IRDA_DEBUG(0, " nickname=%s\n", discovery->data.info);
237 237
238 discovery = (discovery_t *) hashbin_get_next(log); 238 discovery = (discovery_t *) hashbin_get_next(log);
@@ -321,26 +321,26 @@ static inline discovery_t *discovery_seq_idx(loff_t pos)
321{ 321{
322 discovery_t *discovery; 322 discovery_t *discovery;
323 323
324 for (discovery = (discovery_t *) hashbin_get_first(irlmp->cachelog); 324 for (discovery = (discovery_t *) hashbin_get_first(irlmp->cachelog);
325 discovery != NULL; 325 discovery != NULL;
326 discovery = (discovery_t *) hashbin_get_next(irlmp->cachelog)) { 326 discovery = (discovery_t *) hashbin_get_next(irlmp->cachelog)) {
327 if (pos-- == 0) 327 if (pos-- == 0)
328 break; 328 break;
329 } 329 }
330 330
331 return discovery; 331 return discovery;
332} 332}
333 333
334static void *discovery_seq_start(struct seq_file *seq, loff_t *pos) 334static void *discovery_seq_start(struct seq_file *seq, loff_t *pos)
335{ 335{
336 spin_lock_irq(&irlmp->cachelog->hb_spinlock); 336 spin_lock_irq(&irlmp->cachelog->hb_spinlock);
337 return *pos ? discovery_seq_idx(*pos - 1) : SEQ_START_TOKEN; 337 return *pos ? discovery_seq_idx(*pos - 1) : SEQ_START_TOKEN;
338} 338}
339 339
340static void *discovery_seq_next(struct seq_file *seq, void *v, loff_t *pos) 340static void *discovery_seq_next(struct seq_file *seq, void *v, loff_t *pos)
341{ 341{
342 ++*pos; 342 ++*pos;
343 return (v == SEQ_START_TOKEN) 343 return (v == SEQ_START_TOKEN)
344 ? (void *) hashbin_get_first(irlmp->cachelog) 344 ? (void *) hashbin_get_first(irlmp->cachelog)
345 : (void *) hashbin_get_next(irlmp->cachelog); 345 : (void *) hashbin_get_next(irlmp->cachelog);
346} 346}
@@ -357,9 +357,9 @@ static int discovery_seq_show(struct seq_file *seq, void *v)
357 else { 357 else {
358 const discovery_t *discovery = v; 358 const discovery_t *discovery = v;
359 359
360 seq_printf(seq, "nickname: %s, hint: 0x%02x%02x", 360 seq_printf(seq, "nickname: %s, hint: 0x%02x%02x",
361 discovery->data.info, 361 discovery->data.info,
362 discovery->data.hints[0], 362 discovery->data.hints[0],
363 discovery->data.hints[1]); 363 discovery->data.hints[1]);
364#if 0 364#if 0
365 if ( discovery->data.hints[0] & HINT_PNP) 365 if ( discovery->data.hints[0] & HINT_PNP)
@@ -376,20 +376,20 @@ static int discovery_seq_show(struct seq_file *seq, void *v)
376 seq_puts(seq, "Fax "); 376 seq_puts(seq, "Fax ");
377 if ( discovery->data.hints[0] & HINT_LAN) 377 if ( discovery->data.hints[0] & HINT_LAN)
378 seq_puts(seq, "LAN Access "); 378 seq_puts(seq, "LAN Access ");
379 379
380 if ( discovery->data.hints[1] & HINT_TELEPHONY) 380 if ( discovery->data.hints[1] & HINT_TELEPHONY)
381 seq_puts(seq, "Telephony "); 381 seq_puts(seq, "Telephony ");
382 if ( discovery->data.hints[1] & HINT_FILE_SERVER) 382 if ( discovery->data.hints[1] & HINT_FILE_SERVER)
383 seq_puts(seq, "File Server "); 383 seq_puts(seq, "File Server ");
384 if ( discovery->data.hints[1] & HINT_COMM) 384 if ( discovery->data.hints[1] & HINT_COMM)
385 seq_puts(seq, "IrCOMM "); 385 seq_puts(seq, "IrCOMM ");
386 if ( discovery->data.hints[1] & HINT_OBEX) 386 if ( discovery->data.hints[1] & HINT_OBEX)
387 seq_puts(seq, "IrOBEX "); 387 seq_puts(seq, "IrOBEX ");
388#endif 388#endif
389 seq_printf(seq,", saddr: 0x%08x, daddr: 0x%08x\n\n", 389 seq_printf(seq,", saddr: 0x%08x, daddr: 0x%08x\n\n",
390 discovery->data.saddr, 390 discovery->data.saddr,
391 discovery->data.daddr); 391 discovery->data.daddr);
392 392
393 seq_putc(seq, '\n'); 393 seq_putc(seq, '\n');
394 } 394 }
395 return 0; 395 return 0;
diff --git a/net/irda/ircomm/ircomm_core.c b/net/irda/ircomm/ircomm_core.c
index ad6b6af3dd97..c28ee7bce26a 100644
--- a/net/irda/ircomm/ircomm_core.c
+++ b/net/irda/ircomm/ircomm_core.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: ircomm_core.c 3 * Filename: ircomm_core.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: IrCOMM service interface 5 * Description: IrCOMM service interface
@@ -8,25 +8,25 @@
8 * Created at: Sun Jun 6 20:37:34 1999 8 * Created at: Sun Jun 6 20:37:34 1999
9 * Modified at: Tue Dec 21 13:26:41 1999 9 * Modified at: Tue Dec 21 13:26:41 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1999 Dag Brattli, All Rights Reserved. 12 * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
13 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> 13 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
14 * 14 *
15 * This program is free software; you can redistribute it and/or 15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as 16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * This program is distributed in the hope that it will be useful, 20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details. 23 * GNU General Public License for more details.
24 * 24 *
25 * You should have received a copy of the GNU General Public License 25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software 26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA 28 * MA 02111-1307 USA
29 * 29 *
30 ********************************************************************/ 30 ********************************************************************/
31 31
32#include <linux/module.h> 32#include <linux/module.h>
@@ -49,7 +49,7 @@
49#include <net/irda/ircomm_core.h> 49#include <net/irda/ircomm_core.h>
50 50
51static int __ircomm_close(struct ircomm_cb *self); 51static int __ircomm_close(struct ircomm_cb *self);
52static void ircomm_control_indication(struct ircomm_cb *self, 52static void ircomm_control_indication(struct ircomm_cb *self,
53 struct sk_buff *skb, int clen); 53 struct sk_buff *skb, int clen);
54 54
55#ifdef CONFIG_PROC_FS 55#ifdef CONFIG_PROC_FS
@@ -69,22 +69,22 @@ hashbin_t *ircomm = NULL;
69 69
70static int __init ircomm_init(void) 70static int __init ircomm_init(void)
71{ 71{
72 ircomm = hashbin_new(HB_LOCK); 72 ircomm = hashbin_new(HB_LOCK);
73 if (ircomm == NULL) { 73 if (ircomm == NULL) {
74 IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__); 74 IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__);
75 return -ENOMEM; 75 return -ENOMEM;
76 } 76 }
77 77
78#ifdef CONFIG_PROC_FS 78#ifdef CONFIG_PROC_FS
79 { struct proc_dir_entry *ent; 79 { struct proc_dir_entry *ent;
80 ent = create_proc_entry("ircomm", 0, proc_irda); 80 ent = create_proc_entry("ircomm", 0, proc_irda);
81 if (ent) 81 if (ent)
82 ent->proc_fops = &ircomm_proc_fops; 82 ent->proc_fops = &ircomm_proc_fops;
83 } 83 }
84#endif /* CONFIG_PROC_FS */ 84#endif /* CONFIG_PROC_FS */
85 85
86 IRDA_MESSAGE("IrCOMM protocol (Dag Brattli)\n"); 86 IRDA_MESSAGE("IrCOMM protocol (Dag Brattli)\n");
87 87
88 return 0; 88 return 0;
89} 89}
90 90
@@ -139,7 +139,7 @@ struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line)
139 139
140 hashbin_insert(ircomm, (irda_queue_t *) self, line, NULL); 140 hashbin_insert(ircomm, (irda_queue_t *) self, line, NULL);
141 141
142 ircomm_next_state(self, IRCOMM_IDLE); 142 ircomm_next_state(self, IRCOMM_IDLE);
143 143
144 return self; 144 return self;
145} 145}
@@ -195,8 +195,8 @@ int ircomm_close(struct ircomm_cb *self)
195 entry = hashbin_remove(ircomm, self->line, NULL); 195 entry = hashbin_remove(ircomm, self->line, NULL);
196 196
197 IRDA_ASSERT(entry == self, return -1;); 197 IRDA_ASSERT(entry == self, return -1;);
198 198
199 return __ircomm_close(self); 199 return __ircomm_close(self);
200} 200}
201 201
202EXPORT_SYMBOL(ircomm_close); 202EXPORT_SYMBOL(ircomm_close);
@@ -206,9 +206,9 @@ EXPORT_SYMBOL(ircomm_close);
206 * 206 *
207 * Impl. of this function is differ from one of the reference. This 207 * Impl. of this function is differ from one of the reference. This
208 * function does discovery as well as sending connect request 208 * function does discovery as well as sending connect request
209 * 209 *
210 */ 210 */
211int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel, 211int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel,
212 __u32 saddr, __u32 daddr, struct sk_buff *skb, 212 __u32 saddr, __u32 daddr, struct sk_buff *skb,
213 __u8 service_type) 213 __u8 service_type)
214{ 214{
@@ -243,20 +243,20 @@ void ircomm_connect_indication(struct ircomm_cb *self, struct sk_buff *skb,
243 struct ircomm_info *info) 243 struct ircomm_info *info)
244{ 244{
245 int clen = 0; 245 int clen = 0;
246 246
247 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 247 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
248 248
249 /* Check if the packet contains data on the control channel */ 249 /* Check if the packet contains data on the control channel */
250 if (skb->len > 0) 250 if (skb->len > 0)
251 clen = skb->data[0]; 251 clen = skb->data[0];
252 252
253 /* 253 /*
254 * If there are any data hiding in the control channel, we must 254 * If there are any data hiding in the control channel, we must
255 * deliver it first. The side effect is that the control channel 255 * deliver it first. The side effect is that the control channel
256 * will be removed from the skb 256 * will be removed from the skb
257 */ 257 */
258 if (self->notify.connect_indication) 258 if (self->notify.connect_indication)
259 self->notify.connect_indication(self->notify.instance, self, 259 self->notify.connect_indication(self->notify.instance, self,
260 info->qos, info->max_data_size, 260 info->qos, info->max_data_size,
261 info->max_header_size, skb); 261 info->max_header_size, skb);
262 else { 262 else {
@@ -282,7 +282,7 @@ int ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata)
282 ret = ircomm_do_event(self, IRCOMM_CONNECT_RESPONSE, userdata, NULL); 282 ret = ircomm_do_event(self, IRCOMM_CONNECT_RESPONSE, userdata, NULL);
283 283
284 return ret; 284 return ret;
285} 285}
286 286
287EXPORT_SYMBOL(ircomm_connect_response); 287EXPORT_SYMBOL(ircomm_connect_response);
288 288
@@ -299,7 +299,7 @@ void ircomm_connect_confirm(struct ircomm_cb *self, struct sk_buff *skb,
299 299
300 if (self->notify.connect_confirm ) 300 if (self->notify.connect_confirm )
301 self->notify.connect_confirm(self->notify.instance, 301 self->notify.connect_confirm(self->notify.instance,
302 self, info->qos, 302 self, info->qos,
303 info->max_data_size, 303 info->max_data_size,
304 info->max_header_size, skb); 304 info->max_header_size, skb);
305 else { 305 else {
@@ -322,7 +322,7 @@ int ircomm_data_request(struct ircomm_cb *self, struct sk_buff *skb)
322 IRDA_ASSERT(self != NULL, return -EFAULT;); 322 IRDA_ASSERT(self != NULL, return -EFAULT;);
323 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;); 323 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;);
324 IRDA_ASSERT(skb != NULL, return -EFAULT;); 324 IRDA_ASSERT(skb != NULL, return -EFAULT;);
325 325
326 ret = ircomm_do_event(self, IRCOMM_DATA_REQUEST, skb, NULL); 326 ret = ircomm_do_event(self, IRCOMM_DATA_REQUEST, skb, NULL);
327 327
328 return ret; 328 return ret;
@@ -337,7 +337,7 @@ EXPORT_SYMBOL(ircomm_data_request);
337 * 337 *
338 */ 338 */
339void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb) 339void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb)
340{ 340{
341 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 341 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
342 342
343 IRDA_ASSERT(skb->len > 0, return;); 343 IRDA_ASSERT(skb->len > 0, return;);
@@ -363,9 +363,9 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb)
363 363
364 clen = skb->data[0]; 364 clen = skb->data[0];
365 365
366 /* 366 /*
367 * If there are any data hiding in the control channel, we must 367 * If there are any data hiding in the control channel, we must
368 * deliver it first. The side effect is that the control channel 368 * deliver it first. The side effect is that the control channel
369 * will be removed from the skb 369 * will be removed from the skb
370 */ 370 */
371 if (clen > 0) 371 if (clen > 0)
@@ -375,7 +375,7 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb)
375 skb_pull(skb, clen+1); 375 skb_pull(skb, clen+1);
376 376
377 if (skb->len) 377 if (skb->len)
378 ircomm_data_indication(self, skb); 378 ircomm_data_indication(self, skb);
379 else { 379 else {
380 IRDA_DEBUG(4, "%s(), data was control info only!\n", 380 IRDA_DEBUG(4, "%s(), data was control info only!\n",
381 __FUNCTION__ ); 381 __FUNCTION__ );
@@ -391,13 +391,13 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb)
391int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb) 391int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb)
392{ 392{
393 int ret; 393 int ret;
394 394
395 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 395 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
396 396
397 IRDA_ASSERT(self != NULL, return -EFAULT;); 397 IRDA_ASSERT(self != NULL, return -EFAULT;);
398 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;); 398 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;);
399 IRDA_ASSERT(skb != NULL, return -EFAULT;); 399 IRDA_ASSERT(skb != NULL, return -EFAULT;);
400 400
401 ret = ircomm_do_event(self, IRCOMM_CONTROL_REQUEST, skb, NULL); 401 ret = ircomm_do_event(self, IRCOMM_CONTROL_REQUEST, skb, NULL);
402 402
403 return ret; 403 return ret;
@@ -411,10 +411,10 @@ EXPORT_SYMBOL(ircomm_control_request);
411 * Data has arrived on the control channel 411 * Data has arrived on the control channel
412 * 412 *
413 */ 413 */
414static void ircomm_control_indication(struct ircomm_cb *self, 414static void ircomm_control_indication(struct ircomm_cb *self,
415 struct sk_buff *skb, int clen) 415 struct sk_buff *skb, int clen)
416{ 416{
417 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 417 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
418 418
419 /* Use udata for delivering data on the control channel */ 419 /* Use udata for delivering data on the control channel */
420 if (self->notify.udata_indication) { 420 if (self->notify.udata_indication) {
@@ -427,8 +427,8 @@ static void ircomm_control_indication(struct ircomm_cb *self,
427 427
428 /* Remove data channel from control channel */ 428 /* Remove data channel from control channel */
429 skb_trim(ctrl_skb, clen+1); 429 skb_trim(ctrl_skb, clen+1);
430 430
431 self->notify.udata_indication(self->notify.instance, self, 431 self->notify.udata_indication(self->notify.instance, self,
432 ctrl_skb); 432 ctrl_skb);
433 433
434 /* Drop reference count - 434 /* Drop reference count -
@@ -455,7 +455,7 @@ int ircomm_disconnect_request(struct ircomm_cb *self, struct sk_buff *userdata)
455 IRDA_ASSERT(self != NULL, return -1;); 455 IRDA_ASSERT(self != NULL, return -1;);
456 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;); 456 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;);
457 457
458 ret = ircomm_do_event(self, IRCOMM_DISCONNECT_REQUEST, userdata, 458 ret = ircomm_do_event(self, IRCOMM_DISCONNECT_REQUEST, userdata,
459 &info); 459 &info);
460 return ret; 460 return ret;
461} 461}
@@ -472,7 +472,7 @@ void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb,
472 struct ircomm_info *info) 472 struct ircomm_info *info)
473{ 473{
474 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 474 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
475 475
476 IRDA_ASSERT(info != NULL, return;); 476 IRDA_ASSERT(info != NULL, return;);
477 477
478 if (self->notify.disconnect_indication) { 478 if (self->notify.disconnect_indication) {
@@ -486,7 +486,7 @@ void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb,
486/* 486/*
487 * Function ircomm_flow_request (self, flow) 487 * Function ircomm_flow_request (self, flow)
488 * 488 *
489 * 489 *
490 * 490 *
491 */ 491 */
492void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow) 492void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow)
@@ -517,7 +517,7 @@ static void *ircomm_seq_start(struct seq_file *seq, loff_t *pos)
517 self = (struct ircomm_cb *) hashbin_get_next(ircomm)) { 517 self = (struct ircomm_cb *) hashbin_get_next(ircomm)) {
518 if (off++ == *pos) 518 if (off++ == *pos)
519 break; 519 break;
520 520
521 } 521 }
522 return self; 522 return self;
523} 523}
@@ -535,7 +535,7 @@ static void ircomm_seq_stop(struct seq_file *seq, void *v)
535} 535}
536 536
537static int ircomm_seq_show(struct seq_file *seq, void *v) 537static int ircomm_seq_show(struct seq_file *seq, void *v)
538{ 538{
539 const struct ircomm_cb *self = v; 539 const struct ircomm_cb *self = v;
540 540
541 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EINVAL; ); 541 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EINVAL; );
@@ -548,7 +548,7 @@ static int ircomm_seq_show(struct seq_file *seq, void *v)
548 seq_printf(seq, 548 seq_printf(seq,
549 " state: %s, slsap_sel: %#02x, dlsap_sel: %#02x, mode:", 549 " state: %s, slsap_sel: %#02x, dlsap_sel: %#02x, mode:",
550 ircomm_state[ self->state], 550 ircomm_state[ self->state],
551 self->slsap_sel, self->dlsap_sel); 551 self->slsap_sel, self->dlsap_sel);
552 552
553 if(self->service_type & IRCOMM_3_WIRE_RAW) 553 if(self->service_type & IRCOMM_3_WIRE_RAW)
554 seq_printf(seq, " 3-wire-raw"); 554 seq_printf(seq, " 3-wire-raw");
diff --git a/net/irda/ircomm/ircomm_event.c b/net/irda/ircomm/ircomm_event.c
index 01f4e801a1ba..23d0468794e2 100644
--- a/net/irda/ircomm/ircomm_event.c
+++ b/net/irda/ircomm/ircomm_event.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: ircomm_event.c 3 * Filename: ircomm_event.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: IrCOMM layer state machine 5 * Description: IrCOMM layer state machine
@@ -8,24 +8,24 @@
8 * Created at: Sun Jun 6 20:33:11 1999 8 * Created at: Sun Jun 6 20:33:11 1999
9 * Modified at: Sun Dec 12 13:44:32 1999 9 * Modified at: Sun Dec 12 13:44:32 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1999 Dag Brattli, All Rights Reserved. 12 * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
13 * 13 *
14 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as 15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * This program is distributed in the hope that it will be useful, 19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details. 22 * GNU General Public License for more details.
23 * 23 *
24 * You should have received a copy of the GNU General Public License 24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software 25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * MA 02111-1307 USA 27 * MA 02111-1307 USA
28 * 28 *
29 ********************************************************************/ 29 ********************************************************************/
30 30
31#include <linux/sched.h> 31#include <linux/sched.h>
@@ -41,13 +41,13 @@
41#include <net/irda/ircomm_core.h> 41#include <net/irda/ircomm_core.h>
42#include <net/irda/ircomm_event.h> 42#include <net/irda/ircomm_event.h>
43 43
44static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, 44static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event,
45 struct sk_buff *skb, struct ircomm_info *info); 45 struct sk_buff *skb, struct ircomm_info *info);
46static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, 46static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event,
47 struct sk_buff *skb, struct ircomm_info *info); 47 struct sk_buff *skb, struct ircomm_info *info);
48static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, 48static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event,
49 struct sk_buff *skb, struct ircomm_info *info); 49 struct sk_buff *skb, struct ircomm_info *info);
50static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, 50static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event,
51 struct sk_buff *skb, struct ircomm_info *info); 51 struct sk_buff *skb, struct ircomm_info *info);
52 52
53char *ircomm_state[] = { 53char *ircomm_state[] = {
@@ -60,26 +60,26 @@ char *ircomm_state[] = {
60#ifdef CONFIG_IRDA_DEBUG 60#ifdef CONFIG_IRDA_DEBUG
61static char *ircomm_event[] = { 61static char *ircomm_event[] = {
62 "IRCOMM_CONNECT_REQUEST", 62 "IRCOMM_CONNECT_REQUEST",
63 "IRCOMM_CONNECT_RESPONSE", 63 "IRCOMM_CONNECT_RESPONSE",
64 "IRCOMM_TTP_CONNECT_INDICATION", 64 "IRCOMM_TTP_CONNECT_INDICATION",
65 "IRCOMM_LMP_CONNECT_INDICATION", 65 "IRCOMM_LMP_CONNECT_INDICATION",
66 "IRCOMM_TTP_CONNECT_CONFIRM", 66 "IRCOMM_TTP_CONNECT_CONFIRM",
67 "IRCOMM_LMP_CONNECT_CONFIRM", 67 "IRCOMM_LMP_CONNECT_CONFIRM",
68 68
69 "IRCOMM_LMP_DISCONNECT_INDICATION", 69 "IRCOMM_LMP_DISCONNECT_INDICATION",
70 "IRCOMM_TTP_DISCONNECT_INDICATION", 70 "IRCOMM_TTP_DISCONNECT_INDICATION",
71 "IRCOMM_DISCONNECT_REQUEST", 71 "IRCOMM_DISCONNECT_REQUEST",
72 72
73 "IRCOMM_TTP_DATA_INDICATION", 73 "IRCOMM_TTP_DATA_INDICATION",
74 "IRCOMM_LMP_DATA_INDICATION", 74 "IRCOMM_LMP_DATA_INDICATION",
75 "IRCOMM_DATA_REQUEST", 75 "IRCOMM_DATA_REQUEST",
76 "IRCOMM_CONTROL_REQUEST", 76 "IRCOMM_CONTROL_REQUEST",
77 "IRCOMM_CONTROL_INDICATION", 77 "IRCOMM_CONTROL_INDICATION",
78}; 78};
79#endif /* CONFIG_IRDA_DEBUG */ 79#endif /* CONFIG_IRDA_DEBUG */
80 80
81static int (*state[])(struct ircomm_cb *self, IRCOMM_EVENT event, 81static int (*state[])(struct ircomm_cb *self, IRCOMM_EVENT event,
82 struct sk_buff *skb, struct ircomm_info *info) = 82 struct sk_buff *skb, struct ircomm_info *info) =
83{ 83{
84 ircomm_state_idle, 84 ircomm_state_idle,
85 ircomm_state_waiti, 85 ircomm_state_waiti,
@@ -93,14 +93,14 @@ static int (*state[])(struct ircomm_cb *self, IRCOMM_EVENT event,
93 * IrCOMM is currently idle 93 * IrCOMM is currently idle
94 * 94 *
95 */ 95 */
96static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, 96static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event,
97 struct sk_buff *skb, struct ircomm_info *info) 97 struct sk_buff *skb, struct ircomm_info *info)
98{ 98{
99 int ret = 0; 99 int ret = 0;
100 100
101 switch (event) { 101 switch (event) {
102 case IRCOMM_CONNECT_REQUEST: 102 case IRCOMM_CONNECT_REQUEST:
103 ircomm_next_state(self, IRCOMM_WAITI); 103 ircomm_next_state(self, IRCOMM_WAITI);
104 ret = self->issue.connect_request(self, skb, info); 104 ret = self->issue.connect_request(self, skb, info);
105 break; 105 break;
106 case IRCOMM_TTP_CONNECT_INDICATION: 106 case IRCOMM_TTP_CONNECT_INDICATION:
@@ -119,10 +119,10 @@ static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event,
119/* 119/*
120 * Function ircomm_state_waiti (self, event, skb) 120 * Function ircomm_state_waiti (self, event, skb)
121 * 121 *
122 * The IrCOMM user has requested an IrCOMM connection to the remote 122 * The IrCOMM user has requested an IrCOMM connection to the remote
123 * device and is awaiting confirmation 123 * device and is awaiting confirmation
124 */ 124 */
125static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, 125static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event,
126 struct sk_buff *skb, struct ircomm_info *info) 126 struct sk_buff *skb, struct ircomm_info *info)
127{ 127{
128 int ret = 0; 128 int ret = 0;
@@ -152,8 +152,8 @@ static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event,
152 * IrCOMM has received an incoming connection request and is awaiting 152 * IrCOMM has received an incoming connection request and is awaiting
153 * response from the user 153 * response from the user
154 */ 154 */
155static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, 155static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event,
156 struct sk_buff *skb, struct ircomm_info *info) 156 struct sk_buff *skb, struct ircomm_info *info)
157{ 157{
158 int ret = 0; 158 int ret = 0;
159 159
@@ -185,7 +185,7 @@ static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event,
185 * IrCOMM is connected to the peer IrCOMM device 185 * IrCOMM is connected to the peer IrCOMM device
186 * 186 *
187 */ 187 */
188static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, 188static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event,
189 struct sk_buff *skb, struct ircomm_info *info) 189 struct sk_buff *skb, struct ircomm_info *info)
190{ 190{
191 int ret = 0; 191 int ret = 0;
@@ -228,7 +228,7 @@ static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event,
228 * 228 *
229 */ 229 */
230int ircomm_do_event(struct ircomm_cb *self, IRCOMM_EVENT event, 230int ircomm_do_event(struct ircomm_cb *self, IRCOMM_EVENT event,
231 struct sk_buff *skb, struct ircomm_info *info) 231 struct sk_buff *skb, struct ircomm_info *info)
232{ 232{
233 IRDA_DEBUG(4, "%s: state=%s, event=%s\n", __FUNCTION__ , 233 IRDA_DEBUG(4, "%s: state=%s, event=%s\n", __FUNCTION__ ,
234 ircomm_state[self->state], ircomm_event[event]); 234 ircomm_state[self->state], ircomm_event[event]);
@@ -245,7 +245,7 @@ int ircomm_do_event(struct ircomm_cb *self, IRCOMM_EVENT event,
245void ircomm_next_state(struct ircomm_cb *self, IRCOMM_STATE state) 245void ircomm_next_state(struct ircomm_cb *self, IRCOMM_STATE state)
246{ 246{
247 self->state = state; 247 self->state = state;
248 248
249 IRDA_DEBUG(4, "%s: next state=%s, service type=%d\n", __FUNCTION__ , 249 IRDA_DEBUG(4, "%s: next state=%s, service type=%d\n", __FUNCTION__ ,
250 ircomm_state[self->state], self->service_type); 250 ircomm_state[self->state], self->service_type);
251} 251}
diff --git a/net/irda/ircomm/ircomm_lmp.c b/net/irda/ircomm/ircomm_lmp.c
index c8e0d89ee11f..22bd75299104 100644
--- a/net/irda/ircomm/ircomm_lmp.c
+++ b/net/irda/ircomm/ircomm_lmp.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: ircomm_lmp.c 3 * Filename: ircomm_lmp.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: Interface between IrCOMM and IrLMP 5 * Description: Interface between IrCOMM and IrLMP
@@ -9,25 +9,25 @@
9 * Modified at: Sun Dec 12 13:44:17 1999 9 * Modified at: Sun Dec 12 13:44:17 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * Sources: Previous IrLPT work by Thomas Davis 11 * Sources: Previous IrLPT work by Thomas Davis
12 * 12 *
13 * Copyright (c) 1999 Dag Brattli, All Rights Reserved. 13 * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> 14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as 17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * This program is distributed in the hope that it will be useful, 21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details. 24 * GNU General Public License for more details.
25 * 25 *
26 * You should have received a copy of the GNU General Public License 26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software 27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA 29 * MA 02111-1307 USA
30 * 30 *
31 ********************************************************************/ 31 ********************************************************************/
32 32
33#include <linux/sched.h> 33#include <linux/sched.h>
@@ -45,11 +45,11 @@
45/* 45/*
46 * Function ircomm_lmp_connect_request (self, userdata) 46 * Function ircomm_lmp_connect_request (self, userdata)
47 * 47 *
48 * 48 *
49 * 49 *
50 */ 50 */
51static int ircomm_lmp_connect_request(struct ircomm_cb *self, 51static int ircomm_lmp_connect_request(struct ircomm_cb *self,
52 struct sk_buff *userdata, 52 struct sk_buff *userdata,
53 struct ircomm_info *info) 53 struct ircomm_info *info)
54{ 54{
55 int ret = 0; 55 int ret = 0;
@@ -61,14 +61,14 @@ static int ircomm_lmp_connect_request(struct ircomm_cb *self,
61 skb_get(userdata); 61 skb_get(userdata);
62 62
63 ret = irlmp_connect_request(self->lsap, info->dlsap_sel, 63 ret = irlmp_connect_request(self->lsap, info->dlsap_sel,
64 info->saddr, info->daddr, NULL, userdata); 64 info->saddr, info->daddr, NULL, userdata);
65 return ret; 65 return ret;
66} 66}
67 67
68/* 68/*
69 * Function ircomm_lmp_connect_response (self, skb) 69 * Function ircomm_lmp_connect_response (self, skb)
70 * 70 *
71 * 71 *
72 * 72 *
73 */ 73 */
74static int ircomm_lmp_connect_response(struct ircomm_cb *self, 74static int ircomm_lmp_connect_response(struct ircomm_cb *self,
@@ -78,7 +78,7 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self,
78 int ret; 78 int ret;
79 79
80 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); 80 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
81 81
82 /* Any userdata supplied? */ 82 /* Any userdata supplied? */
83 if (userdata == NULL) { 83 if (userdata == NULL) {
84 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); 84 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
@@ -88,8 +88,8 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self,
88 /* Reserve space for MUX and LAP header */ 88 /* Reserve space for MUX and LAP header */
89 skb_reserve(tx_skb, LMP_MAX_HEADER); 89 skb_reserve(tx_skb, LMP_MAX_HEADER);
90 } else { 90 } else {
91 /* 91 /*
92 * Check that the client has reserved enough space for 92 * Check that the client has reserved enough space for
93 * headers 93 * headers
94 */ 94 */
95 IRDA_ASSERT(skb_headroom(userdata) >= LMP_MAX_HEADER, 95 IRDA_ASSERT(skb_headroom(userdata) >= LMP_MAX_HEADER,
@@ -105,22 +105,22 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self,
105 return 0; 105 return 0;
106} 106}
107 107
108static int ircomm_lmp_disconnect_request(struct ircomm_cb *self, 108static int ircomm_lmp_disconnect_request(struct ircomm_cb *self,
109 struct sk_buff *userdata, 109 struct sk_buff *userdata,
110 struct ircomm_info *info) 110 struct ircomm_info *info)
111{ 111{
112 struct sk_buff *tx_skb; 112 struct sk_buff *tx_skb;
113 int ret; 113 int ret;
114 114
115 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); 115 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
116 116
117 if (!userdata) { 117 if (!userdata) {
118 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); 118 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
119 if (!tx_skb) 119 if (!tx_skb)
120 return -ENOMEM; 120 return -ENOMEM;
121 121
122 /* Reserve space for MUX and LAP header */ 122 /* Reserve space for MUX and LAP header */
123 skb_reserve(tx_skb, LMP_MAX_HEADER); 123 skb_reserve(tx_skb, LMP_MAX_HEADER);
124 userdata = tx_skb; 124 userdata = tx_skb;
125 } else { 125 } else {
126 /* Don't forget to refcount it - should be NULL anyway */ 126 /* Don't forget to refcount it - should be NULL anyway */
@@ -136,7 +136,7 @@ static int ircomm_lmp_disconnect_request(struct ircomm_cb *self,
136 * Function ircomm_lmp_flow_control (skb) 136 * Function ircomm_lmp_flow_control (skb)
137 * 137 *
138 * This function is called when a data frame we have sent to IrLAP has 138 * This function is called when a data frame we have sent to IrLAP has
139 * been deallocated. We do this to make sure we don't flood IrLAP with 139 * been deallocated. We do this to make sure we don't flood IrLAP with
140 * frames, since we are not using the IrTTP flow control mechanism 140 * frames, since we are not using the IrTTP flow control mechanism
141 */ 141 */
142static void ircomm_lmp_flow_control(struct sk_buff *skb) 142static void ircomm_lmp_flow_control(struct sk_buff *skb)
@@ -150,29 +150,29 @@ static void ircomm_lmp_flow_control(struct sk_buff *skb)
150 cb = (struct irda_skb_cb *) skb->cb; 150 cb = (struct irda_skb_cb *) skb->cb;
151 151
152 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 152 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
153 153
154 line = cb->line; 154 line = cb->line;
155 155
156 self = (struct ircomm_cb *) hashbin_lock_find(ircomm, line, NULL); 156 self = (struct ircomm_cb *) hashbin_lock_find(ircomm, line, NULL);
157 if (!self) { 157 if (!self) {
158 IRDA_DEBUG(2, "%s(), didn't find myself\n", __FUNCTION__ ); 158 IRDA_DEBUG(2, "%s(), didn't find myself\n", __FUNCTION__ );
159 return; 159 return;
160 } 160 }
161 161
162 IRDA_ASSERT(self != NULL, return;); 162 IRDA_ASSERT(self != NULL, return;);
163 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;); 163 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;);
164 164
165 self->pkt_count--; 165 self->pkt_count--;
166 166
167 if ((self->pkt_count < 2) && (self->flow_status == FLOW_STOP)) { 167 if ((self->pkt_count < 2) && (self->flow_status == FLOW_STOP)) {
168 IRDA_DEBUG(2, "%s(), asking TTY to start again!\n", __FUNCTION__ ); 168 IRDA_DEBUG(2, "%s(), asking TTY to start again!\n", __FUNCTION__ );
169 self->flow_status = FLOW_START; 169 self->flow_status = FLOW_START;
170 if (self->notify.flow_indication) 170 if (self->notify.flow_indication)
171 self->notify.flow_indication(self->notify.instance, 171 self->notify.flow_indication(self->notify.instance,
172 self, FLOW_START); 172 self, FLOW_START);
173 } 173 }
174} 174}
175 175
176/* 176/*
177 * Function ircomm_lmp_data_request (self, userdata) 177 * Function ircomm_lmp_data_request (self, userdata)
178 * 178 *
@@ -180,7 +180,7 @@ static void ircomm_lmp_flow_control(struct sk_buff *skb)
180 * 180 *
181 */ 181 */
182static int ircomm_lmp_data_request(struct ircomm_cb *self, 182static int ircomm_lmp_data_request(struct ircomm_cb *self,
183 struct sk_buff *skb, 183 struct sk_buff *skb,
184 int not_used) 184 int not_used)
185{ 185{
186 struct irda_skb_cb *cb; 186 struct irda_skb_cb *cb;
@@ -189,8 +189,8 @@ static int ircomm_lmp_data_request(struct ircomm_cb *self,
189 IRDA_ASSERT(skb != NULL, return -1;); 189 IRDA_ASSERT(skb != NULL, return -1;);
190 190
191 cb = (struct irda_skb_cb *) skb->cb; 191 cb = (struct irda_skb_cb *) skb->cb;
192 192
193 cb->line = self->line; 193 cb->line = self->line;
194 194
195 IRDA_DEBUG(4, "%s(), sending frame\n", __FUNCTION__ ); 195 IRDA_DEBUG(4, "%s(), sending frame\n", __FUNCTION__ );
196 196
@@ -199,13 +199,13 @@ static int ircomm_lmp_data_request(struct ircomm_cb *self,
199 199
200 skb->destructor = ircomm_lmp_flow_control; 200 skb->destructor = ircomm_lmp_flow_control;
201 201
202 if ((self->pkt_count++ > 7) && (self->flow_status == FLOW_START)) { 202 if ((self->pkt_count++ > 7) && (self->flow_status == FLOW_START)) {
203 IRDA_DEBUG(2, "%s(), asking TTY to slow down!\n", __FUNCTION__ ); 203 IRDA_DEBUG(2, "%s(), asking TTY to slow down!\n", __FUNCTION__ );
204 self->flow_status = FLOW_STOP; 204 self->flow_status = FLOW_STOP;
205 if (self->notify.flow_indication) 205 if (self->notify.flow_indication)
206 self->notify.flow_indication(self->notify.instance, 206 self->notify.flow_indication(self->notify.instance,
207 self, FLOW_STOP); 207 self, FLOW_STOP);
208 } 208 }
209 ret = irlmp_data_request(self->lsap, skb); 209 ret = irlmp_data_request(self->lsap, skb);
210 if (ret) { 210 if (ret) {
211 IRDA_ERROR("%s(), failed\n", __FUNCTION__); 211 IRDA_ERROR("%s(), failed\n", __FUNCTION__);
@@ -227,11 +227,11 @@ static int ircomm_lmp_data_indication(void *instance, void *sap,
227 struct ircomm_cb *self = (struct ircomm_cb *) instance; 227 struct ircomm_cb *self = (struct ircomm_cb *) instance;
228 228
229 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 229 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
230 230
231 IRDA_ASSERT(self != NULL, return -1;); 231 IRDA_ASSERT(self != NULL, return -1;);
232 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;); 232 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;);
233 IRDA_ASSERT(skb != NULL, return -1;); 233 IRDA_ASSERT(skb != NULL, return -1;);
234 234
235 ircomm_do_event(self, IRCOMM_LMP_DATA_INDICATION, skb, NULL); 235 ircomm_do_event(self, IRCOMM_LMP_DATA_INDICATION, skb, NULL);
236 236
237 /* Drop reference count - see ircomm_tty_data_indication(). */ 237 /* Drop reference count - see ircomm_tty_data_indication(). */
@@ -241,15 +241,15 @@ static int ircomm_lmp_data_indication(void *instance, void *sap,
241} 241}
242 242
243/* 243/*
244 * Function ircomm_lmp_connect_confirm (instance, sap, qos, max_sdu_size, 244 * Function ircomm_lmp_connect_confirm (instance, sap, qos, max_sdu_size,
245 * max_header_size, skb) 245 * max_header_size, skb)
246 * 246 *
247 * Connection has been confirmed by peer device 247 * Connection has been confirmed by peer device
248 * 248 *
249 */ 249 */
250static void ircomm_lmp_connect_confirm(void *instance, void *sap, 250static void ircomm_lmp_connect_confirm(void *instance, void *sap,
251 struct qos_info *qos, 251 struct qos_info *qos,
252 __u32 max_seg_size, 252 __u32 max_seg_size,
253 __u8 max_header_size, 253 __u8 max_header_size,
254 struct sk_buff *skb) 254 struct sk_buff *skb)
255{ 255{
@@ -312,7 +312,7 @@ static void ircomm_lmp_connect_indication(void *instance, void *sap,
312 * Peer device has closed the connection, or the link went down for some 312 * Peer device has closed the connection, or the link went down for some
313 * other reason 313 * other reason
314 */ 314 */
315static void ircomm_lmp_disconnect_indication(void *instance, void *sap, 315static void ircomm_lmp_disconnect_indication(void *instance, void *sap,
316 LM_REASON reason, 316 LM_REASON reason,
317 struct sk_buff *skb) 317 struct sk_buff *skb)
318{ 318{
diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c
index a39f5735a90b..fbac13e95b28 100644
--- a/net/irda/ircomm/ircomm_param.c
+++ b/net/irda/ircomm/ircomm_param.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: ircomm_param.c 3 * Filename: ircomm_param.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: Parameter handling for the IrCOMM protocol 5 * Description: Parameter handling for the IrCOMM protocol
@@ -8,24 +8,24 @@
8 * Created at: Mon Jun 7 10:25:11 1999 8 * Created at: Mon Jun 7 10:25:11 1999
9 * Modified at: Sun Jan 30 14:32:03 2000 9 * Modified at: Sun Jan 30 14:32:03 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. 12 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
13 * 13 *
14 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as 15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * This program is distributed in the hope that it will be useful, 19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details. 22 * GNU General Public License for more details.
23 * 23 *
24 * You should have received a copy of the GNU General Public License 24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software 25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * MA 02111-1307 USA 27 * MA 02111-1307 USA
28 * 28 *
29 ********************************************************************/ 29 ********************************************************************/
30 30
31#include <linux/sched.h> 31#include <linux/sched.h>
@@ -41,23 +41,23 @@
41 41
42#include <net/irda/ircomm_param.h> 42#include <net/irda/ircomm_param.h>
43 43
44static int ircomm_param_service_type(void *instance, irda_param_t *param, 44static int ircomm_param_service_type(void *instance, irda_param_t *param,
45 int get); 45 int get);
46static int ircomm_param_port_type(void *instance, irda_param_t *param, 46static int ircomm_param_port_type(void *instance, irda_param_t *param,
47 int get); 47 int get);
48static int ircomm_param_port_name(void *instance, irda_param_t *param, 48static int ircomm_param_port_name(void *instance, irda_param_t *param,
49 int get); 49 int get);
50static int ircomm_param_service_type(void *instance, irda_param_t *param, 50static int ircomm_param_service_type(void *instance, irda_param_t *param,
51 int get); 51 int get);
52static int ircomm_param_data_rate(void *instance, irda_param_t *param, 52static int ircomm_param_data_rate(void *instance, irda_param_t *param,
53 int get); 53 int get);
54static int ircomm_param_data_format(void *instance, irda_param_t *param, 54static int ircomm_param_data_format(void *instance, irda_param_t *param,
55 int get); 55 int get);
56static int ircomm_param_flow_control(void *instance, irda_param_t *param, 56static int ircomm_param_flow_control(void *instance, irda_param_t *param,
57 int get); 57 int get);
58static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get); 58static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get);
59static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get); 59static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get);
60static int ircomm_param_line_status(void *instance, irda_param_t *param, 60static int ircomm_param_line_status(void *instance, irda_param_t *param,
61 int get); 61 int get);
62static int ircomm_param_dte(void *instance, irda_param_t *param, int get); 62static int ircomm_param_dte(void *instance, irda_param_t *param, int get);
63static int ircomm_param_dce(void *instance, irda_param_t *param, int get); 63static int ircomm_param_dce(void *instance, irda_param_t *param, int get);
@@ -85,7 +85,7 @@ static pi_minor_info_t pi_minor_call_table_9_wire[] = {
85static pi_major_info_t pi_major_call_table[] = { 85static pi_major_info_t pi_major_call_table[] = {
86 { pi_minor_call_table_common, 3 }, 86 { pi_minor_call_table_common, 3 },
87 { pi_minor_call_table_non_raw, 6 }, 87 { pi_minor_call_table_non_raw, 6 },
88 { pi_minor_call_table_9_wire, 3 } 88 { pi_minor_call_table_9_wire, 3 }
89/* { pi_minor_call_table_centronics } */ 89/* { pi_minor_call_table_centronics } */
90}; 90};
91 91
@@ -119,20 +119,20 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush)
119 119
120 spin_lock_irqsave(&self->spinlock, flags); 120 spin_lock_irqsave(&self->spinlock, flags);
121 121
122 skb = self->ctrl_skb; 122 skb = self->ctrl_skb;
123 if (!skb) { 123 if (!skb) {
124 skb = alloc_skb(256, GFP_ATOMIC); 124 skb = alloc_skb(256, GFP_ATOMIC);
125 if (!skb) { 125 if (!skb) {
126 spin_unlock_irqrestore(&self->spinlock, flags); 126 spin_unlock_irqrestore(&self->spinlock, flags);
127 return -ENOMEM; 127 return -ENOMEM;
128 } 128 }
129 129
130 skb_reserve(skb, self->max_header_size); 130 skb_reserve(skb, self->max_header_size);
131 self->ctrl_skb = skb; 131 self->ctrl_skb = skb;
132 } 132 }
133 /* 133 /*
134 * Inserting is a little bit tricky since we don't know how much 134 * Inserting is a little bit tricky since we don't know how much
135 * room we will need. But this should hopefully work OK 135 * room we will need. But this should hopefully work OK
136 */ 136 */
137 count = irda_param_insert(self, pi, skb->tail, skb_tailroom(skb), 137 count = irda_param_insert(self, pi, skb->tail, skb_tailroom(skb),
138 &ircomm_param_info); 138 &ircomm_param_info);
@@ -162,7 +162,7 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush)
162 * query and then the remote device sends its initial parameters 162 * query and then the remote device sends its initial parameters
163 * 163 *
164 */ 164 */
165static int ircomm_param_service_type(void *instance, irda_param_t *param, 165static int ircomm_param_service_type(void *instance, irda_param_t *param,
166 int get) 166 int get)
167{ 167{
168 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 168 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
@@ -179,7 +179,7 @@ static int ircomm_param_service_type(void *instance, irda_param_t *param,
179 /* Find all common service types */ 179 /* Find all common service types */
180 service_type &= self->service_type; 180 service_type &= self->service_type;
181 if (!service_type) { 181 if (!service_type) {
182 IRDA_DEBUG(2, 182 IRDA_DEBUG(2,
183 "%s(), No common service type to use!\n", __FUNCTION__ ); 183 "%s(), No common service type to use!\n", __FUNCTION__ );
184 return -1; 184 return -1;
185 } 185 }
@@ -198,12 +198,12 @@ static int ircomm_param_service_type(void *instance, irda_param_t *param,
198 else if (service_type & IRCOMM_3_WIRE_RAW) 198 else if (service_type & IRCOMM_3_WIRE_RAW)
199 self->settings.service_type = IRCOMM_3_WIRE_RAW; 199 self->settings.service_type = IRCOMM_3_WIRE_RAW;
200 200
201 IRDA_DEBUG(0, "%s(), resulting service type=0x%02x\n", __FUNCTION__ , 201 IRDA_DEBUG(0, "%s(), resulting service type=0x%02x\n", __FUNCTION__ ,
202 self->settings.service_type); 202 self->settings.service_type);
203 203
204 /* 204 /*
205 * Now the line is ready for some communication. Check if we are a 205 * Now the line is ready for some communication. Check if we are a
206 * server, and send over some initial parameters. 206 * server, and send over some initial parameters.
207 * Client do it in ircomm_tty_state_setup(). 207 * Client do it in ircomm_tty_state_setup().
208 * Note : we may get called from ircomm_tty_getvalue_confirm(), 208 * Note : we may get called from ircomm_tty_getvalue_confirm(),
209 * therefore before we even have open any socket. And self->client 209 * therefore before we even have open any socket. And self->client
@@ -235,13 +235,13 @@ static int ircomm_param_port_type(void *instance, irda_param_t *param, int get)
235 235
236 IRDA_ASSERT(self != NULL, return -1;); 236 IRDA_ASSERT(self != NULL, return -1;);
237 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 237 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
238 238
239 if (get) 239 if (get)
240 param->pv.i = IRCOMM_SERIAL; 240 param->pv.i = IRCOMM_SERIAL;
241 else { 241 else {
242 self->settings.port_type = (__u8) param->pv.i; 242 self->settings.port_type = (__u8) param->pv.i;
243 243
244 IRDA_DEBUG(0, "%s(), port type=%d\n", __FUNCTION__ , 244 IRDA_DEBUG(0, "%s(), port type=%d\n", __FUNCTION__ ,
245 self->settings.port_type); 245 self->settings.port_type);
246 } 246 }
247 return 0; 247 return 0;
@@ -256,7 +256,7 @@ static int ircomm_param_port_type(void *instance, irda_param_t *param, int get)
256static int ircomm_param_port_name(void *instance, irda_param_t *param, int get) 256static int ircomm_param_port_name(void *instance, irda_param_t *param, int get)
257{ 257{
258 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 258 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
259 259
260 IRDA_ASSERT(self != NULL, return -1;); 260 IRDA_ASSERT(self != NULL, return -1;);
261 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 261 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
262 262
@@ -279,7 +279,7 @@ static int ircomm_param_port_name(void *instance, irda_param_t *param, int get)
279static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get) 279static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get)
280{ 280{
281 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 281 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
282 282
283 IRDA_ASSERT(self != NULL, return -1;); 283 IRDA_ASSERT(self != NULL, return -1;);
284 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 284 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
285 285
@@ -287,7 +287,7 @@ static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get)
287 param->pv.i = self->settings.data_rate; 287 param->pv.i = self->settings.data_rate;
288 else 288 else
289 self->settings.data_rate = param->pv.i; 289 self->settings.data_rate = param->pv.i;
290 290
291 IRDA_DEBUG(2, "%s(), data rate = %d\n", __FUNCTION__ , param->pv.i); 291 IRDA_DEBUG(2, "%s(), data rate = %d\n", __FUNCTION__ , param->pv.i);
292 292
293 return 0; 293 return 0;
@@ -299,7 +299,7 @@ static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get)
299 * Exchange data format to be used in this settings 299 * Exchange data format to be used in this settings
300 * 300 *
301 */ 301 */
302static int ircomm_param_data_format(void *instance, irda_param_t *param, 302static int ircomm_param_data_format(void *instance, irda_param_t *param,
303 int get) 303 int get)
304{ 304{
305 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 305 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
@@ -311,7 +311,7 @@ static int ircomm_param_data_format(void *instance, irda_param_t *param,
311 param->pv.i = self->settings.data_format; 311 param->pv.i = self->settings.data_format;
312 else 312 else
313 self->settings.data_format = (__u8) param->pv.i; 313 self->settings.data_format = (__u8) param->pv.i;
314 314
315 return 0; 315 return 0;
316} 316}
317 317
@@ -321,14 +321,14 @@ static int ircomm_param_data_format(void *instance, irda_param_t *param,
321 * Exchange flow control settings to be used in this settings 321 * Exchange flow control settings to be used in this settings
322 * 322 *
323 */ 323 */
324static int ircomm_param_flow_control(void *instance, irda_param_t *param, 324static int ircomm_param_flow_control(void *instance, irda_param_t *param,
325 int get) 325 int get)
326{ 326{
327 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 327 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
328 328
329 IRDA_ASSERT(self != NULL, return -1;); 329 IRDA_ASSERT(self != NULL, return -1;);
330 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 330 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
331 331
332 if (get) 332 if (get)
333 param->pv.i = self->settings.flow_control; 333 param->pv.i = self->settings.flow_control;
334 else 334 else
@@ -351,7 +351,7 @@ static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get)
351 351
352 IRDA_ASSERT(self != NULL, return -1;); 352 IRDA_ASSERT(self != NULL, return -1;);
353 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 353 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
354 354
355 if (get) { 355 if (get) {
356 param->pv.i = self->settings.xonxoff[0]; 356 param->pv.i = self->settings.xonxoff[0];
357 param->pv.i |= self->settings.xonxoff[1] << 8; 357 param->pv.i |= self->settings.xonxoff[1] << 8;
@@ -360,7 +360,7 @@ static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get)
360 self->settings.xonxoff[1] = (__u16) param->pv.i >> 8; 360 self->settings.xonxoff[1] = (__u16) param->pv.i >> 8;
361 } 361 }
362 362
363 IRDA_DEBUG(0, "%s(), XON/XOFF = 0x%02x,0x%02x\n", __FUNCTION__ , 363 IRDA_DEBUG(0, "%s(), XON/XOFF = 0x%02x,0x%02x\n", __FUNCTION__ ,
364 param->pv.i & 0xff, param->pv.i >> 8); 364 param->pv.i & 0xff, param->pv.i >> 8);
365 365
366 return 0; 366 return 0;
@@ -378,7 +378,7 @@ static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get)
378 378
379 IRDA_ASSERT(self != NULL, return -1;); 379 IRDA_ASSERT(self != NULL, return -1;);
380 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 380 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
381 381
382 if (get) { 382 if (get) {
383 param->pv.i = self->settings.enqack[0]; 383 param->pv.i = self->settings.enqack[0];
384 param->pv.i |= self->settings.enqack[1] << 8; 384 param->pv.i |= self->settings.enqack[1] << 8;
@@ -396,10 +396,10 @@ static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get)
396/* 396/*
397 * Function ircomm_param_line_status (self, param) 397 * Function ircomm_param_line_status (self, param)
398 * 398 *
399 * 399 *
400 * 400 *
401 */ 401 */
402static int ircomm_param_line_status(void *instance, irda_param_t *param, 402static int ircomm_param_line_status(void *instance, irda_param_t *param,
403 int get) 403 int get)
404{ 404{
405 IRDA_DEBUG(2, "%s(), not impl.\n", __FUNCTION__ ); 405 IRDA_DEBUG(2, "%s(), not impl.\n", __FUNCTION__ );
@@ -427,7 +427,7 @@ static int ircomm_param_dte(void *instance, irda_param_t *param, int get)
427 dte = (__u8) param->pv.i; 427 dte = (__u8) param->pv.i;
428 428
429 self->settings.dce = 0; 429 self->settings.dce = 0;
430 430
431 if (dte & IRCOMM_DELTA_DTR) 431 if (dte & IRCOMM_DELTA_DTR)
432 self->settings.dce |= (IRCOMM_DELTA_DSR| 432 self->settings.dce |= (IRCOMM_DELTA_DSR|
433 IRCOMM_DELTA_RI | 433 IRCOMM_DELTA_RI |
@@ -436,7 +436,7 @@ static int ircomm_param_dte(void *instance, irda_param_t *param, int get)
436 self->settings.dce |= (IRCOMM_DSR| 436 self->settings.dce |= (IRCOMM_DSR|
437 IRCOMM_RI | 437 IRCOMM_RI |
438 IRCOMM_CD); 438 IRCOMM_CD);
439 439
440 if (dte & IRCOMM_DELTA_RTS) 440 if (dte & IRCOMM_DELTA_RTS)
441 self->settings.dce |= IRCOMM_DELTA_CTS; 441 self->settings.dce |= IRCOMM_DELTA_CTS;
442 if (dte & IRCOMM_RTS) 442 if (dte & IRCOMM_RTS)
@@ -455,7 +455,7 @@ static int ircomm_param_dte(void *instance, irda_param_t *param, int get)
455/* 455/*
456 * Function ircomm_param_dce (instance, param) 456 * Function ircomm_param_dce (instance, param)
457 * 457 *
458 * 458 *
459 * 459 *
460 */ 460 */
461static int ircomm_param_dce(void *instance, irda_param_t *param, int get) 461static int ircomm_param_dce(void *instance, irda_param_t *param, int get)
diff --git a/net/irda/ircomm/ircomm_ttp.c b/net/irda/ircomm/ircomm_ttp.c
index d98bf3570d29..bb06ebaadd16 100644
--- a/net/irda/ircomm/ircomm_ttp.c
+++ b/net/irda/ircomm/ircomm_ttp.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: ircomm_ttp.c 3 * Filename: ircomm_ttp.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: Interface between IrCOMM and IrTTP 5 * Description: Interface between IrCOMM and IrTTP
@@ -8,25 +8,25 @@
8 * Created at: Sun Jun 6 20:48:27 1999 8 * Created at: Sun Jun 6 20:48:27 1999
9 * Modified at: Mon Dec 13 11:35:13 1999 9 * Modified at: Mon Dec 13 11:35:13 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1999 Dag Brattli, All Rights Reserved. 12 * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
13 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> 13 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
14 * 14 *
15 * This program is free software; you can redistribute it and/or 15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as 16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * This program is distributed in the hope that it will be useful, 20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details. 23 * GNU General Public License for more details.
24 * 24 *
25 * You should have received a copy of the GNU General Public License 25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software 26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA 28 * MA 02111-1307 USA
29 * 29 *
30 ********************************************************************/ 30 ********************************************************************/
31 31
32#include <linux/sched.h> 32#include <linux/sched.h>
@@ -43,8 +43,8 @@
43static int ircomm_ttp_data_indication(void *instance, void *sap, 43static int ircomm_ttp_data_indication(void *instance, void *sap,
44 struct sk_buff *skb); 44 struct sk_buff *skb);
45static void ircomm_ttp_connect_confirm(void *instance, void *sap, 45static void ircomm_ttp_connect_confirm(void *instance, void *sap,
46 struct qos_info *qos, 46 struct qos_info *qos,
47 __u32 max_sdu_size, 47 __u32 max_sdu_size,
48 __u8 max_header_size, 48 __u8 max_header_size,
49 struct sk_buff *skb); 49 struct sk_buff *skb);
50static void ircomm_ttp_connect_indication(void *instance, void *sap, 50static void ircomm_ttp_connect_indication(void *instance, void *sap,
@@ -54,25 +54,25 @@ static void ircomm_ttp_connect_indication(void *instance, void *sap,
54 struct sk_buff *skb); 54 struct sk_buff *skb);
55static void ircomm_ttp_flow_indication(void *instance, void *sap, 55static void ircomm_ttp_flow_indication(void *instance, void *sap,
56 LOCAL_FLOW cmd); 56 LOCAL_FLOW cmd);
57static void ircomm_ttp_disconnect_indication(void *instance, void *sap, 57static void ircomm_ttp_disconnect_indication(void *instance, void *sap,
58 LM_REASON reason, 58 LM_REASON reason,
59 struct sk_buff *skb); 59 struct sk_buff *skb);
60static int ircomm_ttp_data_request(struct ircomm_cb *self, 60static int ircomm_ttp_data_request(struct ircomm_cb *self,
61 struct sk_buff *skb, 61 struct sk_buff *skb,
62 int clen); 62 int clen);
63static int ircomm_ttp_connect_request(struct ircomm_cb *self, 63static int ircomm_ttp_connect_request(struct ircomm_cb *self,
64 struct sk_buff *userdata, 64 struct sk_buff *userdata,
65 struct ircomm_info *info); 65 struct ircomm_info *info);
66static int ircomm_ttp_connect_response(struct ircomm_cb *self, 66static int ircomm_ttp_connect_response(struct ircomm_cb *self,
67 struct sk_buff *userdata); 67 struct sk_buff *userdata);
68static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, 68static int ircomm_ttp_disconnect_request(struct ircomm_cb *self,
69 struct sk_buff *userdata, 69 struct sk_buff *userdata,
70 struct ircomm_info *info); 70 struct ircomm_info *info);
71 71
72/* 72/*
73 * Function ircomm_open_tsap (self) 73 * Function ircomm_open_tsap (self)
74 * 74 *
75 * 75 *
76 * 76 *
77 */ 77 */
78int ircomm_open_tsap(struct ircomm_cb *self) 78int ircomm_open_tsap(struct ircomm_cb *self)
@@ -113,11 +113,11 @@ int ircomm_open_tsap(struct ircomm_cb *self)
113/* 113/*
114 * Function ircomm_ttp_connect_request (self, userdata) 114 * Function ircomm_ttp_connect_request (self, userdata)
115 * 115 *
116 * 116 *
117 * 117 *
118 */ 118 */
119static int ircomm_ttp_connect_request(struct ircomm_cb *self, 119static int ircomm_ttp_connect_request(struct ircomm_cb *self,
120 struct sk_buff *userdata, 120 struct sk_buff *userdata,
121 struct ircomm_info *info) 121 struct ircomm_info *info)
122{ 122{
123 int ret = 0; 123 int ret = 0;
@@ -129,16 +129,16 @@ static int ircomm_ttp_connect_request(struct ircomm_cb *self,
129 skb_get(userdata); 129 skb_get(userdata);
130 130
131 ret = irttp_connect_request(self->tsap, info->dlsap_sel, 131 ret = irttp_connect_request(self->tsap, info->dlsap_sel,
132 info->saddr, info->daddr, NULL, 132 info->saddr, info->daddr, NULL,
133 TTP_SAR_DISABLE, userdata); 133 TTP_SAR_DISABLE, userdata);
134 134
135 return ret; 135 return ret;
136} 136}
137 137
138/* 138/*
139 * Function ircomm_ttp_connect_response (self, skb) 139 * Function ircomm_ttp_connect_response (self, skb)
140 * 140 *
141 * 141 *
142 * 142 *
143 */ 143 */
144static int ircomm_ttp_connect_response(struct ircomm_cb *self, 144static int ircomm_ttp_connect_response(struct ircomm_cb *self,
@@ -147,7 +147,7 @@ static int ircomm_ttp_connect_response(struct ircomm_cb *self,
147 int ret; 147 int ret;
148 148
149 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 149 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
150 150
151 /* Don't forget to refcount it - should be NULL anyway */ 151 /* Don't forget to refcount it - should be NULL anyway */
152 if(userdata) 152 if(userdata)
153 skb_get(userdata); 153 skb_get(userdata);
@@ -160,14 +160,14 @@ static int ircomm_ttp_connect_response(struct ircomm_cb *self,
160/* 160/*
161 * Function ircomm_ttp_data_request (self, userdata) 161 * Function ircomm_ttp_data_request (self, userdata)
162 * 162 *
163 * Send IrCOMM data to IrTTP layer. Currently we do not try to combine 163 * Send IrCOMM data to IrTTP layer. Currently we do not try to combine
164 * control data with pure data, so they will be sent as separate frames. 164 * control data with pure data, so they will be sent as separate frames.
165 * Should not be a big problem though, since control frames are rare. But 165 * Should not be a big problem though, since control frames are rare. But
166 * some of them are sent after connection establishment, so this can 166 * some of them are sent after connection establishment, so this can
167 * increase the latency a bit. 167 * increase the latency a bit.
168 */ 168 */
169static int ircomm_ttp_data_request(struct ircomm_cb *self, 169static int ircomm_ttp_data_request(struct ircomm_cb *self,
170 struct sk_buff *skb, 170 struct sk_buff *skb,
171 int clen) 171 int clen)
172{ 172{
173 int ret; 173 int ret;
@@ -176,7 +176,7 @@ static int ircomm_ttp_data_request(struct ircomm_cb *self,
176 176
177 IRDA_DEBUG(2, "%s(), clen=%d\n", __FUNCTION__ , clen); 177 IRDA_DEBUG(2, "%s(), clen=%d\n", __FUNCTION__ , clen);
178 178
179 /* 179 /*
180 * Insert clen field, currently we either send data only, or control 180 * Insert clen field, currently we either send data only, or control
181 * only frames, to make things easier and avoid queueing 181 * only frames, to make things easier and avoid queueing
182 */ 182 */
@@ -210,7 +210,7 @@ static int ircomm_ttp_data_indication(void *instance, void *sap,
210 struct ircomm_cb *self = (struct ircomm_cb *) instance; 210 struct ircomm_cb *self = (struct ircomm_cb *) instance;
211 211
212 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 212 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
213 213
214 IRDA_ASSERT(self != NULL, return -1;); 214 IRDA_ASSERT(self != NULL, return -1;);
215 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;); 215 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;);
216 IRDA_ASSERT(skb != NULL, return -1;); 216 IRDA_ASSERT(skb != NULL, return -1;);
@@ -224,8 +224,8 @@ static int ircomm_ttp_data_indication(void *instance, void *sap,
224} 224}
225 225
226static void ircomm_ttp_connect_confirm(void *instance, void *sap, 226static void ircomm_ttp_connect_confirm(void *instance, void *sap,
227 struct qos_info *qos, 227 struct qos_info *qos,
228 __u32 max_sdu_size, 228 __u32 max_sdu_size,
229 __u8 max_header_size, 229 __u8 max_header_size,
230 struct sk_buff *skb) 230 struct sk_buff *skb)
231{ 231{
@@ -261,7 +261,7 @@ out:
261 * Function ircomm_ttp_connect_indication (instance, sap, qos, max_sdu_size, 261 * Function ircomm_ttp_connect_indication (instance, sap, qos, max_sdu_size,
262 * max_header_size, skb) 262 * max_header_size, skb)
263 * 263 *
264 * 264 *
265 * 265 *
266 */ 266 */
267static void ircomm_ttp_connect_indication(void *instance, void *sap, 267static void ircomm_ttp_connect_indication(void *instance, void *sap,
@@ -301,11 +301,11 @@ out:
301/* 301/*
302 * Function ircomm_ttp_disconnect_request (self, userdata, info) 302 * Function ircomm_ttp_disconnect_request (self, userdata, info)
303 * 303 *
304 * 304 *
305 * 305 *
306 */ 306 */
307static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, 307static int ircomm_ttp_disconnect_request(struct ircomm_cb *self,
308 struct sk_buff *userdata, 308 struct sk_buff *userdata,
309 struct ircomm_info *info) 309 struct ircomm_info *info)
310{ 310{
311 int ret; 311 int ret;
@@ -322,10 +322,10 @@ static int ircomm_ttp_disconnect_request(struct ircomm_cb *self,
322/* 322/*
323 * Function ircomm_ttp_disconnect_indication (instance, sap, reason, skb) 323 * Function ircomm_ttp_disconnect_indication (instance, sap, reason, skb)
324 * 324 *
325 * 325 *
326 * 326 *
327 */ 327 */
328static void ircomm_ttp_disconnect_indication(void *instance, void *sap, 328static void ircomm_ttp_disconnect_indication(void *instance, void *sap,
329 LM_REASON reason, 329 LM_REASON reason,
330 struct sk_buff *skb) 330 struct sk_buff *skb)
331{ 331{
@@ -361,7 +361,7 @@ static void ircomm_ttp_flow_indication(void *instance, void *sap,
361 361
362 IRDA_ASSERT(self != NULL, return;); 362 IRDA_ASSERT(self != NULL, return;);
363 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;); 363 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;);
364 364
365 if (self->notify.flow_indication) 365 if (self->notify.flow_indication)
366 self->notify.flow_indication(self->notify.instance, self, cmd); 366 self->notify.flow_indication(self->notify.instance, self, cmd);
367} 367}
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 262bda808d96..3d241e415a2a 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: ircomm_tty.c 3 * Filename: ircomm_tty.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: IrCOMM serial TTY driver 5 * Description: IrCOMM serial TTY driver
@@ -9,25 +9,25 @@
9 * Modified at: Wed Feb 23 00:09:02 2000 9 * Modified at: Wed Feb 23 00:09:02 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * Sources: serial.c and previous IrCOMM work by Takahide Higuchi 11 * Sources: serial.c and previous IrCOMM work by Takahide Higuchi
12 * 12 *
13 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. 13 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> 14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as 17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * This program is distributed in the hope that it will be useful, 21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details. 24 * GNU General Public License for more details.
25 * 25 *
26 * You should have received a copy of the GNU General Public License 26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software 27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA 29 * MA 02111-1307 USA
30 * 30 *
31 ********************************************************************/ 31 ********************************************************************/
32 32
33#include <linux/init.h> 33#include <linux/init.h>
@@ -69,7 +69,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
69 struct sk_buff *skb); 69 struct sk_buff *skb);
70static int ircomm_tty_control_indication(void *instance, void *sap, 70static int ircomm_tty_control_indication(void *instance, void *sap,
71 struct sk_buff *skb); 71 struct sk_buff *skb);
72static void ircomm_tty_flow_indication(void *instance, void *sap, 72static void ircomm_tty_flow_indication(void *instance, void *sap,
73 LOCAL_FLOW cmd); 73 LOCAL_FLOW cmd);
74#ifdef CONFIG_PROC_FS 74#ifdef CONFIG_PROC_FS
75static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len, 75static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len,
@@ -113,7 +113,7 @@ static int __init ircomm_tty_init(void)
113 driver = alloc_tty_driver(IRCOMM_TTY_PORTS); 113 driver = alloc_tty_driver(IRCOMM_TTY_PORTS);
114 if (!driver) 114 if (!driver)
115 return -ENOMEM; 115 return -ENOMEM;
116 ircomm_tty = hashbin_new(HB_LOCK); 116 ircomm_tty = hashbin_new(HB_LOCK);
117 if (ircomm_tty == NULL) { 117 if (ircomm_tty == NULL) {
118 IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__); 118 IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__);
119 put_tty_driver(driver); 119 put_tty_driver(driver);
@@ -163,11 +163,11 @@ static void __exit ircomm_tty_cleanup(void)
163{ 163{
164 int ret; 164 int ret;
165 165
166 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 166 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
167 167
168 ret = tty_unregister_driver(driver); 168 ret = tty_unregister_driver(driver);
169 if (ret) { 169 if (ret) {
170 IRDA_ERROR("%s(), failed to unregister driver\n", 170 IRDA_ERROR("%s(), failed to unregister driver\n",
171 __FUNCTION__); 171 __FUNCTION__);
172 return; 172 return;
173 } 173 }
@@ -179,7 +179,7 @@ static void __exit ircomm_tty_cleanup(void)
179/* 179/*
180 * Function ircomm_startup (self) 180 * Function ircomm_startup (self)
181 * 181 *
182 * 182 *
183 * 183 *
184 */ 184 */
185static int ircomm_tty_startup(struct ircomm_tty_cb *self) 185static int ircomm_tty_startup(struct ircomm_tty_cb *self)
@@ -203,17 +203,17 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self)
203 /* These callbacks we must handle ourselves */ 203 /* These callbacks we must handle ourselves */
204 notify.data_indication = ircomm_tty_data_indication; 204 notify.data_indication = ircomm_tty_data_indication;
205 notify.udata_indication = ircomm_tty_control_indication; 205 notify.udata_indication = ircomm_tty_control_indication;
206 notify.flow_indication = ircomm_tty_flow_indication; 206 notify.flow_indication = ircomm_tty_flow_indication;
207 207
208 /* Use the ircomm_tty interface for these ones */ 208 /* Use the ircomm_tty interface for these ones */
209 notify.disconnect_indication = ircomm_tty_disconnect_indication; 209 notify.disconnect_indication = ircomm_tty_disconnect_indication;
210 notify.connect_confirm = ircomm_tty_connect_confirm; 210 notify.connect_confirm = ircomm_tty_connect_confirm;
211 notify.connect_indication = ircomm_tty_connect_indication; 211 notify.connect_indication = ircomm_tty_connect_indication;
212 strlcpy(notify.name, "ircomm_tty", sizeof(notify.name)); 212 strlcpy(notify.name, "ircomm_tty", sizeof(notify.name));
213 notify.instance = self; 213 notify.instance = self;
214 214
215 if (!self->ircomm) { 215 if (!self->ircomm) {
216 self->ircomm = ircomm_open(&notify, self->service_type, 216 self->ircomm = ircomm_open(&notify, self->service_type,
217 self->line); 217 self->line);
218 } 218 }
219 if (!self->ircomm) 219 if (!self->ircomm)
@@ -237,10 +237,10 @@ err:
237/* 237/*
238 * Function ircomm_block_til_ready (self, filp) 238 * Function ircomm_block_til_ready (self, filp)
239 * 239 *
240 * 240 *
241 * 241 *
242 */ 242 */
243static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, 243static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
244 struct file *filp) 244 struct file *filp)
245{ 245{
246 DECLARE_WAITQUEUE(wait, current); 246 DECLARE_WAITQUEUE(wait, current);
@@ -248,7 +248,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
248 int do_clocal = 0, extra_count = 0; 248 int do_clocal = 0, extra_count = 0;
249 unsigned long flags; 249 unsigned long flags;
250 struct tty_struct *tty; 250 struct tty_struct *tty;
251 251
252 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 252 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
253 253
254 tty = self->tty; 254 tty = self->tty;
@@ -256,7 +256,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
256 /* 256 /*
257 * If non-blocking mode is set, or the port is not enabled, 257 * If non-blocking mode is set, or the port is not enabled,
258 * then make the check up front and then exit. 258 * then make the check up front and then exit.
259 */ 259 */
260 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ 260 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){
261 /* nonblock mode is set or port is not enabled */ 261 /* nonblock mode is set or port is not enabled */
262 self->flags |= ASYNC_NORMAL_ACTIVE; 262 self->flags |= ASYNC_NORMAL_ACTIVE;
@@ -268,17 +268,17 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
268 IRDA_DEBUG(1, "%s(), doing CLOCAL!\n", __FUNCTION__ ); 268 IRDA_DEBUG(1, "%s(), doing CLOCAL!\n", __FUNCTION__ );
269 do_clocal = 1; 269 do_clocal = 1;
270 } 270 }
271 271
272 /* Wait for carrier detect and the line to become 272 /* Wait for carrier detect and the line to become
273 * free (i.e., not in use by the callout). While we are in 273 * free (i.e., not in use by the callout). While we are in
274 * this loop, self->open_count is dropped by one, so that 274 * this loop, self->open_count is dropped by one, so that
275 * mgsl_close() knows when to free things. We restore it upon 275 * mgsl_close() knows when to free things. We restore it upon
276 * exit, either normal or abnormal. 276 * exit, either normal or abnormal.
277 */ 277 */
278 278
279 retval = 0; 279 retval = 0;
280 add_wait_queue(&self->open_wait, &wait); 280 add_wait_queue(&self->open_wait, &wait);
281 281
282 IRDA_DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n", 282 IRDA_DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n",
283 __FILE__,__LINE__, tty->driver->name, self->open_count ); 283 __FILE__,__LINE__, tty->driver->name, self->open_count );
284 284
@@ -290,7 +290,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
290 } 290 }
291 spin_unlock_irqrestore(&self->spinlock, flags); 291 spin_unlock_irqrestore(&self->spinlock, flags);
292 self->blocked_open++; 292 self->blocked_open++;
293 293
294 while (1) { 294 while (1) {
295 if (tty->termios->c_cflag & CBAUD) { 295 if (tty->termios->c_cflag & CBAUD) {
296 /* Here, we use to lock those two guys, but 296 /* Here, we use to lock those two guys, but
@@ -298,45 +298,45 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
298 * I don't see the point (and I see the deadlock). 298 * I don't see the point (and I see the deadlock).
299 * Jean II */ 299 * Jean II */
300 self->settings.dte |= IRCOMM_RTS + IRCOMM_DTR; 300 self->settings.dte |= IRCOMM_RTS + IRCOMM_DTR;
301 301
302 ircomm_param_request(self, IRCOMM_DTE, TRUE); 302 ircomm_param_request(self, IRCOMM_DTE, TRUE);
303 } 303 }
304 304
305 current->state = TASK_INTERRUPTIBLE; 305 current->state = TASK_INTERRUPTIBLE;
306 306
307 if (tty_hung_up_p(filp) || 307 if (tty_hung_up_p(filp) ||
308 !test_bit(ASYNC_B_INITIALIZED, &self->flags)) { 308 !test_bit(ASYNC_B_INITIALIZED, &self->flags)) {
309 retval = (self->flags & ASYNC_HUP_NOTIFY) ? 309 retval = (self->flags & ASYNC_HUP_NOTIFY) ?
310 -EAGAIN : -ERESTARTSYS; 310 -EAGAIN : -ERESTARTSYS;
311 break; 311 break;
312 } 312 }
313 313
314 /* 314 /*
315 * Check if link is ready now. Even if CLOCAL is 315 * Check if link is ready now. Even if CLOCAL is
316 * specified, we cannot return before the IrCOMM link is 316 * specified, we cannot return before the IrCOMM link is
317 * ready 317 * ready
318 */ 318 */
319 if (!test_bit(ASYNC_B_CLOSING, &self->flags) && 319 if (!test_bit(ASYNC_B_CLOSING, &self->flags) &&
320 (do_clocal || (self->settings.dce & IRCOMM_CD)) && 320 (do_clocal || (self->settings.dce & IRCOMM_CD)) &&
321 self->state == IRCOMM_TTY_READY) 321 self->state == IRCOMM_TTY_READY)
322 { 322 {
323 break; 323 break;
324 } 324 }
325 325
326 if (signal_pending(current)) { 326 if (signal_pending(current)) {
327 retval = -ERESTARTSYS; 327 retval = -ERESTARTSYS;
328 break; 328 break;
329 } 329 }
330 330
331 IRDA_DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n", 331 IRDA_DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n",
332 __FILE__,__LINE__, tty->driver->name, self->open_count ); 332 __FILE__,__LINE__, tty->driver->name, self->open_count );
333 333
334 schedule(); 334 schedule();
335 } 335 }
336 336
337 __set_current_state(TASK_RUNNING); 337 __set_current_state(TASK_RUNNING);
338 remove_wait_queue(&self->open_wait, &wait); 338 remove_wait_queue(&self->open_wait, &wait);
339 339
340 if (extra_count) { 340 if (extra_count) {
341 /* ++ is not atomic, so this should be protected - Jean II */ 341 /* ++ is not atomic, so this should be protected - Jean II */
342 spin_lock_irqsave(&self->spinlock, flags); 342 spin_lock_irqsave(&self->spinlock, flags);
@@ -344,14 +344,14 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
344 spin_unlock_irqrestore(&self->spinlock, flags); 344 spin_unlock_irqrestore(&self->spinlock, flags);
345 } 345 }
346 self->blocked_open--; 346 self->blocked_open--;
347 347
348 IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", 348 IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n",
349 __FILE__,__LINE__, tty->driver->name, self->open_count); 349 __FILE__,__LINE__, tty->driver->name, self->open_count);
350 350
351 if (!retval) 351 if (!retval)
352 self->flags |= ASYNC_NORMAL_ACTIVE; 352 self->flags |= ASYNC_NORMAL_ACTIVE;
353 353
354 return retval; 354 return retval;
355} 355}
356 356
357/* 357/*
@@ -384,7 +384,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
384 IRDA_ERROR("%s(), kmalloc failed!\n", __FUNCTION__); 384 IRDA_ERROR("%s(), kmalloc failed!\n", __FUNCTION__);
385 return -ENOMEM; 385 return -ENOMEM;
386 } 386 }
387 387
388 self->magic = IRCOMM_TTY_MAGIC; 388 self->magic = IRCOMM_TTY_MAGIC;
389 self->flow = FLOW_STOP; 389 self->flow = FLOW_STOP;
390 390
@@ -398,13 +398,13 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
398 /* Init some important stuff */ 398 /* Init some important stuff */
399 init_timer(&self->watchdog_timer); 399 init_timer(&self->watchdog_timer);
400 init_waitqueue_head(&self->open_wait); 400 init_waitqueue_head(&self->open_wait);
401 init_waitqueue_head(&self->close_wait); 401 init_waitqueue_head(&self->close_wait);
402 spin_lock_init(&self->spinlock); 402 spin_lock_init(&self->spinlock);
403 403
404 /* 404 /*
405 * Force TTY into raw mode by default which is usually what 405 * Force TTY into raw mode by default which is usually what
406 * we want for IrCOMM and IrLPT. This way applications will 406 * we want for IrCOMM and IrLPT. This way applications will
407 * not have to twiddle with printcap etc. 407 * not have to twiddle with printcap etc.
408 */ 408 */
409 tty->termios->c_iflag = 0; 409 tty->termios->c_iflag = 0;
410 tty->termios->c_oflag = 0; 410 tty->termios->c_oflag = 0;
@@ -420,7 +420,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
420 self->tty = tty; 420 self->tty = tty;
421 spin_unlock_irqrestore(&self->spinlock, flags); 421 spin_unlock_irqrestore(&self->spinlock, flags);
422 422
423 IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __FUNCTION__ , tty->driver->name, 423 IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __FUNCTION__ , tty->driver->name,
424 self->line, self->open_count); 424 self->line, self->open_count);
425 425
426 /* Not really used by us, but lets do it anyway */ 426 /* Not really used by us, but lets do it anyway */
@@ -473,7 +473,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
473 473
474 ret = ircomm_tty_block_til_ready(self, filp); 474 ret = ircomm_tty_block_til_ready(self, filp);
475 if (ret) { 475 if (ret) {
476 IRDA_DEBUG(2, 476 IRDA_DEBUG(2,
477 "%s(), returning after block_til_ready with %d\n", __FUNCTION__ , 477 "%s(), returning after block_til_ready with %d\n", __FUNCTION__ ,
478 ret); 478 ret);
479 479
@@ -519,7 +519,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp)
519 * serial port won't be shutdown. 519 * serial port won't be shutdown.
520 */ 520 */
521 IRDA_DEBUG(0, "%s(), bad serial port count; " 521 IRDA_DEBUG(0, "%s(), bad serial port count; "
522 "tty->count is 1, state->count is %d\n", __FUNCTION__ , 522 "tty->count is 1, state->count is %d\n", __FUNCTION__ ,
523 self->open_count); 523 self->open_count);
524 self->open_count = 1; 524 self->open_count = 1;
525 } 525 }
@@ -546,7 +546,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp)
546 spin_unlock_irqrestore(&self->spinlock, flags); 546 spin_unlock_irqrestore(&self->spinlock, flags);
547 547
548 /* 548 /*
549 * Now we wait for the transmit buffer to clear; and we notify 549 * Now we wait for the transmit buffer to clear; and we notify
550 * the line discipline to only process XON/XOFF characters. 550 * the line discipline to only process XON/XOFF characters.
551 */ 551 */
552 tty->closing = 1; 552 tty->closing = 1;
@@ -576,7 +576,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp)
576/* 576/*
577 * Function ircomm_tty_flush_buffer (tty) 577 * Function ircomm_tty_flush_buffer (tty)
578 * 578 *
579 * 579 *
580 * 580 *
581 */ 581 */
582static void ircomm_tty_flush_buffer(struct tty_struct *tty) 582static void ircomm_tty_flush_buffer(struct tty_struct *tty)
@@ -586,9 +586,9 @@ static void ircomm_tty_flush_buffer(struct tty_struct *tty)
586 IRDA_ASSERT(self != NULL, return;); 586 IRDA_ASSERT(self != NULL, return;);
587 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); 587 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
588 588
589 /* 589 /*
590 * Let do_softint() do this to avoid race condition with 590 * Let do_softint() do this to avoid race condition with
591 * do_softint() ;-) 591 * do_softint() ;-)
592 */ 592 */
593 schedule_work(&self->tqueue); 593 schedule_work(&self->tqueue);
594} 594}
@@ -597,7 +597,7 @@ static void ircomm_tty_flush_buffer(struct tty_struct *tty)
597 * Function ircomm_tty_do_softint (work) 597 * Function ircomm_tty_do_softint (work)
598 * 598 *
599 * We use this routine to give the write wakeup to the user at at a 599 * We use this routine to give the write wakeup to the user at at a
600 * safe time (as fast as possible after write have completed). This 600 * safe time (as fast as possible after write have completed). This
601 * can be compared to the Tx interrupt. 601 * can be compared to the Tx interrupt.
602 */ 602 */
603static void ircomm_tty_do_softint(struct work_struct *work) 603static void ircomm_tty_do_softint(struct work_struct *work)
@@ -638,7 +638,7 @@ static void ircomm_tty_do_softint(struct work_struct *work)
638 638
639 /* Unlink transmit buffer */ 639 /* Unlink transmit buffer */
640 spin_lock_irqsave(&self->spinlock, flags); 640 spin_lock_irqsave(&self->spinlock, flags);
641 641
642 skb = self->tx_skb; 642 skb = self->tx_skb;
643 self->tx_skb = NULL; 643 self->tx_skb = NULL;
644 644
@@ -650,9 +650,9 @@ static void ircomm_tty_do_softint(struct work_struct *work)
650 /* Drop reference count - see ircomm_ttp_data_request(). */ 650 /* Drop reference count - see ircomm_ttp_data_request(). */
651 dev_kfree_skb(skb); 651 dev_kfree_skb(skb);
652 } 652 }
653 653
654 /* Check if user (still) wants to be waken up */ 654 /* Check if user (still) wants to be waken up */
655 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 655 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
656 tty->ldisc.write_wakeup) 656 tty->ldisc.write_wakeup)
657 { 657 {
658 (tty->ldisc.write_wakeup)(tty); 658 (tty->ldisc.write_wakeup)(tty);
@@ -717,12 +717,12 @@ static int ircomm_tty_write(struct tty_struct *tty,
717 /* Fetch current transmit buffer */ 717 /* Fetch current transmit buffer */
718 skb = self->tx_skb; 718 skb = self->tx_skb;
719 719
720 /* 720 /*
721 * Send out all the data we get, possibly as multiple fragmented 721 * Send out all the data we get, possibly as multiple fragmented
722 * frames, but this will only happen if the data is larger than the 722 * frames, but this will only happen if the data is larger than the
723 * max data size. The normal case however is just the opposite, and 723 * max data size. The normal case however is just the opposite, and
724 * this function may be called multiple times, and will then actually 724 * this function may be called multiple times, and will then actually
725 * defragment the data and send it out as one packet as soon as 725 * defragment the data and send it out as one packet as soon as
726 * possible, but at a safer point in time 726 * possible, but at a safer point in time
727 */ 727 */
728 while (count) { 728 while (count) {
@@ -731,16 +731,16 @@ static int ircomm_tty_write(struct tty_struct *tty,
731 /* Adjust data size to the max data size */ 731 /* Adjust data size to the max data size */
732 if (size > self->max_data_size) 732 if (size > self->max_data_size)
733 size = self->max_data_size; 733 size = self->max_data_size;
734 734
735 /* 735 /*
736 * Do we already have a buffer ready for transmit, or do 736 * Do we already have a buffer ready for transmit, or do
737 * we need to allocate a new frame 737 * we need to allocate a new frame
738 */ 738 */
739 if (skb) { 739 if (skb) {
740 /* 740 /*
741 * Any room for more data at the end of the current 741 * Any room for more data at the end of the current
742 * transmit buffer? Cannot use skb_tailroom, since 742 * transmit buffer? Cannot use skb_tailroom, since
743 * dev_alloc_skb gives us a larger skb than we 743 * dev_alloc_skb gives us a larger skb than we
744 * requested 744 * requested
745 * Note : use tx_data_size, because max_data_size 745 * Note : use tx_data_size, because max_data_size
746 * may have changed and we don't want to overwrite 746 * may have changed and we don't want to overwrite
@@ -751,8 +751,8 @@ static int ircomm_tty_write(struct tty_struct *tty,
751 if (size > tailroom) 751 if (size > tailroom)
752 size = tailroom; 752 size = tailroom;
753 } else { 753 } else {
754 /* 754 /*
755 * Current transmit frame is full, so break 755 * Current transmit frame is full, so break
756 * out, so we can send it as soon as possible 756 * out, so we can send it as soon as possible
757 */ 757 */
758 break; 758 break;
@@ -782,15 +782,15 @@ static int ircomm_tty_write(struct tty_struct *tty,
782 782
783 spin_unlock_irqrestore(&self->spinlock, flags); 783 spin_unlock_irqrestore(&self->spinlock, flags);
784 784
785 /* 785 /*
786 * Schedule a new thread which will transmit the frame as soon 786 * Schedule a new thread which will transmit the frame as soon
787 * as possible, but at a safe point in time. We do this so the 787 * as possible, but at a safe point in time. We do this so the
788 * "user" can give us data multiple times, as PPP does (because of 788 * "user" can give us data multiple times, as PPP does (because of
789 * its 256 byte tx buffer). We will then defragment and send out 789 * its 256 byte tx buffer). We will then defragment and send out
790 * all this data as one single packet. 790 * all this data as one single packet.
791 */ 791 */
792 schedule_work(&self->tqueue); 792 schedule_work(&self->tqueue);
793 793
794 return len; 794 return len;
795} 795}
796 796
@@ -846,7 +846,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout)
846 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; 846 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
847 unsigned long orig_jiffies, poll_time; 847 unsigned long orig_jiffies, poll_time;
848 unsigned long flags; 848 unsigned long flags;
849 849
850 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 850 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
851 851
852 IRDA_ASSERT(self != NULL, return;); 852 IRDA_ASSERT(self != NULL, return;);
@@ -876,7 +876,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout)
876 * 876 *
877 * This routine notifies the tty driver that input buffers for the line 877 * This routine notifies the tty driver that input buffers for the line
878 * discipline are close to full, and it should somehow signal that no 878 * discipline are close to full, and it should somehow signal that no
879 * more characters should be sent to the tty. 879 * more characters should be sent to the tty.
880 */ 880 */
881static void ircomm_tty_throttle(struct tty_struct *tty) 881static void ircomm_tty_throttle(struct tty_struct *tty)
882{ 882{
@@ -890,16 +890,16 @@ static void ircomm_tty_throttle(struct tty_struct *tty)
890 /* Software flow control? */ 890 /* Software flow control? */
891 if (I_IXOFF(tty)) 891 if (I_IXOFF(tty))
892 ircomm_tty_send_xchar(tty, STOP_CHAR(tty)); 892 ircomm_tty_send_xchar(tty, STOP_CHAR(tty));
893 893
894 /* Hardware flow control? */ 894 /* Hardware flow control? */
895 if (tty->termios->c_cflag & CRTSCTS) { 895 if (tty->termios->c_cflag & CRTSCTS) {
896 self->settings.dte &= ~IRCOMM_RTS; 896 self->settings.dte &= ~IRCOMM_RTS;
897 self->settings.dte |= IRCOMM_DELTA_RTS; 897 self->settings.dte |= IRCOMM_DELTA_RTS;
898 898
899 ircomm_param_request(self, IRCOMM_DTE, TRUE); 899 ircomm_param_request(self, IRCOMM_DTE, TRUE);
900 } 900 }
901 901
902 ircomm_flow_request(self->ircomm, FLOW_STOP); 902 ircomm_flow_request(self->ircomm, FLOW_STOP);
903} 903}
904 904
905/* 905/*
@@ -930,7 +930,7 @@ static void ircomm_tty_unthrottle(struct tty_struct *tty)
930 ircomm_param_request(self, IRCOMM_DTE, TRUE); 930 ircomm_param_request(self, IRCOMM_DTE, TRUE);
931 IRDA_DEBUG(1, "%s(), FLOW_START\n", __FUNCTION__ ); 931 IRDA_DEBUG(1, "%s(), FLOW_START\n", __FUNCTION__ );
932 } 932 }
933 ircomm_flow_request(self->ircomm, FLOW_START); 933 ircomm_flow_request(self->ircomm, FLOW_START);
934} 934}
935 935
936/* 936/*
@@ -975,7 +975,7 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self)
975 spin_lock_irqsave(&self->spinlock, flags); 975 spin_lock_irqsave(&self->spinlock, flags);
976 976
977 del_timer(&self->watchdog_timer); 977 del_timer(&self->watchdog_timer);
978 978
979 /* Free parameter buffer */ 979 /* Free parameter buffer */
980 if (self->ctrl_skb) { 980 if (self->ctrl_skb) {
981 dev_kfree_skb(self->ctrl_skb); 981 dev_kfree_skb(self->ctrl_skb);
@@ -1001,7 +1001,7 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self)
1001 * 1001 *
1002 * This routine notifies the tty driver that it should hangup the tty 1002 * This routine notifies the tty driver that it should hangup the tty
1003 * device. 1003 * device.
1004 * 1004 *
1005 */ 1005 */
1006static void ircomm_tty_hangup(struct tty_struct *tty) 1006static void ircomm_tty_hangup(struct tty_struct *tty)
1007{ 1007{
@@ -1044,7 +1044,7 @@ static void ircomm_tty_send_xchar(struct tty_struct *tty, char ch)
1044 * Function ircomm_tty_start (tty) 1044 * Function ircomm_tty_start (tty)
1045 * 1045 *
1046 * This routine notifies the tty driver that it resume sending 1046 * This routine notifies the tty driver that it resume sending
1047 * characters to the tty device. 1047 * characters to the tty device.
1048 */ 1048 */
1049void ircomm_tty_start(struct tty_struct *tty) 1049void ircomm_tty_start(struct tty_struct *tty)
1050{ 1050{
@@ -1057,9 +1057,9 @@ void ircomm_tty_start(struct tty_struct *tty)
1057 * Function ircomm_tty_stop (tty) 1057 * Function ircomm_tty_stop (tty)
1058 * 1058 *
1059 * This routine notifies the tty driver that it should stop outputting 1059 * This routine notifies the tty driver that it should stop outputting
1060 * characters to the tty device. 1060 * characters to the tty device.
1061 */ 1061 */
1062static void ircomm_tty_stop(struct tty_struct *tty) 1062static void ircomm_tty_stop(struct tty_struct *tty)
1063{ 1063{
1064 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; 1064 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
1065 1065
@@ -1094,14 +1094,14 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self)
1094 /*wake_up_interruptible(&self->delta_msr_wait);*/ 1094 /*wake_up_interruptible(&self->delta_msr_wait);*/
1095 } 1095 }
1096 if ((self->flags & ASYNC_CHECK_CD) && (status & IRCOMM_DELTA_CD)) { 1096 if ((self->flags & ASYNC_CHECK_CD) && (status & IRCOMM_DELTA_CD)) {
1097 IRDA_DEBUG(2, 1097 IRDA_DEBUG(2,
1098 "%s(), ircomm%d CD now %s...\n", __FUNCTION__ , self->line, 1098 "%s(), ircomm%d CD now %s...\n", __FUNCTION__ , self->line,
1099 (status & IRCOMM_CD) ? "on" : "off"); 1099 (status & IRCOMM_CD) ? "on" : "off");
1100 1100
1101 if (status & IRCOMM_CD) { 1101 if (status & IRCOMM_CD) {
1102 wake_up_interruptible(&self->open_wait); 1102 wake_up_interruptible(&self->open_wait);
1103 } else { 1103 } else {
1104 IRDA_DEBUG(2, 1104 IRDA_DEBUG(2,
1105 "%s(), Doing serial hangup..\n", __FUNCTION__ ); 1105 "%s(), Doing serial hangup..\n", __FUNCTION__ );
1106 if (tty) 1106 if (tty)
1107 tty_hangup(tty); 1107 tty_hangup(tty);
@@ -1113,10 +1113,10 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self)
1113 if (self->flags & ASYNC_CTS_FLOW) { 1113 if (self->flags & ASYNC_CTS_FLOW) {
1114 if (tty->hw_stopped) { 1114 if (tty->hw_stopped) {
1115 if (status & IRCOMM_CTS) { 1115 if (status & IRCOMM_CTS) {
1116 IRDA_DEBUG(2, 1116 IRDA_DEBUG(2,
1117 "%s(), CTS tx start...\n", __FUNCTION__ ); 1117 "%s(), CTS tx start...\n", __FUNCTION__ );
1118 tty->hw_stopped = 0; 1118 tty->hw_stopped = 0;
1119 1119
1120 /* Wake up processes blocked on open */ 1120 /* Wake up processes blocked on open */
1121 wake_up_interruptible(&self->open_wait); 1121 wake_up_interruptible(&self->open_wait);
1122 1122
@@ -1125,7 +1125,7 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self)
1125 } 1125 }
1126 } else { 1126 } else {
1127 if (!(status & IRCOMM_CTS)) { 1127 if (!(status & IRCOMM_CTS)) {
1128 IRDA_DEBUG(2, 1128 IRDA_DEBUG(2,
1129 "%s(), CTS tx stop...\n", __FUNCTION__ ); 1129 "%s(), CTS tx stop...\n", __FUNCTION__ );
1130 tty->hw_stopped = 1; 1130 tty->hw_stopped = 1;
1131 } 1131 }
@@ -1145,7 +1145,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
1145 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 1145 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
1146 1146
1147 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 1147 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
1148 1148
1149 IRDA_ASSERT(self != NULL, return -1;); 1149 IRDA_ASSERT(self != NULL, return -1;);
1150 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 1150 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
1151 IRDA_ASSERT(skb != NULL, return -1;); 1151 IRDA_ASSERT(skb != NULL, return -1;);
@@ -1155,10 +1155,10 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
1155 return 0; 1155 return 0;
1156 } 1156 }
1157 1157
1158 /* 1158 /*
1159 * If we receive data when hardware is stopped then something is wrong. 1159 * If we receive data when hardware is stopped then something is wrong.
1160 * We try to poll the peers line settings to check if we are up todate. 1160 * We try to poll the peers line settings to check if we are up todate.
1161 * Devices like WinCE can do this, and since they don't send any 1161 * Devices like WinCE can do this, and since they don't send any
1162 * params, we can just as well declare the hardware for running. 1162 * params, we can just as well declare the hardware for running.
1163 */ 1163 */
1164 if (self->tty->hw_stopped && (self->flow == FLOW_START)) { 1164 if (self->tty->hw_stopped && (self->flow == FLOW_START)) {
@@ -1170,9 +1170,9 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
1170 ircomm_tty_link_established(self); 1170 ircomm_tty_link_established(self);
1171 } 1171 }
1172 1172
1173 /* 1173 /*
1174 * Just give it over to the line discipline. There is no need to 1174 * Just give it over to the line discipline. There is no need to
1175 * involve the flip buffers, since we are not running in an interrupt 1175 * involve the flip buffers, since we are not running in an interrupt
1176 * handler 1176 * handler
1177 */ 1177 */
1178 self->tty->ldisc.receive_buf(self->tty, skb->data, NULL, skb->len); 1178 self->tty->ldisc.receive_buf(self->tty, skb->data, NULL, skb->len);
@@ -1195,14 +1195,14 @@ static int ircomm_tty_control_indication(void *instance, void *sap,
1195 int clen; 1195 int clen;
1196 1196
1197 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 1197 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
1198 1198
1199 IRDA_ASSERT(self != NULL, return -1;); 1199 IRDA_ASSERT(self != NULL, return -1;);
1200 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 1200 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
1201 IRDA_ASSERT(skb != NULL, return -1;); 1201 IRDA_ASSERT(skb != NULL, return -1;);
1202 1202
1203 clen = skb->data[0]; 1203 clen = skb->data[0];
1204 1204
1205 irda_param_extract_all(self, skb->data+1, IRDA_MIN(skb->len-1, clen), 1205 irda_param_extract_all(self, skb->data+1, IRDA_MIN(skb->len-1, clen),
1206 &ircomm_param_info); 1206 &ircomm_param_info);
1207 1207
1208 /* No need to kfree_skb - see ircomm_control_indication() */ 1208 /* No need to kfree_skb - see ircomm_control_indication() */
@@ -1217,7 +1217,7 @@ static int ircomm_tty_control_indication(void *instance, void *sap,
1217 * transmission of data. We just mark the hardware as stopped, and wait 1217 * transmission of data. We just mark the hardware as stopped, and wait
1218 * for IrTTP to notify us that things are OK again. 1218 * for IrTTP to notify us that things are OK again.
1219 */ 1219 */
1220static void ircomm_tty_flow_indication(void *instance, void *sap, 1220static void ircomm_tty_flow_indication(void *instance, void *sap,
1221 LOCAL_FLOW cmd) 1221 LOCAL_FLOW cmd)
1222{ 1222{
1223 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 1223 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
@@ -1247,7 +1247,7 @@ static void ircomm_tty_flow_indication(void *instance, void *sap,
1247 1247
1248static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf) 1248static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf)
1249{ 1249{
1250 int ret=0; 1250 int ret=0;
1251 1251
1252 ret += sprintf(buf+ret, "State: %s\n", ircomm_tty_state[self->state]); 1252 ret += sprintf(buf+ret, "State: %s\n", ircomm_tty_state[self->state]);
1253 1253
@@ -1260,37 +1260,37 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf)
1260 ret += sprintf(buf+ret, "3_WIRE_RAW"); 1260 ret += sprintf(buf+ret, "3_WIRE_RAW");
1261 else 1261 else
1262 ret += sprintf(buf+ret, "No common service type!\n"); 1262 ret += sprintf(buf+ret, "No common service type!\n");
1263 ret += sprintf(buf+ret, "\n"); 1263 ret += sprintf(buf+ret, "\n");
1264 1264
1265 ret += sprintf(buf+ret, "Port name: %s\n", self->settings.port_name); 1265 ret += sprintf(buf+ret, "Port name: %s\n", self->settings.port_name);
1266 1266
1267 ret += sprintf(buf+ret, "DTE status: "); 1267 ret += sprintf(buf+ret, "DTE status: ");
1268 if (self->settings.dte & IRCOMM_RTS) 1268 if (self->settings.dte & IRCOMM_RTS)
1269 ret += sprintf(buf+ret, "RTS|"); 1269 ret += sprintf(buf+ret, "RTS|");
1270 if (self->settings.dte & IRCOMM_DTR) 1270 if (self->settings.dte & IRCOMM_DTR)
1271 ret += sprintf(buf+ret, "DTR|"); 1271 ret += sprintf(buf+ret, "DTR|");
1272 if (self->settings.dte) 1272 if (self->settings.dte)
1273 ret--; /* remove the last | */ 1273 ret--; /* remove the last | */
1274 ret += sprintf(buf+ret, "\n"); 1274 ret += sprintf(buf+ret, "\n");
1275 1275
1276 ret += sprintf(buf+ret, "DCE status: "); 1276 ret += sprintf(buf+ret, "DCE status: ");
1277 if (self->settings.dce & IRCOMM_CTS) 1277 if (self->settings.dce & IRCOMM_CTS)
1278 ret += sprintf(buf+ret, "CTS|"); 1278 ret += sprintf(buf+ret, "CTS|");
1279 if (self->settings.dce & IRCOMM_DSR) 1279 if (self->settings.dce & IRCOMM_DSR)
1280 ret += sprintf(buf+ret, "DSR|"); 1280 ret += sprintf(buf+ret, "DSR|");
1281 if (self->settings.dce & IRCOMM_CD) 1281 if (self->settings.dce & IRCOMM_CD)
1282 ret += sprintf(buf+ret, "CD|"); 1282 ret += sprintf(buf+ret, "CD|");
1283 if (self->settings.dce & IRCOMM_RI) 1283 if (self->settings.dce & IRCOMM_RI)
1284 ret += sprintf(buf+ret, "RI|"); 1284 ret += sprintf(buf+ret, "RI|");
1285 if (self->settings.dce) 1285 if (self->settings.dce)
1286 ret--; /* remove the last | */ 1286 ret--; /* remove the last | */
1287 ret += sprintf(buf+ret, "\n"); 1287 ret += sprintf(buf+ret, "\n");
1288 1288
1289 ret += sprintf(buf+ret, "Configuration: "); 1289 ret += sprintf(buf+ret, "Configuration: ");
1290 if (!self->settings.null_modem) 1290 if (!self->settings.null_modem)
1291 ret += sprintf(buf+ret, "DTE <-> DCE\n"); 1291 ret += sprintf(buf+ret, "DTE <-> DCE\n");
1292 else 1292 else
1293 ret += sprintf(buf+ret, 1293 ret += sprintf(buf+ret,
1294 "DTE <-> DTE (null modem emulation)\n"); 1294 "DTE <-> DTE (null modem emulation)\n");
1295 1295
1296 ret += sprintf(buf+ret, "Data rate: %d\n", self->settings.data_rate); 1296 ret += sprintf(buf+ret, "Data rate: %d\n", self->settings.data_rate);
@@ -1314,7 +1314,7 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf)
1314 ret += sprintf(buf+ret, "ENQ_ACK_OUT|"); 1314 ret += sprintf(buf+ret, "ENQ_ACK_OUT|");
1315 if (self->settings.flow_control) 1315 if (self->settings.flow_control)
1316 ret--; /* remove the last | */ 1316 ret--; /* remove the last | */
1317 ret += sprintf(buf+ret, "\n"); 1317 ret += sprintf(buf+ret, "\n");
1318 1318
1319 ret += sprintf(buf+ret, "Flags: "); 1319 ret += sprintf(buf+ret, "Flags: ");
1320 if (self->flags & ASYNC_CTS_FLOW) 1320 if (self->flags & ASYNC_CTS_FLOW)
@@ -1333,25 +1333,25 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf)
1333 ret--; /* remove the last | */ 1333 ret--; /* remove the last | */
1334 ret += sprintf(buf+ret, "\n"); 1334 ret += sprintf(buf+ret, "\n");
1335 1335
1336 ret += sprintf(buf+ret, "Role: %s\n", self->client ? 1336 ret += sprintf(buf+ret, "Role: %s\n", self->client ?
1337 "client" : "server"); 1337 "client" : "server");
1338 ret += sprintf(buf+ret, "Open count: %d\n", self->open_count); 1338 ret += sprintf(buf+ret, "Open count: %d\n", self->open_count);
1339 ret += sprintf(buf+ret, "Max data size: %d\n", self->max_data_size); 1339 ret += sprintf(buf+ret, "Max data size: %d\n", self->max_data_size);
1340 ret += sprintf(buf+ret, "Max header size: %d\n", self->max_header_size); 1340 ret += sprintf(buf+ret, "Max header size: %d\n", self->max_header_size);
1341 1341
1342 if (self->tty) 1342 if (self->tty)
1343 ret += sprintf(buf+ret, "Hardware: %s\n", 1343 ret += sprintf(buf+ret, "Hardware: %s\n",
1344 self->tty->hw_stopped ? "Stopped" : "Running"); 1344 self->tty->hw_stopped ? "Stopped" : "Running");
1345 1345
1346 ret += sprintf(buf+ret, "\n"); 1346 ret += sprintf(buf+ret, "\n");
1347 return ret; 1347 return ret;
1348} 1348}
1349 1349
1350 1350
1351/* 1351/*
1352 * Function ircomm_tty_read_proc (buf, start, offset, len, eof, unused) 1352 * Function ircomm_tty_read_proc (buf, start, offset, len, eof, unused)
1353 * 1353 *
1354 * 1354 *
1355 * 1355 *
1356 */ 1356 */
1357#ifdef CONFIG_PROC_FS 1357#ifdef CONFIG_PROC_FS
@@ -1359,8 +1359,8 @@ static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len,
1359 int *eof, void *unused) 1359 int *eof, void *unused)
1360{ 1360{
1361 struct ircomm_tty_cb *self; 1361 struct ircomm_tty_cb *self;
1362 int count = 0, l; 1362 int count = 0, l;
1363 off_t begin = 0; 1363 off_t begin = 0;
1364 unsigned long flags; 1364 unsigned long flags;
1365 1365
1366 spin_lock_irqsave(&ircomm_tty->hb_spinlock, flags); 1366 spin_lock_irqsave(&ircomm_tty->hb_spinlock, flags);
@@ -1370,25 +1370,25 @@ static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len,
1370 if (self->magic != IRCOMM_TTY_MAGIC) 1370 if (self->magic != IRCOMM_TTY_MAGIC)
1371 break; 1371 break;
1372 1372
1373 l = ircomm_tty_line_info(self, buf + count); 1373 l = ircomm_tty_line_info(self, buf + count);
1374 count += l; 1374 count += l;
1375 if (count+begin > offset+len) 1375 if (count+begin > offset+len)
1376 goto done; 1376 goto done;
1377 if (count+begin < offset) { 1377 if (count+begin < offset) {
1378 begin += count; 1378 begin += count;
1379 count = 0; 1379 count = 0;
1380 } 1380 }
1381 1381
1382 self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty); 1382 self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty);
1383 } 1383 }
1384 *eof = 1; 1384 *eof = 1;
1385done: 1385done:
1386 spin_unlock_irqrestore(&ircomm_tty->hb_spinlock, flags); 1386 spin_unlock_irqrestore(&ircomm_tty->hb_spinlock, flags);
1387 1387
1388 if (offset >= count+begin) 1388 if (offset >= count+begin)
1389 return 0; 1389 return 0;
1390 *start = buf + (offset-begin); 1390 *start = buf + (offset-begin);
1391 return ((len < begin+count-offset) ? len : begin+count-offset); 1391 return ((len < begin+count-offset) ? len : begin+count-offset);
1392} 1392}
1393#endif /* CONFIG_PROC_FS */ 1393#endif /* CONFIG_PROC_FS */
1394 1394
diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c
index 99f5eddbb4b7..8d7ba93e4e09 100644
--- a/net/irda/ircomm/ircomm_tty_attach.c
+++ b/net/irda/ircomm/ircomm_tty_attach.c
@@ -1,32 +1,32 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: ircomm_tty_attach.c 3 * Filename: ircomm_tty_attach.c
4 * Version: 4 * Version:
5 * Description: Code for attaching the serial driver to IrCOMM 5 * Description: Code for attaching the serial driver to IrCOMM
6 * Status: Experimental. 6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no> 7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Sat Jun 5 17:42:00 1999 8 * Created at: Sat Jun 5 17:42:00 1999
9 * Modified at: Tue Jan 4 14:20:49 2000 9 * Modified at: Tue Jan 4 14:20:49 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. 12 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
13 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> 13 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
14 * 14 *
15 * This program is free software; you can redistribute it and/or 15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as 16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * This program is distributed in the hope that it will be useful, 20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details. 23 * GNU General Public License for more details.
24 * 24 *
25 * You should have received a copy of the GNU General Public License 25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software 26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA 28 * MA 02111-1307 USA
29 * 29 *
30 ********************************************************************/ 30 ********************************************************************/
31 31
32#include <linux/sched.h> 32#include <linux/sched.h>
@@ -50,35 +50,35 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self);
50static void ircomm_tty_discovery_indication(discinfo_t *discovery, 50static void ircomm_tty_discovery_indication(discinfo_t *discovery,
51 DISCOVERY_MODE mode, 51 DISCOVERY_MODE mode,
52 void *priv); 52 void *priv);
53static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, 53static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id,
54 struct ias_value *value, void *priv); 54 struct ias_value *value, void *priv);
55static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, 55static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
56 int timeout); 56 int timeout);
57static void ircomm_tty_watchdog_timer_expired(void *data); 57static void ircomm_tty_watchdog_timer_expired(void *data);
58 58
59static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, 59static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
60 IRCOMM_TTY_EVENT event, 60 IRCOMM_TTY_EVENT event,
61 struct sk_buff *skb, 61 struct sk_buff *skb,
62 struct ircomm_tty_info *info); 62 struct ircomm_tty_info *info);
63static int ircomm_tty_state_search(struct ircomm_tty_cb *self, 63static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
64 IRCOMM_TTY_EVENT event, 64 IRCOMM_TTY_EVENT event,
65 struct sk_buff *skb, 65 struct sk_buff *skb,
66 struct ircomm_tty_info *info); 66 struct ircomm_tty_info *info);
67static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, 67static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
68 IRCOMM_TTY_EVENT event, 68 IRCOMM_TTY_EVENT event,
69 struct sk_buff *skb, 69 struct sk_buff *skb,
70 struct ircomm_tty_info *info); 70 struct ircomm_tty_info *info);
71static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, 71static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self,
72 IRCOMM_TTY_EVENT event, 72 IRCOMM_TTY_EVENT event,
73 struct sk_buff *skb, 73 struct sk_buff *skb,
74 struct ircomm_tty_info *info); 74 struct ircomm_tty_info *info);
75static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, 75static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
76 IRCOMM_TTY_EVENT event, 76 IRCOMM_TTY_EVENT event,
77 struct sk_buff *skb, 77 struct sk_buff *skb,
78 struct ircomm_tty_info *info); 78 struct ircomm_tty_info *info);
79static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, 79static int ircomm_tty_state_ready(struct ircomm_tty_cb *self,
80 IRCOMM_TTY_EVENT event, 80 IRCOMM_TTY_EVENT event,
81 struct sk_buff *skb, 81 struct sk_buff *skb,
82 struct ircomm_tty_info *info); 82 struct ircomm_tty_info *info);
83 83
84char *ircomm_tty_state[] = { 84char *ircomm_tty_state[] = {
@@ -111,7 +111,7 @@ static char *ircomm_tty_event[] = {
111#endif /* CONFIG_IRDA_DEBUG */ 111#endif /* CONFIG_IRDA_DEBUG */
112 112
113static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, 113static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
114 struct sk_buff *skb, struct ircomm_tty_info *info) = 114 struct sk_buff *skb, struct ircomm_tty_info *info) =
115{ 115{
116 ircomm_tty_state_idle, 116 ircomm_tty_state_idle,
117 ircomm_tty_state_search, 117 ircomm_tty_state_search,
@@ -125,7 +125,7 @@ static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
125 * Function ircomm_tty_attach_cable (driver) 125 * Function ircomm_tty_attach_cable (driver)
126 * 126 *
127 * Try to attach cable (IrCOMM link). This function will only return 127 * Try to attach cable (IrCOMM link). This function will only return
128 * when the link has been connected, or if an error condition occurs. 128 * when the link has been connected, or if an error condition occurs.
129 * If success, the return value is the resulting service type. 129 * If success, the return value is the resulting service type.
130 */ 130 */
131int ircomm_tty_attach_cable(struct ircomm_tty_cb *self) 131int ircomm_tty_attach_cable(struct ircomm_tty_cb *self)
@@ -135,7 +135,7 @@ int ircomm_tty_attach_cable(struct ircomm_tty_cb *self)
135 IRDA_ASSERT(self != NULL, return -1;); 135 IRDA_ASSERT(self != NULL, return -1;);
136 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 136 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
137 137
138 /* Check if somebody has already connected to us */ 138 /* Check if somebody has already connected to us */
139 if (ircomm_is_connected(self->ircomm)) { 139 if (ircomm_is_connected(self->ircomm)) {
140 IRDA_DEBUG(0, "%s(), already connected!\n", __FUNCTION__ ); 140 IRDA_DEBUG(0, "%s(), already connected!\n", __FUNCTION__ );
141 return 0; 141 return 0;
@@ -177,7 +177,7 @@ void ircomm_tty_detach_cable(struct ircomm_tty_cb *self)
177 self->skey = NULL; 177 self->skey = NULL;
178 } 178 }
179 179
180 if (self->iriap) { 180 if (self->iriap) {
181 iriap_close(self->iriap); 181 iriap_close(self->iriap);
182 self->iriap = NULL; 182 self->iriap = NULL;
183 } 183 }
@@ -212,7 +212,7 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self)
212 212
213 IRDA_ASSERT(self != NULL, return;); 213 IRDA_ASSERT(self != NULL, return;);
214 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); 214 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
215 215
216 /* Compute hint bits based on service */ 216 /* Compute hint bits based on service */
217 hints = irlmp_service_to_hint(S_COMM); 217 hints = irlmp_service_to_hint(S_COMM);
218 if (self->service_type & IRCOMM_3_WIRE_RAW) 218 if (self->service_type & IRCOMM_3_WIRE_RAW)
@@ -234,19 +234,19 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self)
234 if (self->service_type & IRCOMM_3_WIRE_RAW) { 234 if (self->service_type & IRCOMM_3_WIRE_RAW) {
235 /* Register IrLPT with LM-IAS */ 235 /* Register IrLPT with LM-IAS */
236 self->obj = irias_new_object("IrLPT", IAS_IRLPT_ID); 236 self->obj = irias_new_object("IrLPT", IAS_IRLPT_ID);
237 irias_add_integer_attrib(self->obj, "IrDA:IrLMP:LsapSel", 237 irias_add_integer_attrib(self->obj, "IrDA:IrLMP:LsapSel",
238 self->slsap_sel, IAS_KERNEL_ATTR); 238 self->slsap_sel, IAS_KERNEL_ATTR);
239 } else { 239 } else {
240 /* Register IrCOMM with LM-IAS */ 240 /* Register IrCOMM with LM-IAS */
241 self->obj = irias_new_object("IrDA:IrCOMM", IAS_IRCOMM_ID); 241 self->obj = irias_new_object("IrDA:IrCOMM", IAS_IRCOMM_ID);
242 irias_add_integer_attrib(self->obj, "IrDA:TinyTP:LsapSel", 242 irias_add_integer_attrib(self->obj, "IrDA:TinyTP:LsapSel",
243 self->slsap_sel, IAS_KERNEL_ATTR); 243 self->slsap_sel, IAS_KERNEL_ATTR);
244 244
245 /* Code the parameters into the buffer */ 245 /* Code the parameters into the buffer */
246 irda_param_pack(oct_seq, "bbbbbb", 246 irda_param_pack(oct_seq, "bbbbbb",
247 IRCOMM_SERVICE_TYPE, 1, self->service_type, 247 IRCOMM_SERVICE_TYPE, 1, self->service_type,
248 IRCOMM_PORT_TYPE, 1, IRCOMM_SERIAL); 248 IRCOMM_PORT_TYPE, 1, IRCOMM_SERIAL);
249 249
250 /* Register parameters with LM-IAS */ 250 /* Register parameters with LM-IAS */
251 irias_add_octseq_attrib(self->obj, "Parameters", oct_seq, 6, 251 irias_add_octseq_attrib(self->obj, "Parameters", oct_seq, 6,
252 IAS_KERNEL_ATTR); 252 IAS_KERNEL_ATTR);
@@ -302,23 +302,23 @@ int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self)
302 IRDA_ASSERT(self != NULL, return -1;); 302 IRDA_ASSERT(self != NULL, return -1;);
303 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 303 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
304 304
305 if (self->service_type & IRCOMM_3_WIRE_RAW) 305 if (self->service_type & IRCOMM_3_WIRE_RAW)
306 return 0; 306 return 0;
307 307
308 /* 308 /*
309 * Set default values, but only if the application for some reason 309 * Set default values, but only if the application for some reason
310 * haven't set them already 310 * haven't set them already
311 */ 311 */
312 IRDA_DEBUG(2, "%s(), data-rate = %d\n", __FUNCTION__ , 312 IRDA_DEBUG(2, "%s(), data-rate = %d\n", __FUNCTION__ ,
313 self->settings.data_rate); 313 self->settings.data_rate);
314 if (!self->settings.data_rate) 314 if (!self->settings.data_rate)
315 self->settings.data_rate = 9600; 315 self->settings.data_rate = 9600;
316 IRDA_DEBUG(2, "%s(), data-format = %d\n", __FUNCTION__ , 316 IRDA_DEBUG(2, "%s(), data-format = %d\n", __FUNCTION__ ,
317 self->settings.data_format); 317 self->settings.data_format);
318 if (!self->settings.data_format) 318 if (!self->settings.data_format)
319 self->settings.data_format = IRCOMM_WSIZE_8; /* 8N1 */ 319 self->settings.data_format = IRCOMM_WSIZE_8; /* 8N1 */
320 320
321 IRDA_DEBUG(2, "%s(), flow-control = %d\n", __FUNCTION__ , 321 IRDA_DEBUG(2, "%s(), flow-control = %d\n", __FUNCTION__ ,
322 self->settings.flow_control); 322 self->settings.flow_control);
323 /*self->settings.flow_control = IRCOMM_RTS_CTS_IN|IRCOMM_RTS_CTS_OUT;*/ 323 /*self->settings.flow_control = IRCOMM_RTS_CTS_IN|IRCOMM_RTS_CTS_OUT;*/
324 324
@@ -330,7 +330,7 @@ int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self)
330 ircomm_param_request(self, IRCOMM_SERVICE_TYPE, FALSE); 330 ircomm_param_request(self, IRCOMM_SERVICE_TYPE, FALSE);
331 ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE); 331 ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE);
332 ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE); 332 ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE);
333 333
334 /* For a 3 wire service, we just flush the last parameter and return */ 334 /* For a 3 wire service, we just flush the last parameter and return */
335 if (self->settings.service_type == IRCOMM_3_WIRE) { 335 if (self->settings.service_type == IRCOMM_3_WIRE) {
336 ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE); 336 ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE);
@@ -342,10 +342,10 @@ int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self)
342#if 0 342#if 0
343 ircomm_param_request(self, IRCOMM_XON_XOFF, FALSE); 343 ircomm_param_request(self, IRCOMM_XON_XOFF, FALSE);
344 ircomm_param_request(self, IRCOMM_ENQ_ACK, FALSE); 344 ircomm_param_request(self, IRCOMM_ENQ_ACK, FALSE);
345#endif 345#endif
346 /* Notify peer that we are ready to receive data */ 346 /* Notify peer that we are ready to receive data */
347 ircomm_param_request(self, IRCOMM_DTE, TRUE); 347 ircomm_param_request(self, IRCOMM_DTE, TRUE);
348 348
349 return 0; 349 return 0;
350} 350}
351 351
@@ -388,8 +388,8 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery,
388 self = (struct ircomm_tty_cb *) hashbin_get_first(ircomm_tty); 388 self = (struct ircomm_tty_cb *) hashbin_get_first(ircomm_tty);
389 while (self != NULL) { 389 while (self != NULL) {
390 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); 390 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
391 391
392 ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION, 392 ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION,
393 NULL, &info); 393 NULL, &info);
394 394
395 self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty); 395 self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty);
@@ -402,7 +402,7 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery,
402 * Link disconnected 402 * Link disconnected
403 * 403 *
404 */ 404 */
405void ircomm_tty_disconnect_indication(void *instance, void *sap, 405void ircomm_tty_disconnect_indication(void *instance, void *sap,
406 LM_REASON reason, 406 LM_REASON reason,
407 struct sk_buff *skb) 407 struct sk_buff *skb)
408{ 408{
@@ -422,7 +422,7 @@ void ircomm_tty_disconnect_indication(void *instance, void *sap,
422 /* Stop data transfers */ 422 /* Stop data transfers */
423 self->tty->hw_stopped = 1; 423 self->tty->hw_stopped = 1;
424 424
425 ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL, 425 ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL,
426 NULL); 426 NULL);
427} 427}
428 428
@@ -432,8 +432,8 @@ void ircomm_tty_disconnect_indication(void *instance, void *sap,
432 * Got result from the IAS query we make 432 * Got result from the IAS query we make
433 * 433 *
434 */ 434 */
435static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, 435static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id,
436 struct ias_value *value, 436 struct ias_value *value,
437 void *priv) 437 void *priv)
438{ 438{
439 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) priv; 439 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) priv;
@@ -454,18 +454,18 @@ static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id,
454 } 454 }
455 455
456 switch (value->type) { 456 switch (value->type) {
457 case IAS_OCT_SEQ: 457 case IAS_OCT_SEQ:
458 IRDA_DEBUG(2, "%s(), got octet sequence\n", __FUNCTION__ ); 458 IRDA_DEBUG(2, "%s(), got octet sequence\n", __FUNCTION__ );
459 459
460 irda_param_extract_all(self, value->t.oct_seq, value->len, 460 irda_param_extract_all(self, value->t.oct_seq, value->len,
461 &ircomm_param_info); 461 &ircomm_param_info);
462 462
463 ircomm_tty_do_event(self, IRCOMM_TTY_GOT_PARAMETERS, NULL, 463 ircomm_tty_do_event(self, IRCOMM_TTY_GOT_PARAMETERS, NULL,
464 NULL); 464 NULL);
465 break; 465 break;
466 case IAS_INTEGER: 466 case IAS_INTEGER:
467 /* Got LSAP selector */ 467 /* Got LSAP selector */
468 IRDA_DEBUG(2, "%s(), got lsapsel = %d\n", __FUNCTION__ , 468 IRDA_DEBUG(2, "%s(), got lsapsel = %d\n", __FUNCTION__ ,
469 value->t.integer); 469 value->t.integer);
470 470
471 if (value->t.integer == -1) { 471 if (value->t.integer == -1) {
@@ -491,10 +491,10 @@ static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id,
491 * Connection confirmed 491 * Connection confirmed
492 * 492 *
493 */ 493 */
494void ircomm_tty_connect_confirm(void *instance, void *sap, 494void ircomm_tty_connect_confirm(void *instance, void *sap,
495 struct qos_info *qos, 495 struct qos_info *qos,
496 __u32 max_data_size, 496 __u32 max_data_size,
497 __u8 max_header_size, 497 __u8 max_header_size,
498 struct sk_buff *skb) 498 struct sk_buff *skb)
499{ 499{
500 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 500 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
@@ -515,16 +515,16 @@ void ircomm_tty_connect_confirm(void *instance, void *sap,
515} 515}
516 516
517/* 517/*
518 * Function ircomm_tty_connect_indication (instance, sap, qos, max_sdu_size, 518 * Function ircomm_tty_connect_indication (instance, sap, qos, max_sdu_size,
519 * skb) 519 * skb)
520 * 520 *
521 * we are discovered and being requested to connect by remote device ! 521 * we are discovered and being requested to connect by remote device !
522 * 522 *
523 */ 523 */
524void ircomm_tty_connect_indication(void *instance, void *sap, 524void ircomm_tty_connect_indication(void *instance, void *sap,
525 struct qos_info *qos, 525 struct qos_info *qos,
526 __u32 max_data_size, 526 __u32 max_data_size,
527 __u8 max_header_size, 527 __u8 max_header_size,
528 struct sk_buff *skb) 528 struct sk_buff *skb)
529{ 529{
530 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 530 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
@@ -542,8 +542,8 @@ void ircomm_tty_connect_indication(void *instance, void *sap,
542 542
543 clen = skb->data[0]; 543 clen = skb->data[0];
544 if (clen) 544 if (clen)
545 irda_param_extract_all(self, skb->data+1, 545 irda_param_extract_all(self, skb->data+1,
546 IRDA_MIN(skb->len, clen), 546 IRDA_MIN(skb->len, clen),
547 &ircomm_param_info); 547 &ircomm_param_info);
548 548
549 ircomm_tty_do_event(self, IRCOMM_TTY_CONNECT_INDICATION, NULL, NULL); 549 ircomm_tty_do_event(self, IRCOMM_TTY_CONNECT_INDICATION, NULL, NULL);
@@ -566,14 +566,14 @@ void ircomm_tty_link_established(struct ircomm_tty_cb *self)
566 566
567 if (!self->tty) 567 if (!self->tty)
568 return; 568 return;
569 569
570 del_timer(&self->watchdog_timer); 570 del_timer(&self->watchdog_timer);
571 571
572 /* 572 /*
573 * IrCOMM link is now up, and if we are not using hardware 573 * IrCOMM link is now up, and if we are not using hardware
574 * flow-control, then declare the hardware as running. Otherwise we 574 * flow-control, then declare the hardware as running. Otherwise we
575 * will have to wait for the peer device (DCE) to raise the CTS 575 * will have to wait for the peer device (DCE) to raise the CTS
576 * line. 576 * line.
577 */ 577 */
578 if ((self->flags & ASYNC_CTS_FLOW) && ((self->settings.dce & IRCOMM_CTS) == 0)) { 578 if ((self->flags & ASYNC_CTS_FLOW) && ((self->settings.dce & IRCOMM_CTS) == 0)) {
579 IRDA_DEBUG(0, "%s(), waiting for CTS ...\n", __FUNCTION__ ); 579 IRDA_DEBUG(0, "%s(), waiting for CTS ...\n", __FUNCTION__ );
@@ -582,7 +582,7 @@ void ircomm_tty_link_established(struct ircomm_tty_cb *self)
582 IRDA_DEBUG(1, "%s(), starting hardware!\n", __FUNCTION__ ); 582 IRDA_DEBUG(1, "%s(), starting hardware!\n", __FUNCTION__ );
583 583
584 self->tty->hw_stopped = 0; 584 self->tty->hw_stopped = 0;
585 585
586 /* Wake up processes blocked on open */ 586 /* Wake up processes blocked on open */
587 wake_up_interruptible(&self->open_wait); 587 wake_up_interruptible(&self->open_wait);
588 } 588 }
@@ -593,8 +593,8 @@ void ircomm_tty_link_established(struct ircomm_tty_cb *self)
593/* 593/*
594 * Function ircomm_tty_start_watchdog_timer (self, timeout) 594 * Function ircomm_tty_start_watchdog_timer (self, timeout)
595 * 595 *
596 * Start the watchdog timer. This timer is used to make sure that any 596 * Start the watchdog timer. This timer is used to make sure that any
597 * connection attempt is successful, and if not, we will retry after 597 * connection attempt is successful, and if not, we will retry after
598 * the timeout 598 * the timeout
599 */ 599 */
600static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, 600static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
@@ -616,7 +616,7 @@ static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
616static void ircomm_tty_watchdog_timer_expired(void *data) 616static void ircomm_tty_watchdog_timer_expired(void *data)
617{ 617{
618 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) data; 618 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) data;
619 619
620 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 620 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
621 621
622 IRDA_ASSERT(self != NULL, return;); 622 IRDA_ASSERT(self != NULL, return;);
@@ -633,14 +633,14 @@ static void ircomm_tty_watchdog_timer_expired(void *data)
633 * 633 *
634 */ 634 */
635int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, 635int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
636 struct sk_buff *skb, struct ircomm_tty_info *info) 636 struct sk_buff *skb, struct ircomm_tty_info *info)
637{ 637{
638 IRDA_ASSERT(self != NULL, return -1;); 638 IRDA_ASSERT(self != NULL, return -1;);
639 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 639 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
640 640
641 IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __FUNCTION__ , 641 IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __FUNCTION__ ,
642 ircomm_tty_state[self->state], ircomm_tty_event[event]); 642 ircomm_tty_state[self->state], ircomm_tty_event[event]);
643 643
644 return (*state[self->state])(self, event, skb, info); 644 return (*state[self->state])(self, event, skb, info);
645} 645}
646 646
@@ -656,7 +656,7 @@ static inline void ircomm_tty_next_state(struct ircomm_tty_cb *self, IRCOMM_TTY_
656 IRDA_ASSERT(self != NULL, return;); 656 IRDA_ASSERT(self != NULL, return;);
657 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); 657 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
658 658
659 IRDA_DEBUG(2, "%s: next state=%s, service type=%d\n", __FUNCTION__ , 659 IRDA_DEBUG(2, "%s: next state=%s, service type=%d\n", __FUNCTION__ ,
660 ircomm_tty_state[self->state], self->service_type); 660 ircomm_tty_state[self->state], self->service_type);
661 */ 661 */
662 self->state = state; 662 self->state = state;
@@ -668,9 +668,9 @@ static inline void ircomm_tty_next_state(struct ircomm_tty_cb *self, IRCOMM_TTY_
668 * Just hanging around 668 * Just hanging around
669 * 669 *
670 */ 670 */
671static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, 671static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
672 IRCOMM_TTY_EVENT event, 672 IRCOMM_TTY_EVENT event,
673 struct sk_buff *skb, 673 struct sk_buff *skb,
674 struct ircomm_tty_info *info) 674 struct ircomm_tty_info *info)
675{ 675{
676 int ret = 0; 676 int ret = 0;
@@ -679,10 +679,10 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
679 ircomm_tty_state[self->state], ircomm_tty_event[event]); 679 ircomm_tty_state[self->state], ircomm_tty_event[event]);
680 switch (event) { 680 switch (event) {
681 case IRCOMM_TTY_ATTACH_CABLE: 681 case IRCOMM_TTY_ATTACH_CABLE:
682 /* Try to discover any remote devices */ 682 /* Try to discover any remote devices */
683 ircomm_tty_start_watchdog_timer(self, 3*HZ); 683 ircomm_tty_start_watchdog_timer(self, 3*HZ);
684 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH); 684 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
685 685
686 irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS); 686 irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS);
687 break; 687 break;
688 case IRCOMM_TTY_DISCOVERY_INDICATION: 688 case IRCOMM_TTY_DISCOVERY_INDICATION:
@@ -701,7 +701,7 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
701 iriap_getvaluebyclass_request(self->iriap, 701 iriap_getvaluebyclass_request(self->iriap,
702 self->saddr, self->daddr, 702 self->saddr, self->daddr,
703 "IrDA:IrCOMM", "Parameters"); 703 "IrDA:IrCOMM", "Parameters");
704 704
705 ircomm_tty_start_watchdog_timer(self, 3*HZ); 705 ircomm_tty_start_watchdog_timer(self, 3*HZ);
706 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS); 706 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS);
707 break; 707 break;
@@ -732,9 +732,9 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
732 * Trying to discover an IrCOMM device 732 * Trying to discover an IrCOMM device
733 * 733 *
734 */ 734 */
735static int ircomm_tty_state_search(struct ircomm_tty_cb *self, 735static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
736 IRCOMM_TTY_EVENT event, 736 IRCOMM_TTY_EVENT event,
737 struct sk_buff *skb, 737 struct sk_buff *skb,
738 struct ircomm_tty_info *info) 738 struct ircomm_tty_info *info)
739{ 739{
740 int ret = 0; 740 int ret = 0;
@@ -752,19 +752,19 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
752 __FUNCTION__); 752 __FUNCTION__);
753 return -EBUSY; 753 return -EBUSY;
754 } 754 }
755 755
756 self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, 756 self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
757 ircomm_tty_getvalue_confirm); 757 ircomm_tty_getvalue_confirm);
758 758
759 if (self->service_type == IRCOMM_3_WIRE_RAW) { 759 if (self->service_type == IRCOMM_3_WIRE_RAW) {
760 iriap_getvaluebyclass_request(self->iriap, self->saddr, 760 iriap_getvaluebyclass_request(self->iriap, self->saddr,
761 self->daddr, "IrLPT", 761 self->daddr, "IrLPT",
762 "IrDA:IrLMP:LsapSel"); 762 "IrDA:IrLMP:LsapSel");
763 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_LSAP_SEL); 763 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_LSAP_SEL);
764 } else { 764 } else {
765 iriap_getvaluebyclass_request(self->iriap, self->saddr, 765 iriap_getvaluebyclass_request(self->iriap, self->saddr,
766 self->daddr, 766 self->daddr,
767 "IrDA:IrCOMM", 767 "IrDA:IrCOMM",
768 "Parameters"); 768 "Parameters");
769 769
770 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS); 770 ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS);
@@ -783,7 +783,7 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
783#if 1 783#if 1
784 /* Give up */ 784 /* Give up */
785#else 785#else
786 /* Try to discover any remote devices */ 786 /* Try to discover any remote devices */
787 ircomm_tty_start_watchdog_timer(self, 3*HZ); 787 ircomm_tty_start_watchdog_timer(self, 3*HZ);
788 irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS); 788 irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS);
789#endif 789#endif
@@ -805,9 +805,9 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
805 * Querying the remote LM-IAS for IrCOMM parameters 805 * Querying the remote LM-IAS for IrCOMM parameters
806 * 806 *
807 */ 807 */
808static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, 808static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
809 IRCOMM_TTY_EVENT event, 809 IRCOMM_TTY_EVENT event,
810 struct sk_buff *skb, 810 struct sk_buff *skb,
811 struct ircomm_tty_info *info) 811 struct ircomm_tty_info *info)
812{ 812{
813 int ret = 0; 813 int ret = 0;
@@ -822,12 +822,12 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
822 __FUNCTION__); 822 __FUNCTION__);
823 return -EBUSY; 823 return -EBUSY;
824 } 824 }
825 825
826 self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, 826 self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
827 ircomm_tty_getvalue_confirm); 827 ircomm_tty_getvalue_confirm);
828 828
829 iriap_getvaluebyclass_request(self->iriap, self->saddr, 829 iriap_getvaluebyclass_request(self->iriap, self->saddr,
830 self->daddr, "IrDA:IrCOMM", 830 self->daddr, "IrDA:IrCOMM",
831 "IrDA:TinyTP:LsapSel"); 831 "IrDA:TinyTP:LsapSel");
832 832
833 ircomm_tty_start_watchdog_timer(self, 3*HZ); 833 ircomm_tty_start_watchdog_timer(self, 3*HZ);
@@ -836,7 +836,7 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
836 case IRCOMM_TTY_WD_TIMER_EXPIRED: 836 case IRCOMM_TTY_WD_TIMER_EXPIRED:
837 /* Go back to search mode */ 837 /* Go back to search mode */
838 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH); 838 ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
839 ircomm_tty_start_watchdog_timer(self, 3*HZ); 839 ircomm_tty_start_watchdog_timer(self, 3*HZ);
840 break; 840 break;
841 case IRCOMM_TTY_CONNECT_INDICATION: 841 case IRCOMM_TTY_CONNECT_INDICATION:
842 del_timer(&self->watchdog_timer); 842 del_timer(&self->watchdog_timer);
@@ -863,9 +863,9 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
863 * Query remote LM-IAS for the LSAP selector which we can connect to 863 * Query remote LM-IAS for the LSAP selector which we can connect to
864 * 864 *
865 */ 865 */
866static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, 866static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self,
867 IRCOMM_TTY_EVENT event, 867 IRCOMM_TTY_EVENT event,
868 struct sk_buff *skb, 868 struct sk_buff *skb,
869 struct ircomm_tty_info *info) 869 struct ircomm_tty_info *info)
870{ 870{
871 int ret = 0; 871 int ret = 0;
@@ -877,7 +877,7 @@ static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self,
877 case IRCOMM_TTY_GOT_LSAPSEL: 877 case IRCOMM_TTY_GOT_LSAPSEL:
878 /* Connect to remote device */ 878 /* Connect to remote device */
879 ret = ircomm_connect_request(self->ircomm, self->dlsap_sel, 879 ret = ircomm_connect_request(self->ircomm, self->dlsap_sel,
880 self->saddr, self->daddr, 880 self->saddr, self->daddr,
881 NULL, self->service_type); 881 NULL, self->service_type);
882 ircomm_tty_start_watchdog_timer(self, 3*HZ); 882 ircomm_tty_start_watchdog_timer(self, 3*HZ);
883 ircomm_tty_next_state(self, IRCOMM_TTY_SETUP); 883 ircomm_tty_next_state(self, IRCOMM_TTY_SETUP);
@@ -912,9 +912,9 @@ static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self,
912 * Trying to connect 912 * Trying to connect
913 * 913 *
914 */ 914 */
915static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, 915static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
916 IRCOMM_TTY_EVENT event, 916 IRCOMM_TTY_EVENT event,
917 struct sk_buff *skb, 917 struct sk_buff *skb,
918 struct ircomm_tty_info *info) 918 struct ircomm_tty_info *info)
919{ 919{
920 int ret = 0; 920 int ret = 0;
@@ -926,10 +926,10 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
926 case IRCOMM_TTY_CONNECT_CONFIRM: 926 case IRCOMM_TTY_CONNECT_CONFIRM:
927 del_timer(&self->watchdog_timer); 927 del_timer(&self->watchdog_timer);
928 ircomm_tty_ias_unregister(self); 928 ircomm_tty_ias_unregister(self);
929 929
930 /* 930 /*
931 * Send initial parameters. This will also send out queued 931 * Send initial parameters. This will also send out queued
932 * parameters waiting for the connection to come up 932 * parameters waiting for the connection to come up
933 */ 933 */
934 ircomm_tty_send_initial_parameters(self); 934 ircomm_tty_send_initial_parameters(self);
935 ircomm_tty_link_established(self); 935 ircomm_tty_link_established(self);
@@ -938,7 +938,7 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
938 case IRCOMM_TTY_CONNECT_INDICATION: 938 case IRCOMM_TTY_CONNECT_INDICATION:
939 del_timer(&self->watchdog_timer); 939 del_timer(&self->watchdog_timer);
940 ircomm_tty_ias_unregister(self); 940 ircomm_tty_ias_unregister(self);
941 941
942 /* Accept connection */ 942 /* Accept connection */
943 ircomm_connect_response(self->ircomm, NULL); 943 ircomm_connect_response(self->ircomm, NULL);
944 ircomm_tty_next_state(self, IRCOMM_TTY_READY); 944 ircomm_tty_next_state(self, IRCOMM_TTY_READY);
@@ -966,9 +966,9 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
966 * IrCOMM is now connected 966 * IrCOMM is now connected
967 * 967 *
968 */ 968 */
969static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, 969static int ircomm_tty_state_ready(struct ircomm_tty_cb *self,
970 IRCOMM_TTY_EVENT event, 970 IRCOMM_TTY_EVENT event,
971 struct sk_buff *skb, 971 struct sk_buff *skb,
972 struct ircomm_tty_info *info) 972 struct ircomm_tty_info *info)
973{ 973{
974 int ret = 0; 974 int ret = 0;
@@ -976,7 +976,7 @@ static int ircomm_tty_state_ready(struct ircomm_tty_cb *self,
976 switch (event) { 976 switch (event) {
977 case IRCOMM_TTY_DATA_REQUEST: 977 case IRCOMM_TTY_DATA_REQUEST:
978 ret = ircomm_data_request(self->ircomm, skb); 978 ret = ircomm_data_request(self->ircomm, skb);
979 break; 979 break;
980 case IRCOMM_TTY_DETACH_CABLE: 980 case IRCOMM_TTY_DETACH_CABLE:
981 ircomm_disconnect_request(self->ircomm, NULL); 981 ircomm_disconnect_request(self->ircomm, NULL);
982 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); 982 ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c
index 75e39ea599d8..a5174e6e7ad3 100644
--- a/net/irda/ircomm/ircomm_tty_ioctl.c
+++ b/net/irda/ircomm/ircomm_tty_ioctl.c
@@ -1,31 +1,31 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: ircomm_tty_ioctl.c 3 * Filename: ircomm_tty_ioctl.c
4 * Version: 4 * Version:
5 * Description: 5 * Description:
6 * Status: Experimental. 6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no> 7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Thu Jun 10 14:39:09 1999 8 * Created at: Thu Jun 10 14:39:09 1999
9 * Modified at: Wed Jan 5 14:45:43 2000 9 * Modified at: Wed Jan 5 14:45:43 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. 12 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
13 * 13 *
14 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as 15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * This program is distributed in the hope that it will be useful, 19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details. 22 * GNU General Public License for more details.
23 * 23 *
24 * You should have received a copy of the GNU General Public License 24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software 25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * MA 02111-1307 USA 27 * MA 02111-1307 USA
28 * 28 *
29 ********************************************************************/ 29 ********************************************************************/
30 30
31#include <linux/init.h> 31#include <linux/init.h>
@@ -75,7 +75,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self)
75 } 75 }
76 if (cflag & CSTOPB) 76 if (cflag & CSTOPB)
77 cval |= IRCOMM_2_STOP_BIT; 77 cval |= IRCOMM_2_STOP_BIT;
78 78
79 if (cflag & PARENB) 79 if (cflag & PARENB)
80 cval |= IRCOMM_PARITY_ENABLE; 80 cval |= IRCOMM_PARITY_ENABLE;
81 if (!(cflag & PARODD)) 81 if (!(cflag & PARODD))
@@ -88,7 +88,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self)
88 88
89 self->settings.data_rate = baud; 89 self->settings.data_rate = baud;
90 ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE); 90 ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE);
91 91
92 /* CTS flow control flag and modem status interrupts */ 92 /* CTS flow control flag and modem status interrupts */
93 if (cflag & CRTSCTS) { 93 if (cflag & CRTSCTS) {
94 self->flags |= ASYNC_CTS_FLOW; 94 self->flags |= ASYNC_CTS_FLOW;
@@ -104,7 +104,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self)
104 self->flags &= ~ASYNC_CHECK_CD; 104 self->flags &= ~ASYNC_CHECK_CD;
105 else 105 else
106 self->flags |= ASYNC_CHECK_CD; 106 self->flags |= ASYNC_CHECK_CD;
107#if 0 107#if 0
108 /* 108 /*
109 * Set up parity check flag 109 * Set up parity check flag
110 */ 110 */
@@ -113,7 +113,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self)
113 driver->read_status_mask |= LSR_FE | LSR_PE; 113 driver->read_status_mask |= LSR_FE | LSR_PE;
114 if (I_BRKINT(driver->tty) || I_PARMRK(driver->tty)) 114 if (I_BRKINT(driver->tty) || I_PARMRK(driver->tty))
115 driver->read_status_mask |= LSR_BI; 115 driver->read_status_mask |= LSR_BI;
116 116
117 /* 117 /*
118 * Characters to ignore 118 * Characters to ignore
119 */ 119 */
@@ -124,17 +124,17 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self)
124 if (I_IGNBRK(self->tty)) { 124 if (I_IGNBRK(self->tty)) {
125 self->ignore_status_mask |= LSR_BI; 125 self->ignore_status_mask |= LSR_BI;
126 /* 126 /*
127 * If we're ignore parity and break indicators, ignore 127 * If we're ignore parity and break indicators, ignore
128 * overruns too. (For real raw support). 128 * overruns too. (For real raw support).
129 */ 129 */
130 if (I_IGNPAR(self->tty)) 130 if (I_IGNPAR(self->tty))
131 self->ignore_status_mask |= LSR_OE; 131 self->ignore_status_mask |= LSR_OE;
132 } 132 }
133#endif 133#endif
134 self->settings.data_format = cval; 134 self->settings.data_format = cval;
135 135
136 ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE); 136 ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE);
137 ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE); 137 ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE);
138} 138}
139 139
140/* 140/*
@@ -145,7 +145,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self)
145 * should be prepared to accept the case where old == NULL, and try to 145 * should be prepared to accept the case where old == NULL, and try to
146 * do something rational. 146 * do something rational.
147 */ 147 */
148void ircomm_tty_set_termios(struct tty_struct *tty, 148void ircomm_tty_set_termios(struct tty_struct *tty,
149 struct ktermios *old_termios) 149 struct ktermios *old_termios)
150{ 150{
151 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; 151 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
@@ -153,8 +153,8 @@ void ircomm_tty_set_termios(struct tty_struct *tty,
153 153
154 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 154 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
155 155
156 if ((cflag == old_termios->c_cflag) && 156 if ((cflag == old_termios->c_cflag) &&
157 (RELEVANT_IFLAG(tty->termios->c_iflag) == 157 (RELEVANT_IFLAG(tty->termios->c_iflag) ==
158 RELEVANT_IFLAG(old_termios->c_iflag))) 158 RELEVANT_IFLAG(old_termios->c_iflag)))
159 { 159 {
160 return; 160 return;
@@ -168,21 +168,21 @@ void ircomm_tty_set_termios(struct tty_struct *tty,
168 self->settings.dte &= ~(IRCOMM_DTR|IRCOMM_RTS); 168 self->settings.dte &= ~(IRCOMM_DTR|IRCOMM_RTS);
169 ircomm_param_request(self, IRCOMM_DTE, TRUE); 169 ircomm_param_request(self, IRCOMM_DTE, TRUE);
170 } 170 }
171 171
172 /* Handle transition away from B0 status */ 172 /* Handle transition away from B0 status */
173 if (!(old_termios->c_cflag & CBAUD) && 173 if (!(old_termios->c_cflag & CBAUD) &&
174 (cflag & CBAUD)) { 174 (cflag & CBAUD)) {
175 self->settings.dte |= IRCOMM_DTR; 175 self->settings.dte |= IRCOMM_DTR;
176 if (!(tty->termios->c_cflag & CRTSCTS) || 176 if (!(tty->termios->c_cflag & CRTSCTS) ||
177 !test_bit(TTY_THROTTLED, &tty->flags)) { 177 !test_bit(TTY_THROTTLED, &tty->flags)) {
178 self->settings.dte |= IRCOMM_RTS; 178 self->settings.dte |= IRCOMM_RTS;
179 } 179 }
180 ircomm_param_request(self, IRCOMM_DTE, TRUE); 180 ircomm_param_request(self, IRCOMM_DTE, TRUE);
181 } 181 }
182 182
183 /* Handle turning off CRTSCTS */ 183 /* Handle turning off CRTSCTS */
184 if ((old_termios->c_cflag & CRTSCTS) && 184 if ((old_termios->c_cflag & CRTSCTS) &&
185 !(tty->termios->c_cflag & CRTSCTS)) 185 !(tty->termios->c_cflag & CRTSCTS))
186 { 186 {
187 tty->hw_stopped = 0; 187 tty->hw_stopped = 0;
188 ircomm_tty_start(tty); 188 ircomm_tty_start(tty);
@@ -192,7 +192,7 @@ void ircomm_tty_set_termios(struct tty_struct *tty,
192/* 192/*
193 * Function ircomm_tty_tiocmget (tty, file) 193 * Function ircomm_tty_tiocmget (tty, file)
194 * 194 *
195 * 195 *
196 * 196 *
197 */ 197 */
198int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file) 198int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file)
@@ -217,12 +217,12 @@ int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file)
217/* 217/*
218 * Function ircomm_tty_tiocmset (tty, file, set, clear) 218 * Function ircomm_tty_tiocmset (tty, file, set, clear)
219 * 219 *
220 * 220 *
221 * 221 *
222 */ 222 */
223int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, 223int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file,
224 unsigned int set, unsigned int clear) 224 unsigned int set, unsigned int clear)
225{ 225{
226 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; 226 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
227 227
228 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 228 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
@@ -249,21 +249,21 @@ int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file,
249 self->settings.dte |= IRCOMM_DELTA_DTR; 249 self->settings.dte |= IRCOMM_DELTA_DTR;
250 250
251 ircomm_param_request(self, IRCOMM_DTE, TRUE); 251 ircomm_param_request(self, IRCOMM_DTE, TRUE);
252 252
253 return 0; 253 return 0;
254} 254}
255 255
256/* 256/*
257 * Function get_serial_info (driver, retinfo) 257 * Function get_serial_info (driver, retinfo)
258 * 258 *
259 * 259 *
260 * 260 *
261 */ 261 */
262static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, 262static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self,
263 struct serial_struct __user *retinfo) 263 struct serial_struct __user *retinfo)
264{ 264{
265 struct serial_struct info; 265 struct serial_struct info;
266 266
267 if (!retinfo) 267 if (!retinfo)
268 return -EFAULT; 268 return -EFAULT;
269 269
@@ -277,11 +277,11 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self,
277 info.closing_wait = self->closing_wait; 277 info.closing_wait = self->closing_wait;
278 278
279 /* For compatibility */ 279 /* For compatibility */
280 info.type = PORT_16550A; 280 info.type = PORT_16550A;
281 info.port = 0; 281 info.port = 0;
282 info.irq = 0; 282 info.irq = 0;
283 info.xmit_fifo_size = 0; 283 info.xmit_fifo_size = 0;
284 info.hub6 = 0; 284 info.hub6 = 0;
285 info.custom_divisor = 0; 285 info.custom_divisor = 0;
286 286
287 if (copy_to_user(retinfo, &info, sizeof(*retinfo))) 287 if (copy_to_user(retinfo, &info, sizeof(*retinfo)))
@@ -293,7 +293,7 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self,
293/* 293/*
294 * Function set_serial_info (driver, new_info) 294 * Function set_serial_info (driver, new_info)
295 * 295 *
296 * 296 *
297 * 297 *
298 */ 298 */
299static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, 299static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self,
@@ -311,7 +311,7 @@ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self,
311 311
312 state = self 312 state = self
313 old_state = *self; 313 old_state = *self;
314 314
315 if (!capable(CAP_SYS_ADMIN)) { 315 if (!capable(CAP_SYS_ADMIN)) {
316 if ((new_serial.baud_base != state->settings.data_rate) || 316 if ((new_serial.baud_base != state->settings.data_rate) ||
317 (new_serial.close_delay != state->close_delay) || 317 (new_serial.close_delay != state->close_delay) ||
@@ -368,10 +368,10 @@ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self,
368/* 368/*
369 * Function ircomm_tty_ioctl (tty, file, cmd, arg) 369 * Function ircomm_tty_ioctl (tty, file, cmd, arg)
370 * 370 *
371 * 371 *
372 * 372 *
373 */ 373 */
374int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, 374int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file,
375 unsigned int cmd, unsigned long arg) 375 unsigned int cmd, unsigned long arg)
376{ 376{
377 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; 377 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
@@ -416,7 +416,7 @@ int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file,
416 put_user(cnow.brk, &p_cuser->brk) || 416 put_user(cnow.brk, &p_cuser->brk) ||
417 put_user(cnow.buf_overrun, &p_cuser->buf_overrun)) 417 put_user(cnow.buf_overrun, &p_cuser->buf_overrun))
418 return -EFAULT; 418 return -EFAULT;
419#endif 419#endif
420 return 0; 420 return 0;
421 default: 421 default:
422 ret = -ENOIOCTLCMD; /* ioctls which we must ignore */ 422 ret = -ENOIOCTLCMD; /* ioctls which we must ignore */
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c
index 7e7a31798d8d..e717801b38f9 100644
--- a/net/irda/irda_device.c
+++ b/net/irda/irda_device.c
@@ -341,11 +341,11 @@ static void irda_task_timer_expired(void *data)
341 */ 341 */
342static void irda_device_setup(struct net_device *dev) 342static void irda_device_setup(struct net_device *dev)
343{ 343{
344 dev->hard_header_len = 0; 344 dev->hard_header_len = 0;
345 dev->addr_len = LAP_ALEN; 345 dev->addr_len = LAP_ALEN;
346 346
347 dev->type = ARPHRD_IRDA; 347 dev->type = ARPHRD_IRDA;
348 dev->tx_queue_len = 8; /* Window size + 1 s-frame */ 348 dev->tx_queue_len = 8; /* Window size + 1 s-frame */
349 349
350 memset(dev->broadcast, 0xff, LAP_ALEN); 350 memset(dev->broadcast, 0xff, LAP_ALEN);
351 351
@@ -354,7 +354,7 @@ static void irda_device_setup(struct net_device *dev)
354} 354}
355 355
356/* 356/*
357 * Funciton alloc_irdadev 357 * Funciton alloc_irdadev
358 * Allocates and sets up an IRDA device in a manner similar to 358 * Allocates and sets up an IRDA device in a manner similar to
359 * alloc_etherdev. 359 * alloc_etherdev.
360 */ 360 */
@@ -386,9 +386,9 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
386 /* Try to load the module needed */ 386 /* Try to load the module needed */
387 if (!reg && capable(CAP_SYS_MODULE)) { 387 if (!reg && capable(CAP_SYS_MODULE)) {
388 spin_unlock(&dongles->hb_spinlock); 388 spin_unlock(&dongles->hb_spinlock);
389 389
390 request_module("irda-dongle-%d", type); 390 request_module("irda-dongle-%d", type);
391 391
392 spin_lock(&dongles->hb_spinlock); 392 spin_lock(&dongles->hb_spinlock);
393 reg = hashbin_find(dongles, type, NULL); 393 reg = hashbin_find(dongles, type, NULL);
394 } 394 }
@@ -438,15 +438,15 @@ int irda_device_register_dongle(struct dongle_reg *new)
438 spin_lock(&dongles->hb_spinlock); 438 spin_lock(&dongles->hb_spinlock);
439 /* Check if this dongle has been registered before */ 439 /* Check if this dongle has been registered before */
440 if (hashbin_find(dongles, new->type, NULL)) { 440 if (hashbin_find(dongles, new->type, NULL)) {
441 IRDA_MESSAGE("%s: Dongle type %x already registered\n", 441 IRDA_MESSAGE("%s: Dongle type %x already registered\n",
442 __FUNCTION__, new->type); 442 __FUNCTION__, new->type);
443 } else { 443 } else {
444 /* Insert IrDA dongle into hashbin */ 444 /* Insert IrDA dongle into hashbin */
445 hashbin_insert(dongles, (irda_queue_t *) new, new->type, NULL); 445 hashbin_insert(dongles, (irda_queue_t *) new, new->type, NULL);
446 } 446 }
447 spin_unlock(&dongles->hb_spinlock); 447 spin_unlock(&dongles->hb_spinlock);
448 448
449 return 0; 449 return 0;
450} 450}
451EXPORT_SYMBOL(irda_device_register_dongle); 451EXPORT_SYMBOL(irda_device_register_dongle);
452 452
@@ -462,7 +462,7 @@ void irda_device_unregister_dongle(struct dongle_reg *dongle)
462 462
463 spin_lock(&dongles->hb_spinlock); 463 spin_lock(&dongles->hb_spinlock);
464 node = hashbin_remove(dongles, dongle->type, NULL); 464 node = hashbin_remove(dongles, dongle->type, NULL);
465 if (!node) 465 if (!node)
466 IRDA_ERROR("%s: dongle not found!\n", __FUNCTION__); 466 IRDA_ERROR("%s: dongle not found!\n", __FUNCTION__);
467 spin_unlock(&dongles->hb_spinlock); 467 spin_unlock(&dongles->hb_spinlock);
468} 468}
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index 8f1c6d65b247..98b0fa965790 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -79,10 +79,10 @@ static int iriap_data_indication(void *instance, void *sap,
79 79
80static void iriap_watchdog_timer_expired(void *data); 80static void iriap_watchdog_timer_expired(void *data);
81 81
82static inline void iriap_start_watchdog_timer(struct iriap_cb *self, 82static inline void iriap_start_watchdog_timer(struct iriap_cb *self,
83 int timeout) 83 int timeout)
84{ 84{
85 irda_start_timer(&self->watchdog_timer, timeout, self, 85 irda_start_timer(&self->watchdog_timer, timeout, self,
86 iriap_watchdog_timer_expired); 86 iriap_watchdog_timer_expired);
87} 87}
88 88
@@ -674,7 +674,7 @@ static void iriap_getvaluebyclass_indication(struct iriap_cb *self,
674 if (attrib == NULL) { 674 if (attrib == NULL) {
675 IRDA_DEBUG(2, "LM-IAS: Attribute %s not found\n", attr); 675 IRDA_DEBUG(2, "LM-IAS: Attribute %s not found\n", attr);
676 iriap_getvaluebyclass_response(self, obj->id, 676 iriap_getvaluebyclass_response(self, obj->id,
677 IAS_ATTRIB_UNKNOWN, 677 IAS_ATTRIB_UNKNOWN,
678 &irias_missing); 678 &irias_missing);
679 return; 679 return;
680 } 680 }
@@ -971,7 +971,7 @@ static const char *ias_value_types[] = {
971 "IAS_STRING" 971 "IAS_STRING"
972}; 972};
973 973
974static inline struct ias_object *irias_seq_idx(loff_t pos) 974static inline struct ias_object *irias_seq_idx(loff_t pos)
975{ 975{
976 struct ias_object *obj; 976 struct ias_object *obj;
977 977
@@ -980,7 +980,7 @@ static inline struct ias_object *irias_seq_idx(loff_t pos)
980 if (pos-- == 0) 980 if (pos-- == 0)
981 break; 981 break;
982 } 982 }
983 983
984 return obj; 984 return obj;
985} 985}
986 986
@@ -995,7 +995,7 @@ static void *irias_seq_next(struct seq_file *seq, void *v, loff_t *pos)
995{ 995{
996 ++*pos; 996 ++*pos;
997 997
998 return (v == SEQ_START_TOKEN) 998 return (v == SEQ_START_TOKEN)
999 ? (void *) hashbin_get_first(irias_objects) 999 ? (void *) hashbin_get_first(irias_objects)
1000 : (void *) hashbin_get_next(irias_objects); 1000 : (void *) hashbin_get_next(irias_objects);
1001} 1001}
@@ -1027,7 +1027,7 @@ static int irias_seq_show(struct seq_file *seq, void *v)
1027 for (attrib = (struct ias_attrib *) hashbin_get_first(obj->attribs); 1027 for (attrib = (struct ias_attrib *) hashbin_get_first(obj->attribs);
1028 attrib != NULL; 1028 attrib != NULL;
1029 attrib = (struct ias_attrib *) hashbin_get_next(obj->attribs)) { 1029 attrib = (struct ias_attrib *) hashbin_get_next(obj->attribs)) {
1030 1030
1031 IRDA_ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, 1031 IRDA_ASSERT(attrib->magic == IAS_ATTRIB_MAGIC,
1032 goto outloop; ); 1032 goto outloop; );
1033 1033
@@ -1046,14 +1046,14 @@ static int irias_seq_show(struct seq_file *seq, void *v)
1046 attrib->value->t.string); 1046 attrib->value->t.string);
1047 break; 1047 break;
1048 case IAS_OCT_SEQ: 1048 case IAS_OCT_SEQ:
1049 seq_printf(seq, "octet sequence (%d bytes)\n", 1049 seq_printf(seq, "octet sequence (%d bytes)\n",
1050 attrib->value->len); 1050 attrib->value->len);
1051 break; 1051 break;
1052 case IAS_MISSING: 1052 case IAS_MISSING:
1053 seq_puts(seq, "missing\n"); 1053 seq_puts(seq, "missing\n");
1054 break; 1054 break;
1055 default: 1055 default:
1056 seq_printf(seq, "type %d?\n", 1056 seq_printf(seq, "type %d?\n",
1057 attrib->value->type); 1057 attrib->value->type);
1058 } 1058 }
1059 seq_putc(seq, '\n'); 1059 seq_putc(seq, '\n');
diff --git a/net/irda/irias_object.c b/net/irda/irias_object.c
index 2a571b43ebec..4adaae242b9e 100644
--- a/net/irda/irias_object.c
+++ b/net/irda/irias_object.c
@@ -57,8 +57,8 @@ static char *strndup(char *str, size_t max)
57 len = max; 57 len = max;
58 58
59 /* Allocate new string */ 59 /* Allocate new string */
60 new_str = kmalloc(len + 1, GFP_ATOMIC); 60 new_str = kmalloc(len + 1, GFP_ATOMIC);
61 if (new_str == NULL) { 61 if (new_str == NULL) {
62 IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); 62 IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
63 return NULL; 63 return NULL;
64 } 64 }
@@ -78,7 +78,7 @@ static char *strndup(char *str, size_t max)
78 */ 78 */
79struct ias_object *irias_new_object( char *name, int id) 79struct ias_object *irias_new_object( char *name, int id)
80{ 80{
81 struct ias_object *obj; 81 struct ias_object *obj;
82 82
83 IRDA_DEBUG( 4, "%s()\n", __FUNCTION__); 83 IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
84 84
diff --git a/net/irda/irlan/irlan_client.c b/net/irda/irlan/irlan_client.c
index 95cf1234ea17..a4c1c9545827 100644
--- a/net/irda/irlan/irlan_client.c
+++ b/net/irda/irlan/irlan_client.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irlan_client.c 3 * Filename: irlan_client.c
4 * Version: 0.9 4 * Version: 0.9
5 * Description: IrDA LAN Access Protocol (IrLAN) Client 5 * Description: IrDA LAN Access Protocol (IrLAN) Client
@@ -11,17 +11,17 @@
11 * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> 11 * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov>
12 * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> 12 * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk>
13 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> 13 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
14 * 14 *
15 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, 15 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
16 * All Rights Reserved. 16 * All Rights Reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * Neither Dag Brattli nor University of Tromsų admit liability nor 23 * Neither Dag Brattli nor University of Tromsų admit liability nor
24 * provide warranty for any of this software. This material is 24 * provide warranty for any of this software. This material is
25 * provided "AS-IS" and at no charge. 25 * provided "AS-IS" and at no charge.
26 * 26 *
27 ********************************************************************/ 27 ********************************************************************/
@@ -54,35 +54,35 @@
54 54
55#undef CONFIG_IRLAN_GRATUITOUS_ARP 55#undef CONFIG_IRLAN_GRATUITOUS_ARP
56 56
57static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, 57static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap,
58 LM_REASON reason, 58 LM_REASON reason,
59 struct sk_buff *); 59 struct sk_buff *);
60static int irlan_client_ctrl_data_indication(void *instance, void *sap, 60static int irlan_client_ctrl_data_indication(void *instance, void *sap,
61 struct sk_buff *skb); 61 struct sk_buff *skb);
62static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, 62static void irlan_client_ctrl_connect_confirm(void *instance, void *sap,
63 struct qos_info *qos, 63 struct qos_info *qos,
64 __u32 max_sdu_size, 64 __u32 max_sdu_size,
65 __u8 max_header_size, 65 __u8 max_header_size,
66 struct sk_buff *); 66 struct sk_buff *);
67static void irlan_check_response_param(struct irlan_cb *self, char *param, 67static void irlan_check_response_param(struct irlan_cb *self, char *param,
68 char *value, int val_len); 68 char *value, int val_len);
69static void irlan_client_open_ctrl_tsap(struct irlan_cb *self); 69static void irlan_client_open_ctrl_tsap(struct irlan_cb *self);
70 70
71static void irlan_client_kick_timer_expired(void *data) 71static void irlan_client_kick_timer_expired(void *data)
72{ 72{
73 struct irlan_cb *self = (struct irlan_cb *) data; 73 struct irlan_cb *self = (struct irlan_cb *) data;
74 74
75 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 75 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
76 76
77 IRDA_ASSERT(self != NULL, return;); 77 IRDA_ASSERT(self != NULL, return;);
78 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 78 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
79 79
80 /* 80 /*
81 * If we are in peer mode, the client may not have got the discovery 81 * If we are in peer mode, the client may not have got the discovery
82 * indication it needs to make progress. If the client is still in 82 * indication it needs to make progress. If the client is still in
83 * IDLE state, we must kick it to, but only if the provider is not IDLE 83 * IDLE state, we must kick it to, but only if the provider is not IDLE
84 */ 84 */
85 if ((self->provider.access_type == ACCESS_PEER) && 85 if ((self->provider.access_type == ACCESS_PEER) &&
86 (self->client.state == IRLAN_IDLE) && 86 (self->client.state == IRLAN_IDLE) &&
87 (self->provider.state != IRLAN_IDLE)) { 87 (self->provider.state != IRLAN_IDLE)) {
88 irlan_client_wakeup(self, self->saddr, self->daddr); 88 irlan_client_wakeup(self, self->saddr, self->daddr);
@@ -92,8 +92,8 @@ static void irlan_client_kick_timer_expired(void *data)
92static void irlan_client_start_kick_timer(struct irlan_cb *self, int timeout) 92static void irlan_client_start_kick_timer(struct irlan_cb *self, int timeout)
93{ 93{
94 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 94 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
95 95
96 irda_start_timer(&self->client.kick_timer, timeout, (void *) self, 96 irda_start_timer(&self->client.kick_timer, timeout, (void *) self,
97 irlan_client_kick_timer_expired); 97 irlan_client_kick_timer_expired);
98} 98}
99 99
@@ -110,11 +110,11 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr)
110 IRDA_ASSERT(self != NULL, return;); 110 IRDA_ASSERT(self != NULL, return;);
111 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 111 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
112 112
113 /* 113 /*
114 * Check if we are already awake, or if we are a provider in direct 114 * Check if we are already awake, or if we are a provider in direct
115 * mode (in that case we must leave the client idle 115 * mode (in that case we must leave the client idle
116 */ 116 */
117 if ((self->client.state != IRLAN_IDLE) || 117 if ((self->client.state != IRLAN_IDLE) ||
118 (self->provider.access_type == ACCESS_DIRECT)) 118 (self->provider.access_type == ACCESS_DIRECT))
119 { 119 {
120 IRDA_DEBUG(0, "%s(), already awake!\n", __FUNCTION__ ); 120 IRDA_DEBUG(0, "%s(), already awake!\n", __FUNCTION__ );
@@ -135,7 +135,7 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr)
135 irlan_open_data_tsap(self); 135 irlan_open_data_tsap(self);
136 136
137 irlan_do_client_event(self, IRLAN_DISCOVERY_INDICATION, NULL); 137 irlan_do_client_event(self, IRLAN_DISCOVERY_INDICATION, NULL);
138 138
139 /* Start kick timer */ 139 /* Start kick timer */
140 irlan_client_start_kick_timer(self, 2*HZ); 140 irlan_client_start_kick_timer(self, 2*HZ);
141} 141}
@@ -148,11 +148,11 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr)
148 */ 148 */
149void irlan_client_discovery_indication(discinfo_t *discovery, 149void irlan_client_discovery_indication(discinfo_t *discovery,
150 DISCOVERY_MODE mode, 150 DISCOVERY_MODE mode,
151 void *priv) 151 void *priv)
152{ 152{
153 struct irlan_cb *self; 153 struct irlan_cb *self;
154 __u32 saddr, daddr; 154 __u32 saddr, daddr;
155 155
156 IRDA_DEBUG(1, "%s()\n", __FUNCTION__ ); 156 IRDA_DEBUG(1, "%s()\n", __FUNCTION__ );
157 157
158 IRDA_ASSERT(discovery != NULL, return;); 158 IRDA_ASSERT(discovery != NULL, return;);
@@ -177,35 +177,35 @@ void irlan_client_discovery_indication(discinfo_t *discovery,
177 177
178 IRDA_DEBUG(1, "%s(), Found instance (%08x)!\n", __FUNCTION__ , 178 IRDA_DEBUG(1, "%s(), Found instance (%08x)!\n", __FUNCTION__ ,
179 daddr); 179 daddr);
180 180
181 irlan_client_wakeup(self, saddr, daddr); 181 irlan_client_wakeup(self, saddr, daddr);
182 } 182 }
183IRDA_ASSERT_LABEL(out:) 183IRDA_ASSERT_LABEL(out:)
184 rcu_read_unlock(); 184 rcu_read_unlock();
185} 185}
186 186
187/* 187/*
188 * Function irlan_client_data_indication (handle, skb) 188 * Function irlan_client_data_indication (handle, skb)
189 * 189 *
190 * This function gets the data that is received on the control channel 190 * This function gets the data that is received on the control channel
191 * 191 *
192 */ 192 */
193static int irlan_client_ctrl_data_indication(void *instance, void *sap, 193static int irlan_client_ctrl_data_indication(void *instance, void *sap,
194 struct sk_buff *skb) 194 struct sk_buff *skb)
195{ 195{
196 struct irlan_cb *self; 196 struct irlan_cb *self;
197 197
198 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 198 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
199 199
200 self = (struct irlan_cb *) instance; 200 self = (struct irlan_cb *) instance;
201 201
202 IRDA_ASSERT(self != NULL, return -1;); 202 IRDA_ASSERT(self != NULL, return -1;);
203 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); 203 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;);
204 IRDA_ASSERT(skb != NULL, return -1;); 204 IRDA_ASSERT(skb != NULL, return -1;);
205
206 irlan_do_client_event(self, IRLAN_DATA_INDICATION, skb);
207 205
208 /* Ready for a new command */ 206 irlan_do_client_event(self, IRLAN_DATA_INDICATION, skb);
207
208 /* Ready for a new command */
209 IRDA_DEBUG(2, "%s(), clearing tx_busy\n", __FUNCTION__ ); 209 IRDA_DEBUG(2, "%s(), clearing tx_busy\n", __FUNCTION__ );
210 self->client.tx_busy = FALSE; 210 self->client.tx_busy = FALSE;
211 211
@@ -215,27 +215,27 @@ static int irlan_client_ctrl_data_indication(void *instance, void *sap,
215 return 0; 215 return 0;
216} 216}
217 217
218static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, 218static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap,
219 LM_REASON reason, 219 LM_REASON reason,
220 struct sk_buff *userdata) 220 struct sk_buff *userdata)
221{ 221{
222 struct irlan_cb *self; 222 struct irlan_cb *self;
223 struct tsap_cb *tsap; 223 struct tsap_cb *tsap;
224 struct sk_buff *skb; 224 struct sk_buff *skb;
225 225
226 IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); 226 IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason);
227 227
228 self = (struct irlan_cb *) instance; 228 self = (struct irlan_cb *) instance;
229 tsap = (struct tsap_cb *) sap; 229 tsap = (struct tsap_cb *) sap;
230 230
231 IRDA_ASSERT(self != NULL, return;); 231 IRDA_ASSERT(self != NULL, return;);
232 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 232 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
233 IRDA_ASSERT(tsap != NULL, return;); 233 IRDA_ASSERT(tsap != NULL, return;);
234 IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); 234 IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;);
235 235
236 IRDA_ASSERT(tsap == self->client.tsap_ctrl, return;); 236 IRDA_ASSERT(tsap == self->client.tsap_ctrl, return;);
237 237
238 /* Remove frames queued on the control channel */ 238 /* Remove frames queued on the control channel */
239 while ((skb = skb_dequeue(&self->client.txq)) != NULL) { 239 while ((skb = skb_dequeue(&self->client.txq)) != NULL) {
240 dev_kfree_skb(skb); 240 dev_kfree_skb(skb);
241 } 241 }
@@ -272,7 +272,7 @@ static void irlan_client_open_ctrl_tsap(struct irlan_cb *self)
272 notify.disconnect_indication = irlan_client_ctrl_disconnect_indication; 272 notify.disconnect_indication = irlan_client_ctrl_disconnect_indication;
273 notify.instance = self; 273 notify.instance = self;
274 strlcpy(notify.name, "IrLAN ctrl (c)", sizeof(notify.name)); 274 strlcpy(notify.name, "IrLAN ctrl (c)", sizeof(notify.name));
275 275
276 tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, &notify); 276 tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, &notify);
277 if (!tsap) { 277 if (!tsap) {
278 IRDA_DEBUG(2, "%s(), Got no tsap!\n", __FUNCTION__ ); 278 IRDA_DEBUG(2, "%s(), Got no tsap!\n", __FUNCTION__ );
@@ -287,11 +287,11 @@ static void irlan_client_open_ctrl_tsap(struct irlan_cb *self)
287 * Connection to peer IrLAN laye confirmed 287 * Connection to peer IrLAN laye confirmed
288 * 288 *
289 */ 289 */
290static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, 290static void irlan_client_ctrl_connect_confirm(void *instance, void *sap,
291 struct qos_info *qos, 291 struct qos_info *qos,
292 __u32 max_sdu_size, 292 __u32 max_sdu_size,
293 __u8 max_header_size, 293 __u8 max_header_size,
294 struct sk_buff *skb) 294 struct sk_buff *skb)
295{ 295{
296 struct irlan_cb *self; 296 struct irlan_cb *self;
297 297
@@ -316,7 +316,7 @@ static void irlan_client_ctrl_connect_confirm(void *instance, void *sap,
316 * Print return code of request to peer IrLAN layer. 316 * Print return code of request to peer IrLAN layer.
317 * 317 *
318 */ 318 */
319static void print_ret_code(__u8 code) 319static void print_ret_code(__u8 code)
320{ 320{
321 switch(code) { 321 switch(code) {
322 case 0: 322 case 0:
@@ -358,7 +358,7 @@ static void print_ret_code(__u8 code)
358/* 358/*
359 * Function irlan_client_parse_response (self, skb) 359 * Function irlan_client_parse_response (self, skb)
360 * 360 *
361 * Extract all parameters from received buffer, then feed them to 361 * Extract all parameters from received buffer, then feed them to
362 * check_params for parsing 362 * check_params for parsing
363 */ 363 */
364void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) 364void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb)
@@ -369,30 +369,30 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb)
369 int ret; 369 int ret;
370 __u16 val_len; 370 __u16 val_len;
371 int i; 371 int i;
372 char *name; 372 char *name;
373 char *value; 373 char *value;
374
375 IRDA_ASSERT(skb != NULL, return;);
374 376
375 IRDA_ASSERT(skb != NULL, return;);
376
377 IRDA_DEBUG(4, "%s() skb->len=%d\n", __FUNCTION__ , (int) skb->len); 377 IRDA_DEBUG(4, "%s() skb->len=%d\n", __FUNCTION__ , (int) skb->len);
378 378
379 IRDA_ASSERT(self != NULL, return;); 379 IRDA_ASSERT(self != NULL, return;);
380 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 380 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
381 381
382 if (!skb) { 382 if (!skb) {
383 IRDA_ERROR("%s(), Got NULL skb!\n", __FUNCTION__); 383 IRDA_ERROR("%s(), Got NULL skb!\n", __FUNCTION__);
384 return; 384 return;
385 } 385 }
386 frame = skb->data; 386 frame = skb->data;
387 387
388 /* 388 /*
389 * Check return code and print it if not success 389 * Check return code and print it if not success
390 */ 390 */
391 if (frame[0]) { 391 if (frame[0]) {
392 print_ret_code(frame[0]); 392 print_ret_code(frame[0]);
393 return; 393 return;
394 } 394 }
395 395
396 name = kmalloc(255, GFP_ATOMIC); 396 name = kmalloc(255, GFP_ATOMIC);
397 if (!name) 397 if (!name)
398 return; 398 return;
@@ -406,11 +406,11 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb)
406 count = frame[1]; 406 count = frame[1];
407 407
408 IRDA_DEBUG(4, "%s(), got %d parameters\n", __FUNCTION__ , count); 408 IRDA_DEBUG(4, "%s(), got %d parameters\n", __FUNCTION__ , count);
409 409
410 ptr = frame+2; 410 ptr = frame+2;
411 411
412 /* For all parameters */ 412 /* For all parameters */
413 for (i=0; i<count;i++) { 413 for (i=0; i<count;i++) {
414 ret = irlan_extract_param(ptr, name, value, &val_len); 414 ret = irlan_extract_param(ptr, name, value, &val_len);
415 if (ret < 0) { 415 if (ret < 0) {
416 IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ ); 416 IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ );
@@ -418,7 +418,7 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb)
418 } 418 }
419 ptr += ret; 419 ptr += ret;
420 irlan_check_response_param(self, name, value, val_len); 420 irlan_check_response_param(self, name, value, val_len);
421 } 421 }
422 /* Cleanup */ 422 /* Cleanup */
423 kfree(name); 423 kfree(name);
424 kfree(value); 424 kfree(value);
@@ -430,8 +430,8 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb)
430 * Check which parameter is received and update local variables 430 * Check which parameter is received and update local variables
431 * 431 *
432 */ 432 */
433static void irlan_check_response_param(struct irlan_cb *self, char *param, 433static void irlan_check_response_param(struct irlan_cb *self, char *param,
434 char *value, int val_len) 434 char *value, int val_len)
435{ 435{
436 __u16 tmp_cpu; /* Temporary value in host order */ 436 __u16 tmp_cpu; /* Temporary value in host order */
437 __u8 *bytes; 437 __u8 *bytes;
@@ -465,7 +465,7 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param,
465 self->client.filter_type |= IRLAN_BROADCAST; 465 self->client.filter_type |= IRLAN_BROADCAST;
466 else if (strcmp(value, "IPX_SOCKET") == 0) 466 else if (strcmp(value, "IPX_SOCKET") == 0)
467 self->client.filter_type |= IRLAN_IPX_SOCKET; 467 self->client.filter_type |= IRLAN_IPX_SOCKET;
468 468
469 } 469 }
470 if (strcmp(param, "ACCESS_TYPE") == 0) { 470 if (strcmp(param, "ACCESS_TYPE") == 0) {
471 if (strcmp(value, "DIRECT") == 0) 471 if (strcmp(value, "DIRECT") == 0)
@@ -480,7 +480,7 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param,
480 } 480 }
481 /* IRLAN version */ 481 /* IRLAN version */
482 if (strcmp(param, "IRLAN_VER") == 0) { 482 if (strcmp(param, "IRLAN_VER") == 0) {
483 IRDA_DEBUG(4, "IrLAN version %d.%d\n", (__u8) value[0], 483 IRDA_DEBUG(4, "IrLAN version %d.%d\n", (__u8) value[0],
484 (__u8) value[1]); 484 (__u8) value[1]);
485 485
486 self->version[0] = value[0]; 486 self->version[0] = value[0];
@@ -497,17 +497,17 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param,
497 memcpy(&tmp_cpu, value, 2); /* Align value */ 497 memcpy(&tmp_cpu, value, 2); /* Align value */
498 le16_to_cpus(&tmp_cpu); /* Convert to host order */ 498 le16_to_cpus(&tmp_cpu); /* Convert to host order */
499 self->client.recv_arb_val = tmp_cpu; 499 self->client.recv_arb_val = tmp_cpu;
500 IRDA_DEBUG(2, "%s(), receive arb val=%d\n", __FUNCTION__ , 500 IRDA_DEBUG(2, "%s(), receive arb val=%d\n", __FUNCTION__ ,
501 self->client.recv_arb_val); 501 self->client.recv_arb_val);
502 } 502 }
503 if (strcmp(param, "MAX_FRAME") == 0) { 503 if (strcmp(param, "MAX_FRAME") == 0) {
504 memcpy(&tmp_cpu, value, 2); /* Align value */ 504 memcpy(&tmp_cpu, value, 2); /* Align value */
505 le16_to_cpus(&tmp_cpu); /* Convert to host order */ 505 le16_to_cpus(&tmp_cpu); /* Convert to host order */
506 self->client.max_frame = tmp_cpu; 506 self->client.max_frame = tmp_cpu;
507 IRDA_DEBUG(4, "%s(), max frame=%d\n", __FUNCTION__ , 507 IRDA_DEBUG(4, "%s(), max frame=%d\n", __FUNCTION__ ,
508 self->client.max_frame); 508 self->client.max_frame);
509 } 509 }
510 510
511 /* RECONNECT_KEY, in case the link goes down! */ 511 /* RECONNECT_KEY, in case the link goes down! */
512 if (strcmp(param, "RECONNECT_KEY") == 0) { 512 if (strcmp(param, "RECONNECT_KEY") == 0) {
513 IRDA_DEBUG(4, "Got reconnect key: "); 513 IRDA_DEBUG(4, "Got reconnect key: ");
@@ -521,9 +521,9 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param,
521 if (strcmp(param, "FILTER_ENTRY") == 0) { 521 if (strcmp(param, "FILTER_ENTRY") == 0) {
522 bytes = value; 522 bytes = value;
523 IRDA_DEBUG(4, "Ethernet address = %02x:%02x:%02x:%02x:%02x:%02x\n", 523 IRDA_DEBUG(4, "Ethernet address = %02x:%02x:%02x:%02x:%02x:%02x\n",
524 bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], 524 bytes[0], bytes[1], bytes[2], bytes[3], bytes[4],
525 bytes[5]); 525 bytes[5]);
526 for (i = 0; i < 6; i++) 526 for (i = 0; i < 6; i++)
527 self->dev->dev_addr[i] = bytes[i]; 527 self->dev->dev_addr[i] = bytes[i];
528 } 528 }
529} 529}
@@ -534,11 +534,11 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param,
534 * Got results from remote LM-IAS 534 * Got results from remote LM-IAS
535 * 535 *
536 */ 536 */
537void irlan_client_get_value_confirm(int result, __u16 obj_id, 537void irlan_client_get_value_confirm(int result, __u16 obj_id,
538 struct ias_value *value, void *priv) 538 struct ias_value *value, void *priv)
539{ 539{
540 struct irlan_cb *self; 540 struct irlan_cb *self;
541 541
542 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 542 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
543 543
544 IRDA_ASSERT(priv != NULL, return;); 544 IRDA_ASSERT(priv != NULL, return;);
@@ -553,7 +553,7 @@ void irlan_client_get_value_confirm(int result, __u16 obj_id,
553 /* Check if request succeeded */ 553 /* Check if request succeeded */
554 if (result != IAS_SUCCESS) { 554 if (result != IAS_SUCCESS) {
555 IRDA_DEBUG(2, "%s(), got NULL value!\n", __FUNCTION__ ); 555 IRDA_DEBUG(2, "%s(), got NULL value!\n", __FUNCTION__ );
556 irlan_do_client_event(self, IRLAN_IAS_PROVIDER_NOT_AVAIL, 556 irlan_do_client_event(self, IRLAN_IAS_PROVIDER_NOT_AVAIL,
557 NULL); 557 NULL);
558 return; 558 return;
559 } 559 }
diff --git a/net/irda/irlan/irlan_client_event.c b/net/irda/irlan/irlan_client_event.c
index ce943b69e996..843ab6fbb394 100644
--- a/net/irda/irlan/irlan_client_event.c
+++ b/net/irda/irlan/irlan_client_event.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irlan_client_event.c 3 * Filename: irlan_client_event.c
4 * Version: 0.9 4 * Version: 0.9
5 * Description: IrLAN client state machine 5 * Description: IrLAN client state machine
@@ -8,17 +8,17 @@
8 * Created at: Sun Aug 31 20:14:37 1997 8 * Created at: Sun Aug 31 20:14:37 1997
9 * Modified at: Sun Dec 26 21:52:24 1999 9 * Modified at: Sun Dec 26 21:52:24 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, 12 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
13 * All Rights Reserved. 13 * All Rights Reserved.
14 * 14 *
15 * This program is free software; you can redistribute it and/or 15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as 16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * Neither Dag Brattli nor University of Tromsų admit liability nor 20 * Neither Dag Brattli nor University of Tromsų admit liability nor
21 * provide warranty for any of this software. This material is 21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge. 22 * provided "AS-IS" and at no charge.
23 * 23 *
24 ********************************************************************/ 24 ********************************************************************/
@@ -36,31 +36,31 @@
36#include <net/irda/irlan_client.h> 36#include <net/irda/irlan_client.h>
37#include <net/irda/irlan_event.h> 37#include <net/irda/irlan_event.h>
38 38
39static int irlan_client_state_idle (struct irlan_cb *self, IRLAN_EVENT event, 39static int irlan_client_state_idle (struct irlan_cb *self, IRLAN_EVENT event,
40 struct sk_buff *skb); 40 struct sk_buff *skb);
41static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, 41static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event,
42 struct sk_buff *skb); 42 struct sk_buff *skb);
43static int irlan_client_state_conn (struct irlan_cb *self, IRLAN_EVENT event, 43static int irlan_client_state_conn (struct irlan_cb *self, IRLAN_EVENT event,
44 struct sk_buff *skb); 44 struct sk_buff *skb);
45static int irlan_client_state_info (struct irlan_cb *self, IRLAN_EVENT event, 45static int irlan_client_state_info (struct irlan_cb *self, IRLAN_EVENT event,
46 struct sk_buff *skb); 46 struct sk_buff *skb);
47static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, 47static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event,
48 struct sk_buff *skb); 48 struct sk_buff *skb);
49static int irlan_client_state_open (struct irlan_cb *self, IRLAN_EVENT event, 49static int irlan_client_state_open (struct irlan_cb *self, IRLAN_EVENT event,
50 struct sk_buff *skb); 50 struct sk_buff *skb);
51static int irlan_client_state_wait (struct irlan_cb *self, IRLAN_EVENT event, 51static int irlan_client_state_wait (struct irlan_cb *self, IRLAN_EVENT event,
52 struct sk_buff *skb); 52 struct sk_buff *skb);
53static int irlan_client_state_arb (struct irlan_cb *self, IRLAN_EVENT event, 53static int irlan_client_state_arb (struct irlan_cb *self, IRLAN_EVENT event,
54 struct sk_buff *skb); 54 struct sk_buff *skb);
55static int irlan_client_state_data (struct irlan_cb *self, IRLAN_EVENT event, 55static int irlan_client_state_data (struct irlan_cb *self, IRLAN_EVENT event,
56 struct sk_buff *skb); 56 struct sk_buff *skb);
57static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, 57static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event,
58 struct sk_buff *skb); 58 struct sk_buff *skb);
59static int irlan_client_state_sync (struct irlan_cb *self, IRLAN_EVENT event, 59static int irlan_client_state_sync (struct irlan_cb *self, IRLAN_EVENT event,
60 struct sk_buff *skb); 60 struct sk_buff *skb);
61 61
62static int (*state[])(struct irlan_cb *, IRLAN_EVENT event, struct sk_buff *) = 62static int (*state[])(struct irlan_cb *, IRLAN_EVENT event, struct sk_buff *) =
63{ 63{
64 irlan_client_state_idle, 64 irlan_client_state_idle,
65 irlan_client_state_query, 65 irlan_client_state_query,
66 irlan_client_state_conn, 66 irlan_client_state_conn,
@@ -74,8 +74,8 @@ static int (*state[])(struct irlan_cb *, IRLAN_EVENT event, struct sk_buff *) =
74 irlan_client_state_sync 74 irlan_client_state_sync
75}; 75};
76 76
77void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, 77void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event,
78 struct sk_buff *skb) 78 struct sk_buff *skb)
79{ 79{
80 IRDA_ASSERT(self != NULL, return;); 80 IRDA_ASSERT(self != NULL, return;);
81 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 81 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -89,14 +89,14 @@ void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event,
89 * IDLE, We are waiting for an indication that there is a provider 89 * IDLE, We are waiting for an indication that there is a provider
90 * available. 90 * available.
91 */ 91 */
92static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, 92static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event,
93 struct sk_buff *skb) 93 struct sk_buff *skb)
94{ 94{
95 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 95 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
96 96
97 IRDA_ASSERT(self != NULL, return -1;); 97 IRDA_ASSERT(self != NULL, return -1;);
98 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); 98 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;);
99 99
100 switch (event) { 100 switch (event) {
101 case IRLAN_DISCOVERY_INDICATION: 101 case IRLAN_DISCOVERY_INDICATION:
102 if (self->client.iriap) { 102 if (self->client.iriap) {
@@ -104,7 +104,7 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event,
104 __FUNCTION__); 104 __FUNCTION__);
105 return -EBUSY; 105 return -EBUSY;
106 } 106 }
107 107
108 self->client.iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, 108 self->client.iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
109 irlan_client_get_value_confirm); 109 irlan_client_get_value_confirm);
110 /* Get some values from peer IAS */ 110 /* Get some values from peer IAS */
@@ -120,7 +120,7 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event,
120 IRDA_DEBUG(4, "%s(), Unknown event %d\n", __FUNCTION__ , event); 120 IRDA_DEBUG(4, "%s(), Unknown event %d\n", __FUNCTION__ , event);
121 break; 121 break;
122 } 122 }
123 if (skb) 123 if (skb)
124 dev_kfree_skb(skb); 124 dev_kfree_skb(skb);
125 125
126 return 0; 126 return 0;
@@ -133,23 +133,23 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event,
133 * to provider, just waiting for the confirm. 133 * to provider, just waiting for the confirm.
134 * 134 *
135 */ 135 */
136static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, 136static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event,
137 struct sk_buff *skb) 137 struct sk_buff *skb)
138{ 138{
139 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 139 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
140 140
141 IRDA_ASSERT(self != NULL, return -1;); 141 IRDA_ASSERT(self != NULL, return -1;);
142 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); 142 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;);
143 143
144 switch(event) { 144 switch(event) {
145 case IRLAN_IAS_PROVIDER_AVAIL: 145 case IRLAN_IAS_PROVIDER_AVAIL:
146 IRDA_ASSERT(self->dtsap_sel_ctrl != 0, return -1;); 146 IRDA_ASSERT(self->dtsap_sel_ctrl != 0, return -1;);
147 147
148 self->client.open_retries = 0; 148 self->client.open_retries = 0;
149 149
150 irttp_connect_request(self->client.tsap_ctrl, 150 irttp_connect_request(self->client.tsap_ctrl,
151 self->dtsap_sel_ctrl, 151 self->dtsap_sel_ctrl,
152 self->saddr, self->daddr, NULL, 152 self->saddr, self->daddr, NULL,
153 IRLAN_MTU, NULL); 153 IRLAN_MTU, NULL);
154 irlan_next_client_state(self, IRLAN_CONN); 154 irlan_next_client_state(self, IRLAN_CONN);
155 break; 155 break;
@@ -158,7 +158,7 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event,
158 irlan_next_client_state(self, IRLAN_IDLE); 158 irlan_next_client_state(self, IRLAN_IDLE);
159 159
160 /* Give the client a kick! */ 160 /* Give the client a kick! */
161 if ((self->provider.access_type == ACCESS_PEER) && 161 if ((self->provider.access_type == ACCESS_PEER) &&
162 (self->provider.state != IRLAN_IDLE)) 162 (self->provider.state != IRLAN_IDLE))
163 irlan_client_wakeup(self, self->saddr, self->daddr); 163 irlan_client_wakeup(self, self->saddr, self->daddr);
164 break; 164 break;
@@ -175,7 +175,7 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event,
175 } 175 }
176 if (skb) 176 if (skb)
177 dev_kfree_skb(skb); 177 dev_kfree_skb(skb);
178 178
179 return 0; 179 return 0;
180} 180}
181 181
@@ -186,13 +186,13 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event,
186 * commands yet. 186 * commands yet.
187 * 187 *
188 */ 188 */
189static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, 189static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event,
190 struct sk_buff *skb) 190 struct sk_buff *skb)
191{ 191{
192 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 192 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
193 193
194 IRDA_ASSERT(self != NULL, return -1;); 194 IRDA_ASSERT(self != NULL, return -1;);
195 195
196 switch (event) { 196 switch (event) {
197 case IRLAN_CONNECT_COMPLETE: 197 case IRLAN_CONNECT_COMPLETE:
198 /* Send getinfo cmd */ 198 /* Send getinfo cmd */
@@ -212,7 +212,7 @@ static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event,
212 } 212 }
213 if (skb) 213 if (skb)
214 dev_kfree_skb(skb); 214 dev_kfree_skb(skb);
215 215
216 return 0; 216 return 0;
217} 217}
218 218
@@ -221,24 +221,24 @@ static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event,
221 * 221 *
222 * INFO, We have issued a GetInfo command and is awaiting a reply. 222 * INFO, We have issued a GetInfo command and is awaiting a reply.
223 */ 223 */
224static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, 224static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event,
225 struct sk_buff *skb) 225 struct sk_buff *skb)
226{ 226{
227 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 227 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
228 228
229 IRDA_ASSERT(self != NULL, return -1;); 229 IRDA_ASSERT(self != NULL, return -1;);
230 230
231 switch (event) { 231 switch (event) {
232 case IRLAN_DATA_INDICATION: 232 case IRLAN_DATA_INDICATION:
233 IRDA_ASSERT(skb != NULL, return -1;); 233 IRDA_ASSERT(skb != NULL, return -1;);
234 234
235 irlan_client_parse_response(self, skb); 235 irlan_client_parse_response(self, skb);
236 236
237 irlan_next_client_state(self, IRLAN_MEDIA); 237 irlan_next_client_state(self, IRLAN_MEDIA);
238 238
239 irlan_get_media_char(self); 239 irlan_get_media_char(self);
240 break; 240 break;
241 241
242 case IRLAN_LMP_DISCONNECT: 242 case IRLAN_LMP_DISCONNECT:
243 case IRLAN_LAP_DISCONNECT: 243 case IRLAN_LAP_DISCONNECT:
244 irlan_next_client_state(self, IRLAN_IDLE); 244 irlan_next_client_state(self, IRLAN_IDLE);
@@ -252,7 +252,7 @@ static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event,
252 } 252 }
253 if (skb) 253 if (skb)
254 dev_kfree_skb(skb); 254 dev_kfree_skb(skb);
255 255
256 return 0; 256 return 0;
257} 257}
258 258
@@ -263,11 +263,11 @@ static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event,
263 * reply. 263 * reply.
264 * 264 *
265 */ 265 */
266static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, 266static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event,
267 struct sk_buff *skb) 267 struct sk_buff *skb)
268{ 268{
269 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 269 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
270 270
271 IRDA_ASSERT(self != NULL, return -1;); 271 IRDA_ASSERT(self != NULL, return -1;);
272 272
273 switch(event) { 273 switch(event) {
@@ -289,7 +289,7 @@ static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event,
289 } 289 }
290 if (skb) 290 if (skb)
291 dev_kfree_skb(skb); 291 dev_kfree_skb(skb);
292 292
293 return 0; 293 return 0;
294} 294}
295 295
@@ -300,47 +300,47 @@ static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event,
300 * reply 300 * reply
301 * 301 *
302 */ 302 */
303static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, 303static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event,
304 struct sk_buff *skb) 304 struct sk_buff *skb)
305{ 305{
306 struct qos_info qos; 306 struct qos_info qos;
307 307
308 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 308 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
309 309
310 IRDA_ASSERT(self != NULL, return -1;); 310 IRDA_ASSERT(self != NULL, return -1;);
311 311
312 switch(event) { 312 switch(event) {
313 case IRLAN_DATA_INDICATION: 313 case IRLAN_DATA_INDICATION:
314 irlan_client_parse_response(self, skb); 314 irlan_client_parse_response(self, skb);
315 315
316 /* 316 /*
317 * Check if we have got the remote TSAP for data 317 * Check if we have got the remote TSAP for data
318 * communications 318 * communications
319 */ 319 */
320 IRDA_ASSERT(self->dtsap_sel_data != 0, return -1;); 320 IRDA_ASSERT(self->dtsap_sel_data != 0, return -1;);
321 321
322 /* Check which access type we are dealing with */ 322 /* Check which access type we are dealing with */
323 switch (self->client.access_type) { 323 switch (self->client.access_type) {
324 case ACCESS_PEER: 324 case ACCESS_PEER:
325 if (self->provider.state == IRLAN_OPEN) { 325 if (self->provider.state == IRLAN_OPEN) {
326 326
327 irlan_next_client_state(self, IRLAN_ARB); 327 irlan_next_client_state(self, IRLAN_ARB);
328 irlan_do_client_event(self, IRLAN_CHECK_CON_ARB, 328 irlan_do_client_event(self, IRLAN_CHECK_CON_ARB,
329 NULL); 329 NULL);
330 } else { 330 } else {
331 331
332 irlan_next_client_state(self, IRLAN_WAIT); 332 irlan_next_client_state(self, IRLAN_WAIT);
333 } 333 }
334 break; 334 break;
335 case ACCESS_DIRECT: 335 case ACCESS_DIRECT:
336 case ACCESS_HOSTED: 336 case ACCESS_HOSTED:
337 qos.link_disc_time.bits = 0x01; /* 3 secs */ 337 qos.link_disc_time.bits = 0x01; /* 3 secs */
338 338
339 irttp_connect_request(self->tsap_data, 339 irttp_connect_request(self->tsap_data,
340 self->dtsap_sel_data, 340 self->dtsap_sel_data,
341 self->saddr, self->daddr, &qos, 341 self->saddr, self->daddr, &qos,
342 IRLAN_MTU, NULL); 342 IRLAN_MTU, NULL);
343 343
344 irlan_next_client_state(self, IRLAN_DATA); 344 irlan_next_client_state(self, IRLAN_DATA);
345 break; 345 break;
346 default: 346 default:
@@ -359,7 +359,7 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event,
359 IRDA_DEBUG(2, "%s(), Unknown event %d\n", __FUNCTION__ , event); 359 IRDA_DEBUG(2, "%s(), Unknown event %d\n", __FUNCTION__ , event);
360 break; 360 break;
361 } 361 }
362 362
363 if (skb) 363 if (skb)
364 dev_kfree_skb(skb); 364 dev_kfree_skb(skb);
365 365
@@ -373,13 +373,13 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event,
373 * provider OPEN state. 373 * provider OPEN state.
374 * 374 *
375 */ 375 */
376static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, 376static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event,
377 struct sk_buff *skb) 377 struct sk_buff *skb)
378{ 378{
379 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 379 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
380 380
381 IRDA_ASSERT(self != NULL, return -1;); 381 IRDA_ASSERT(self != NULL, return -1;);
382 382
383 switch(event) { 383 switch(event) {
384 case IRLAN_PROVIDER_SIGNAL: 384 case IRLAN_PROVIDER_SIGNAL:
385 irlan_next_client_state(self, IRLAN_ARB); 385 irlan_next_client_state(self, IRLAN_ARB);
@@ -398,36 +398,36 @@ static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event,
398 } 398 }
399 if (skb) 399 if (skb)
400 dev_kfree_skb(skb); 400 dev_kfree_skb(skb);
401 401
402 return 0; 402 return 0;
403} 403}
404 404
405static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, 405static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event,
406 struct sk_buff *skb) 406 struct sk_buff *skb)
407{ 407{
408 struct qos_info qos; 408 struct qos_info qos;
409 409
410 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 410 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
411 411
412 IRDA_ASSERT(self != NULL, return -1;); 412 IRDA_ASSERT(self != NULL, return -1;);
413 413
414 switch(event) { 414 switch(event) {
415 case IRLAN_CHECK_CON_ARB: 415 case IRLAN_CHECK_CON_ARB:
416 if (self->client.recv_arb_val == self->provider.send_arb_val) { 416 if (self->client.recv_arb_val == self->provider.send_arb_val) {
417 irlan_next_client_state(self, IRLAN_CLOSE); 417 irlan_next_client_state(self, IRLAN_CLOSE);
418 irlan_close_data_channel(self); 418 irlan_close_data_channel(self);
419 } else if (self->client.recv_arb_val < 419 } else if (self->client.recv_arb_val <
420 self->provider.send_arb_val) 420 self->provider.send_arb_val)
421 { 421 {
422 qos.link_disc_time.bits = 0x01; /* 3 secs */ 422 qos.link_disc_time.bits = 0x01; /* 3 secs */
423 423
424 irlan_next_client_state(self, IRLAN_DATA); 424 irlan_next_client_state(self, IRLAN_DATA);
425 irttp_connect_request(self->tsap_data, 425 irttp_connect_request(self->tsap_data,
426 self->dtsap_sel_data, 426 self->dtsap_sel_data,
427 self->saddr, self->daddr, &qos, 427 self->saddr, self->daddr, &qos,
428 IRLAN_MTU, NULL); 428 IRLAN_MTU, NULL);
429 } else if (self->client.recv_arb_val > 429 } else if (self->client.recv_arb_val >
430 self->provider.send_arb_val) 430 self->provider.send_arb_val)
431 { 431 {
432 IRDA_DEBUG(2, "%s(), lost the battle :-(\n", __FUNCTION__ ); 432 IRDA_DEBUG(2, "%s(), lost the battle :-(\n", __FUNCTION__ );
433 } 433 }
@@ -448,7 +448,7 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event,
448 } 448 }
449 if (skb) 449 if (skb)
450 dev_kfree_skb(skb); 450 dev_kfree_skb(skb);
451 451
452 return 0; 452 return 0;
453} 453}
454 454
@@ -459,8 +459,8 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event,
459 * the local and remote machines. 459 * the local and remote machines.
460 * 460 *
461 */ 461 */
462static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, 462static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event,
463 struct sk_buff *skb) 463 struct sk_buff *skb)
464{ 464{
465 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 465 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
466 466
@@ -470,7 +470,7 @@ static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event,
470 switch(event) { 470 switch(event) {
471 case IRLAN_DATA_INDICATION: 471 case IRLAN_DATA_INDICATION:
472 irlan_client_parse_response(self, skb); 472 irlan_client_parse_response(self, skb);
473 break; 473 break;
474 case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */ 474 case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */
475 case IRLAN_LAP_DISCONNECT: 475 case IRLAN_LAP_DISCONNECT:
476 irlan_next_client_state(self, IRLAN_IDLE); 476 irlan_next_client_state(self, IRLAN_IDLE);
@@ -481,18 +481,18 @@ static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event,
481 } 481 }
482 if (skb) 482 if (skb)
483 dev_kfree_skb(skb); 483 dev_kfree_skb(skb);
484 484
485 return 0; 485 return 0;
486} 486}
487 487
488/* 488/*
489 * Function irlan_client_state_close (self, event, skb, info) 489 * Function irlan_client_state_close (self, event, skb, info)
490 * 490 *
491 * 491 *
492 * 492 *
493 */ 493 */
494static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, 494static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event,
495 struct sk_buff *skb) 495 struct sk_buff *skb)
496{ 496{
497 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 497 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
498 498
@@ -505,17 +505,17 @@ static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event,
505/* 505/*
506 * Function irlan_client_state_sync (self, event, skb, info) 506 * Function irlan_client_state_sync (self, event, skb, info)
507 * 507 *
508 * 508 *
509 * 509 *
510 */ 510 */
511static int irlan_client_state_sync(struct irlan_cb *self, IRLAN_EVENT event, 511static int irlan_client_state_sync(struct irlan_cb *self, IRLAN_EVENT event,
512 struct sk_buff *skb) 512 struct sk_buff *skb)
513{ 513{
514 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 514 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
515 515
516 if (skb) 516 if (skb)
517 dev_kfree_skb(skb); 517 dev_kfree_skb(skb);
518 518
519 return 0; 519 return 0;
520} 520}
521 521
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c
index 310776dd6109..9c3dc57ff746 100644
--- a/net/irda/irlan/irlan_common.c
+++ b/net/irda/irlan/irlan_common.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irlan_common.c 3 * Filename: irlan_common.c
4 * Version: 0.9 4 * Version: 0.9
5 * Description: IrDA LAN Access Protocol Implementation 5 * Description: IrDA LAN Access Protocol Implementation
@@ -8,17 +8,17 @@
8 * Created at: Sun Aug 31 20:14:37 1997 8 * Created at: Sun Aug 31 20:14:37 1997
9 * Modified at: Sun Dec 26 21:53:10 1999 9 * Modified at: Sun Dec 26 21:53:10 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, 12 * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>,
13 * All Rights Reserved. 13 * All Rights Reserved.
14 * 14 *
15 * This program is free software; you can redistribute it and/or 15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as 16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * Neither Dag Brattli nor University of Tromsų admit liability nor 20 * Neither Dag Brattli nor University of Tromsų admit liability nor
21 * provide warranty for any of this software. This material is 21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge. 22 * provided "AS-IS" and at no charge.
23 * 23 *
24 ********************************************************************/ 24 ********************************************************************/
@@ -49,12 +49,12 @@
49 49
50#include <net/irda/irlan_common.h> 50#include <net/irda/irlan_common.h>
51#include <net/irda/irlan_client.h> 51#include <net/irda/irlan_client.h>
52#include <net/irda/irlan_provider.h> 52#include <net/irda/irlan_provider.h>
53#include <net/irda/irlan_eth.h> 53#include <net/irda/irlan_eth.h>
54#include <net/irda/irlan_filter.h> 54#include <net/irda/irlan_filter.h>
55 55
56 56
57/* 57/*
58 * Send gratuitous ARP when connected to a new AP or not. May be a clever 58 * Send gratuitous ARP when connected to a new AP or not. May be a clever
59 * thing to do, but for some reason the machine crashes if you use DHCP. So 59 * thing to do, but for some reason the machine crashes if you use DHCP. So
60 * lets not use it by default. 60 * lets not use it by default.
@@ -106,8 +106,8 @@ extern struct proc_dir_entry *proc_irda;
106 106
107static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr); 107static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr);
108static void __irlan_close(struct irlan_cb *self); 108static void __irlan_close(struct irlan_cb *self);
109static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, 109static int __irlan_insert_param(struct sk_buff *skb, char *param, int type,
110 __u8 value_byte, __u16 value_short, 110 __u8 value_byte, __u16 value_short,
111 __u8 *value_array, __u16 value_len); 111 __u8 *value_array, __u16 value_len);
112static void irlan_open_unicast_addr(struct irlan_cb *self); 112static void irlan_open_unicast_addr(struct irlan_cb *self);
113static void irlan_get_unicast_addr(struct irlan_cb *self); 113static void irlan_get_unicast_addr(struct irlan_cb *self);
@@ -177,7 +177,7 @@ err_ckey:
177 return -ENOMEM; 177 return -ENOMEM;
178} 178}
179 179
180static void __exit irlan_cleanup(void) 180static void __exit irlan_cleanup(void)
181{ 181{
182 struct irlan_cb *self, *next; 182 struct irlan_cb *self, *next;
183 183
@@ -201,7 +201,7 @@ static void __exit irlan_cleanup(void)
201/* 201/*
202 * Function irlan_open (void) 202 * Function irlan_open (void)
203 * 203 *
204 * Open new instance of a client/provider, we should only register the 204 * Open new instance of a client/provider, we should only register the
205 * network device if this instance is ment for a particular client/provider 205 * network device if this instance is ment for a particular client/provider
206 */ 206 */
207static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) 207static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr)
@@ -229,9 +229,9 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr)
229 /* Provider access can only be PEER, DIRECT, or HOSTED */ 229 /* Provider access can only be PEER, DIRECT, or HOSTED */
230 self->provider.access_type = access; 230 self->provider.access_type = access;
231 if (access == ACCESS_DIRECT) { 231 if (access == ACCESS_DIRECT) {
232 /* 232 /*
233 * Since we are emulating an IrLAN sever we will have to 233 * Since we are emulating an IrLAN sever we will have to
234 * give ourself an ethernet address! 234 * give ourself an ethernet address!
235 */ 235 */
236 dev->dev_addr[0] = 0x40; 236 dev->dev_addr[0] = 0x40;
237 dev->dev_addr[1] = 0x00; 237 dev->dev_addr[1] = 0x00;
@@ -245,15 +245,15 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr)
245 self->disconnect_reason = LM_USER_REQUEST; 245 self->disconnect_reason = LM_USER_REQUEST;
246 init_timer(&self->watchdog_timer); 246 init_timer(&self->watchdog_timer);
247 init_timer(&self->client.kick_timer); 247 init_timer(&self->client.kick_timer);
248 init_waitqueue_head(&self->open_wait); 248 init_waitqueue_head(&self->open_wait);
249 249
250 skb_queue_head_init(&self->client.txq); 250 skb_queue_head_init(&self->client.txq);
251 251
252 irlan_next_client_state(self, IRLAN_IDLE); 252 irlan_next_client_state(self, IRLAN_IDLE);
253 irlan_next_provider_state(self, IRLAN_IDLE); 253 irlan_next_provider_state(self, IRLAN_IDLE);
254 254
255 if (register_netdev(dev)) { 255 if (register_netdev(dev)) {
256 IRDA_DEBUG(2, "%s(), register_netdev() failed!\n", 256 IRDA_DEBUG(2, "%s(), register_netdev() failed!\n",
257 __FUNCTION__ ); 257 __FUNCTION__ );
258 self = NULL; 258 self = NULL;
259 free_netdev(dev); 259 free_netdev(dev);
@@ -268,14 +268,14 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr)
268/* 268/*
269 * Function __irlan_close (self) 269 * Function __irlan_close (self)
270 * 270 *
271 * This function closes and deallocates the IrLAN client instances. Be 271 * This function closes and deallocates the IrLAN client instances. Be
272 * aware that other functions which calls client_close() must 272 * aware that other functions which calls client_close() must
273 * remove self from irlans list first. 273 * remove self from irlans list first.
274 */ 274 */
275static void __irlan_close(struct irlan_cb *self) 275static void __irlan_close(struct irlan_cb *self)
276{ 276{
277 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 277 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
278 278
279 ASSERT_RTNL(); 279 ASSERT_RTNL();
280 IRDA_ASSERT(self != NULL, return;); 280 IRDA_ASSERT(self != NULL, return;);
281 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 281 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -285,8 +285,8 @@ static void __irlan_close(struct irlan_cb *self)
285 285
286 /* Close all open connections and remove TSAPs */ 286 /* Close all open connections and remove TSAPs */
287 irlan_close_tsaps(self); 287 irlan_close_tsaps(self);
288 288
289 if (self->client.iriap) 289 if (self->client.iriap)
290 iriap_close(self->client.iriap); 290 iriap_close(self->client.iriap);
291 291
292 /* Remove frames queued on the control channel */ 292 /* Remove frames queued on the control channel */
@@ -316,17 +316,17 @@ struct irlan_cb *irlan_get_any(void)
316static void irlan_connect_indication(void *instance, void *sap, 316static void irlan_connect_indication(void *instance, void *sap,
317 struct qos_info *qos, 317 struct qos_info *qos,
318 __u32 max_sdu_size, 318 __u32 max_sdu_size,
319 __u8 max_header_size, 319 __u8 max_header_size,
320 struct sk_buff *skb) 320 struct sk_buff *skb)
321{ 321{
322 struct irlan_cb *self; 322 struct irlan_cb *self;
323 struct tsap_cb *tsap; 323 struct tsap_cb *tsap;
324 324
325 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 325 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
326 326
327 self = (struct irlan_cb *) instance; 327 self = (struct irlan_cb *) instance;
328 tsap = (struct tsap_cb *) sap; 328 tsap = (struct tsap_cb *) sap;
329 329
330 IRDA_ASSERT(self != NULL, return;); 330 IRDA_ASSERT(self != NULL, return;);
331 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 331 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
332 IRDA_ASSERT(tsap == self->tsap_data,return;); 332 IRDA_ASSERT(tsap == self->tsap_data,return;);
@@ -349,9 +349,9 @@ static void irlan_connect_indication(void *instance, void *sap,
349 irlan_do_client_event(self, IRLAN_DATA_CONNECT_INDICATION, NULL); 349 irlan_do_client_event(self, IRLAN_DATA_CONNECT_INDICATION, NULL);
350 350
351 if (self->provider.access_type == ACCESS_PEER) { 351 if (self->provider.access_type == ACCESS_PEER) {
352 /* 352 /*
353 * Data channel is open, so we are now allowed to 353 * Data channel is open, so we are now allowed to
354 * configure the remote filter 354 * configure the remote filter
355 */ 355 */
356 irlan_get_unicast_addr(self); 356 irlan_get_unicast_addr(self);
357 irlan_open_unicast_addr(self); 357 irlan_open_unicast_addr(self);
@@ -361,10 +361,10 @@ static void irlan_connect_indication(void *instance, void *sap,
361} 361}
362 362
363static void irlan_connect_confirm(void *instance, void *sap, 363static void irlan_connect_confirm(void *instance, void *sap,
364 struct qos_info *qos, 364 struct qos_info *qos,
365 __u32 max_sdu_size, 365 __u32 max_sdu_size,
366 __u8 max_header_size, 366 __u8 max_header_size,
367 struct sk_buff *skb) 367 struct sk_buff *skb)
368{ 368{
369 struct irlan_cb *self; 369 struct irlan_cb *self;
370 370
@@ -381,16 +381,16 @@ static void irlan_connect_confirm(void *instance, void *sap,
381 IRDA_DEBUG(0, "%s: We are now connected!\n", __FUNCTION__); 381 IRDA_DEBUG(0, "%s: We are now connected!\n", __FUNCTION__);
382 del_timer(&self->watchdog_timer); 382 del_timer(&self->watchdog_timer);
383 383
384 /* 384 /*
385 * Data channel is open, so we are now allowed to configure the remote 385 * Data channel is open, so we are now allowed to configure the remote
386 * filter 386 * filter
387 */ 387 */
388 irlan_get_unicast_addr(self); 388 irlan_get_unicast_addr(self);
389 irlan_open_unicast_addr(self); 389 irlan_open_unicast_addr(self);
390 390
391 /* Open broadcast and multicast filter by default */ 391 /* Open broadcast and multicast filter by default */
392 irlan_set_broadcast_filter(self, TRUE); 392 irlan_set_broadcast_filter(self, TRUE);
393 irlan_set_multicast_filter(self, TRUE); 393 irlan_set_multicast_filter(self, TRUE);
394 394
395 /* Ready to transfer Ethernet frames */ 395 /* Ready to transfer Ethernet frames */
396 netif_start_queue(self->dev); 396 netif_start_queue(self->dev);
@@ -408,29 +408,29 @@ static void irlan_connect_confirm(void *instance, void *sap,
408 * the specified connection (handle) 408 * the specified connection (handle)
409 */ 409 */
410static void irlan_disconnect_indication(void *instance, 410static void irlan_disconnect_indication(void *instance,
411 void *sap, LM_REASON reason, 411 void *sap, LM_REASON reason,
412 struct sk_buff *userdata) 412 struct sk_buff *userdata)
413{ 413{
414 struct irlan_cb *self; 414 struct irlan_cb *self;
415 struct tsap_cb *tsap; 415 struct tsap_cb *tsap;
416 416
417 IRDA_DEBUG(0, "%s(), reason=%d\n", __FUNCTION__ , reason); 417 IRDA_DEBUG(0, "%s(), reason=%d\n", __FUNCTION__ , reason);
418 418
419 self = (struct irlan_cb *) instance; 419 self = (struct irlan_cb *) instance;
420 tsap = (struct tsap_cb *) sap; 420 tsap = (struct tsap_cb *) sap;
421 421
422 IRDA_ASSERT(self != NULL, return;); 422 IRDA_ASSERT(self != NULL, return;);
423 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 423 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
424 IRDA_ASSERT(tsap != NULL, return;); 424 IRDA_ASSERT(tsap != NULL, return;);
425 IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); 425 IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;);
426 426
427 IRDA_ASSERT(tsap == self->tsap_data, return;); 427 IRDA_ASSERT(tsap == self->tsap_data, return;);
428 428
429 IRDA_DEBUG(2, "IrLAN, data channel disconnected by peer!\n"); 429 IRDA_DEBUG(2, "IrLAN, data channel disconnected by peer!\n");
430 430
431 /* Save reason so we know if we should try to reconnect or not */ 431 /* Save reason so we know if we should try to reconnect or not */
432 self->disconnect_reason = reason; 432 self->disconnect_reason = reason;
433 433
434 switch (reason) { 434 switch (reason) {
435 case LM_USER_REQUEST: /* User request */ 435 case LM_USER_REQUEST: /* User request */
436 IRDA_DEBUG(2, "%s(), User requested\n", __FUNCTION__ ); 436 IRDA_DEBUG(2, "%s(), User requested\n", __FUNCTION__ );
@@ -451,7 +451,7 @@ static void irlan_disconnect_indication(void *instance,
451 IRDA_ERROR("%s(), Unknown disconnect reason\n", __FUNCTION__); 451 IRDA_ERROR("%s(), Unknown disconnect reason\n", __FUNCTION__);
452 break; 452 break;
453 } 453 }
454 454
455 /* If you want to pass the skb to *both* state machines, you will 455 /* If you want to pass the skb to *both* state machines, you will
456 * need to skb_clone() it, so that you don't free it twice. 456 * need to skb_clone() it, so that you don't free it twice.
457 * As the state machines don't need it, git rid of it here... 457 * As the state machines don't need it, git rid of it here...
@@ -461,7 +461,7 @@ static void irlan_disconnect_indication(void *instance,
461 461
462 irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); 462 irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL);
463 irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); 463 irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL);
464 464
465 wake_up_interruptible(&self->open_wait); 465 wake_up_interruptible(&self->open_wait);
466} 466}
467 467
@@ -480,12 +480,12 @@ void irlan_open_data_tsap(struct irlan_cb *self)
480 return; 480 return;
481 481
482 irda_notify_init(&notify); 482 irda_notify_init(&notify);
483 483
484 notify.data_indication = irlan_eth_receive; 484 notify.data_indication = irlan_eth_receive;
485 notify.udata_indication = irlan_eth_receive; 485 notify.udata_indication = irlan_eth_receive;
486 notify.connect_indication = irlan_connect_indication; 486 notify.connect_indication = irlan_connect_indication;
487 notify.connect_confirm = irlan_connect_confirm; 487 notify.connect_confirm = irlan_connect_confirm;
488 notify.flow_indication = irlan_eth_flow_indication; 488 notify.flow_indication = irlan_eth_flow_indication;
489 notify.disconnect_indication = irlan_disconnect_indication; 489 notify.disconnect_indication = irlan_disconnect_indication;
490 notify.instance = self; 490 notify.instance = self;
491 strlcpy(notify.name, "IrLAN data", sizeof(notify.name)); 491 strlcpy(notify.name, "IrLAN data", sizeof(notify.name));
@@ -497,7 +497,7 @@ void irlan_open_data_tsap(struct irlan_cb *self)
497 } 497 }
498 self->tsap_data = tsap; 498 self->tsap_data = tsap;
499 499
500 /* 500 /*
501 * This is the data TSAP selector which we will pass to the client 501 * This is the data TSAP selector which we will pass to the client
502 * when the client ask for it. 502 * when the client ask for it.
503 */ 503 */
@@ -518,13 +518,13 @@ void irlan_close_tsaps(struct irlan_cb *self)
518 self->tsap_data = NULL; 518 self->tsap_data = NULL;
519 } 519 }
520 if (self->client.tsap_ctrl) { 520 if (self->client.tsap_ctrl) {
521 irttp_disconnect_request(self->client.tsap_ctrl, NULL, 521 irttp_disconnect_request(self->client.tsap_ctrl, NULL,
522 P_NORMAL); 522 P_NORMAL);
523 irttp_close_tsap(self->client.tsap_ctrl); 523 irttp_close_tsap(self->client.tsap_ctrl);
524 self->client.tsap_ctrl = NULL; 524 self->client.tsap_ctrl = NULL;
525 } 525 }
526 if (self->provider.tsap_ctrl) { 526 if (self->provider.tsap_ctrl) {
527 irttp_disconnect_request(self->provider.tsap_ctrl, NULL, 527 irttp_disconnect_request(self->provider.tsap_ctrl, NULL,
528 P_NORMAL); 528 P_NORMAL);
529 irttp_close_tsap(self->provider.tsap_ctrl); 529 irttp_close_tsap(self->provider.tsap_ctrl);
530 self->provider.tsap_ctrl = NULL; 530 self->provider.tsap_ctrl = NULL;
@@ -545,8 +545,8 @@ void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel)
545 545
546 IRDA_ASSERT(self != NULL, return;); 546 IRDA_ASSERT(self != NULL, return;);
547 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 547 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
548 548
549 /* 549 /*
550 * Check if object has already been registered by a previous provider. 550 * Check if object has already been registered by a previous provider.
551 * If that is the case, we just change the value of the attribute 551 * If that is the case, we just change the value of the attribute
552 */ 552 */
@@ -560,9 +560,9 @@ void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel)
560 irias_object_change_attribute("IrLAN", "IrDA:TinyTP:LsapSel", 560 irias_object_change_attribute("IrLAN", "IrDA:TinyTP:LsapSel",
561 new_value); 561 new_value);
562 } 562 }
563 563
564 /* Register PnP object only if not registered before */ 564 /* Register PnP object only if not registered before */
565 if (!irias_find_object("PnP")) { 565 if (!irias_find_object("PnP")) {
566 obj = irias_new_object("PnP", IAS_PNP_ID); 566 obj = irias_new_object("PnP", IAS_PNP_ID);
567#if 0 567#if 0
568 irias_add_string_attrib(obj, "Name", sysctl_devname, 568 irias_add_string_attrib(obj, "Name", sysctl_devname,
@@ -606,10 +606,10 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self)
606 self->client.tx_busy = FALSE; 606 self->client.tx_busy = FALSE;
607 return 0; 607 return 0;
608 } 608 }
609 609
610 /* Check that it's really possible to send commands */ 610 /* Check that it's really possible to send commands */
611 if ((self->client.tsap_ctrl == NULL) || 611 if ((self->client.tsap_ctrl == NULL) ||
612 (self->client.state == IRLAN_IDLE)) 612 (self->client.state == IRLAN_IDLE))
613 { 613 {
614 self->client.tx_busy = FALSE; 614 self->client.tx_busy = FALSE;
615 dev_kfree_skb(skb); 615 dev_kfree_skb(skb);
@@ -649,7 +649,7 @@ void irlan_get_provider_info(struct irlan_cb *self)
649 __u8 *frame; 649 __u8 *frame;
650 650
651 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 651 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
652 652
653 IRDA_ASSERT(self != NULL, return;); 653 IRDA_ASSERT(self != NULL, return;);
654 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 654 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
655 655
@@ -661,12 +661,12 @@ void irlan_get_provider_info(struct irlan_cb *self)
661 /* Reserve space for TTP, LMP, and LAP header */ 661 /* Reserve space for TTP, LMP, and LAP header */
662 skb_reserve(skb, self->client.max_header_size); 662 skb_reserve(skb, self->client.max_header_size);
663 skb_put(skb, 2); 663 skb_put(skb, 2);
664 664
665 frame = skb->data; 665 frame = skb->data;
666 666
667 frame[0] = CMD_GET_PROVIDER_INFO; 667 frame[0] = CMD_GET_PROVIDER_INFO;
668 frame[1] = 0x00; /* Zero parameters */ 668 frame[1] = 0x00; /* Zero parameters */
669 669
670 irlan_ctrl_data_request(self, skb); 670 irlan_ctrl_data_request(self, skb);
671} 671}
672 672
@@ -676,16 +676,16 @@ void irlan_get_provider_info(struct irlan_cb *self)
676 * Send an Open Data Command to provider 676 * Send an Open Data Command to provider
677 * 677 *
678 */ 678 */
679void irlan_open_data_channel(struct irlan_cb *self) 679void irlan_open_data_channel(struct irlan_cb *self)
680{ 680{
681 struct sk_buff *skb; 681 struct sk_buff *skb;
682 __u8 *frame; 682 __u8 *frame;
683 683
684 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 684 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
685 685
686 IRDA_ASSERT(self != NULL, return;); 686 IRDA_ASSERT(self != NULL, return;);
687 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 687 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
688 688
689 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + 689 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
690 IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3") + 690 IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3") +
691 IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "DIRECT"), 691 IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "DIRECT"),
@@ -695,11 +695,11 @@ void irlan_open_data_channel(struct irlan_cb *self)
695 695
696 skb_reserve(skb, self->client.max_header_size); 696 skb_reserve(skb, self->client.max_header_size);
697 skb_put(skb, 2); 697 skb_put(skb, 2);
698 698
699 frame = skb->data; 699 frame = skb->data;
700 700
701 /* Build frame */ 701 /* Build frame */
702 frame[0] = CMD_OPEN_DATA_CHANNEL; 702 frame[0] = CMD_OPEN_DATA_CHANNEL;
703 frame[1] = 0x02; /* Two parameters */ 703 frame[1] = 0x02; /* Two parameters */
704 704
705 irlan_insert_string_param(skb, "MEDIA", "802.3"); 705 irlan_insert_string_param(skb, "MEDIA", "802.3");
@@ -711,11 +711,11 @@ void irlan_open_data_channel(struct irlan_cb *self)
711 irlan_ctrl_data_request(self, skb); 711 irlan_ctrl_data_request(self, skb);
712} 712}
713 713
714void irlan_close_data_channel(struct irlan_cb *self) 714void irlan_close_data_channel(struct irlan_cb *self)
715{ 715{
716 struct sk_buff *skb; 716 struct sk_buff *skb;
717 __u8 *frame; 717 __u8 *frame;
718 718
719 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 719 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
720 720
721 IRDA_ASSERT(self != NULL, return;); 721 IRDA_ASSERT(self != NULL, return;);
@@ -733,11 +733,11 @@ void irlan_close_data_channel(struct irlan_cb *self)
733 733
734 skb_reserve(skb, self->client.max_header_size); 734 skb_reserve(skb, self->client.max_header_size);
735 skb_put(skb, 2); 735 skb_put(skb, 2);
736 736
737 frame = skb->data; 737 frame = skb->data;
738 738
739 /* Build frame */ 739 /* Build frame */
740 frame[0] = CMD_CLOSE_DATA_CHAN; 740 frame[0] = CMD_CLOSE_DATA_CHAN;
741 frame[1] = 0x01; /* One parameter */ 741 frame[1] = 0x01; /* One parameter */
742 742
743 irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); 743 irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data);
@@ -748,7 +748,7 @@ void irlan_close_data_channel(struct irlan_cb *self)
748/* 748/*
749 * Function irlan_open_unicast_addr (self) 749 * Function irlan_open_unicast_addr (self)
750 * 750 *
751 * Make IrLAN provider accept ethernet frames addressed to the unicast 751 * Make IrLAN provider accept ethernet frames addressed to the unicast
752 * address. 752 * address.
753 * 753 *
754 */ 754 */
@@ -756,12 +756,12 @@ static void irlan_open_unicast_addr(struct irlan_cb *self)
756{ 756{
757 struct sk_buff *skb; 757 struct sk_buff *skb;
758 __u8 *frame; 758 __u8 *frame;
759 759
760 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 760 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
761 761
762 IRDA_ASSERT(self != NULL, return;); 762 IRDA_ASSERT(self != NULL, return;);
763 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 763 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
764 764
765 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + 765 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
766 IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + 766 IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
767 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + 767 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") +
@@ -773,15 +773,15 @@ static void irlan_open_unicast_addr(struct irlan_cb *self)
773 /* Reserve space for TTP, LMP, and LAP header */ 773 /* Reserve space for TTP, LMP, and LAP header */
774 skb_reserve(skb, self->max_header_size); 774 skb_reserve(skb, self->max_header_size);
775 skb_put(skb, 2); 775 skb_put(skb, 2);
776 776
777 frame = skb->data; 777 frame = skb->data;
778 778
779 frame[0] = CMD_FILTER_OPERATION; 779 frame[0] = CMD_FILTER_OPERATION;
780 frame[1] = 0x03; /* Three parameters */ 780 frame[1] = 0x03; /* Three parameters */
781 irlan_insert_byte_param(skb, "DATA_CHAN" , self->dtsap_sel_data); 781 irlan_insert_byte_param(skb, "DATA_CHAN" , self->dtsap_sel_data);
782 irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); 782 irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED");
783 irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); 783 irlan_insert_string_param(skb, "FILTER_MODE", "FILTER");
784 784
785 irlan_ctrl_data_request(self, skb); 785 irlan_ctrl_data_request(self, skb);
786} 786}
787 787
@@ -794,17 +794,17 @@ static void irlan_open_unicast_addr(struct irlan_cb *self)
794 * one but then _we_ have to initiate all communication with other 794 * one but then _we_ have to initiate all communication with other
795 * hosts, since ARP request for this host will not be answered. 795 * hosts, since ARP request for this host will not be answered.
796 */ 796 */
797void irlan_set_broadcast_filter(struct irlan_cb *self, int status) 797void irlan_set_broadcast_filter(struct irlan_cb *self, int status)
798{ 798{
799 struct sk_buff *skb; 799 struct sk_buff *skb;
800 __u8 *frame; 800 __u8 *frame;
801 801
802 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 802 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
803 803
804 IRDA_ASSERT(self != NULL, return;); 804 IRDA_ASSERT(self != NULL, return;);
805 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 805 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
806 806
807 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + 807 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
808 IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + 808 IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
809 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BROADCAST") + 809 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BROADCAST") +
810 /* We may waste one byte here...*/ 810 /* We may waste one byte here...*/
@@ -816,17 +816,17 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status)
816 /* Reserve space for TTP, LMP, and LAP header */ 816 /* Reserve space for TTP, LMP, and LAP header */
817 skb_reserve(skb, self->client.max_header_size); 817 skb_reserve(skb, self->client.max_header_size);
818 skb_put(skb, 2); 818 skb_put(skb, 2);
819 819
820 frame = skb->data; 820 frame = skb->data;
821 821
822 frame[0] = CMD_FILTER_OPERATION; 822 frame[0] = CMD_FILTER_OPERATION;
823 frame[1] = 0x03; /* Three parameters */ 823 frame[1] = 0x03; /* Three parameters */
824 irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); 824 irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data);
825 irlan_insert_string_param(skb, "FILTER_TYPE", "BROADCAST"); 825 irlan_insert_string_param(skb, "FILTER_TYPE", "BROADCAST");
826 if (status) 826 if (status)
827 irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); 827 irlan_insert_string_param(skb, "FILTER_MODE", "FILTER");
828 else 828 else
829 irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); 829 irlan_insert_string_param(skb, "FILTER_MODE", "NONE");
830 830
831 irlan_ctrl_data_request(self, skb); 831 irlan_ctrl_data_request(self, skb);
832} 832}
@@ -835,14 +835,14 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status)
835 * Function irlan_set_multicast_filter (self, status) 835 * Function irlan_set_multicast_filter (self, status)
836 * 836 *
837 * Make IrLAN provider accept ethernet frames addressed to the multicast 837 * Make IrLAN provider accept ethernet frames addressed to the multicast
838 * address. 838 * address.
839 * 839 *
840 */ 840 */
841void irlan_set_multicast_filter(struct irlan_cb *self, int status) 841void irlan_set_multicast_filter(struct irlan_cb *self, int status)
842{ 842{
843 struct sk_buff *skb; 843 struct sk_buff *skb;
844 __u8 *frame; 844 __u8 *frame;
845 845
846 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 846 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
847 847
848 IRDA_ASSERT(self != NULL, return;); 848 IRDA_ASSERT(self != NULL, return;);
@@ -856,21 +856,21 @@ void irlan_set_multicast_filter(struct irlan_cb *self, int status)
856 GFP_ATOMIC); 856 GFP_ATOMIC);
857 if (!skb) 857 if (!skb)
858 return; 858 return;
859 859
860 /* Reserve space for TTP, LMP, and LAP header */ 860 /* Reserve space for TTP, LMP, and LAP header */
861 skb_reserve(skb, self->client.max_header_size); 861 skb_reserve(skb, self->client.max_header_size);
862 skb_put(skb, 2); 862 skb_put(skb, 2);
863 863
864 frame = skb->data; 864 frame = skb->data;
865 865
866 frame[0] = CMD_FILTER_OPERATION; 866 frame[0] = CMD_FILTER_OPERATION;
867 frame[1] = 0x03; /* Three parameters */ 867 frame[1] = 0x03; /* Three parameters */
868 irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); 868 irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data);
869 irlan_insert_string_param(skb, "FILTER_TYPE", "MULTICAST"); 869 irlan_insert_string_param(skb, "FILTER_TYPE", "MULTICAST");
870 if (status) 870 if (status)
871 irlan_insert_string_param(skb, "FILTER_MODE", "ALL"); 871 irlan_insert_string_param(skb, "FILTER_MODE", "ALL");
872 else 872 else
873 irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); 873 irlan_insert_string_param(skb, "FILTER_MODE", "NONE");
874 874
875 irlan_ctrl_data_request(self, skb); 875 irlan_ctrl_data_request(self, skb);
876} 876}
@@ -887,12 +887,12 @@ static void irlan_get_unicast_addr(struct irlan_cb *self)
887{ 887{
888 struct sk_buff *skb; 888 struct sk_buff *skb;
889 __u8 *frame; 889 __u8 *frame;
890 890
891 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 891 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
892 892
893 IRDA_ASSERT(self != NULL, return;); 893 IRDA_ASSERT(self != NULL, return;);
894 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 894 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
895 895
896 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + 896 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
897 IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + 897 IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
898 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + 898 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") +
@@ -905,34 +905,34 @@ static void irlan_get_unicast_addr(struct irlan_cb *self)
905 /* Reserve space for TTP, LMP, and LAP header */ 905 /* Reserve space for TTP, LMP, and LAP header */
906 skb_reserve(skb, self->client.max_header_size); 906 skb_reserve(skb, self->client.max_header_size);
907 skb_put(skb, 2); 907 skb_put(skb, 2);
908 908
909 frame = skb->data; 909 frame = skb->data;
910 910
911 frame[0] = CMD_FILTER_OPERATION; 911 frame[0] = CMD_FILTER_OPERATION;
912 frame[1] = 0x03; /* Three parameters */ 912 frame[1] = 0x03; /* Three parameters */
913 irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); 913 irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data);
914 irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); 914 irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED");
915 irlan_insert_string_param(skb, "FILTER_OPERATION", "DYNAMIC"); 915 irlan_insert_string_param(skb, "FILTER_OPERATION", "DYNAMIC");
916 916
917 irlan_ctrl_data_request(self, skb); 917 irlan_ctrl_data_request(self, skb);
918} 918}
919 919
920/* 920/*
921 * Function irlan_get_media_char (self) 921 * Function irlan_get_media_char (self)
922 * 922 *
923 * 923 *
924 * 924 *
925 */ 925 */
926void irlan_get_media_char(struct irlan_cb *self) 926void irlan_get_media_char(struct irlan_cb *self)
927{ 927{
928 struct sk_buff *skb; 928 struct sk_buff *skb;
929 __u8 *frame; 929 __u8 *frame;
930 930
931 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 931 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
932 932
933 IRDA_ASSERT(self != NULL, return;); 933 IRDA_ASSERT(self != NULL, return;);
934 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 934 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
935 935
936 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + 936 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
937 IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3"), 937 IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3"),
938 GFP_ATOMIC); 938 GFP_ATOMIC);
@@ -943,13 +943,13 @@ void irlan_get_media_char(struct irlan_cb *self)
943 /* Reserve space for TTP, LMP, and LAP header */ 943 /* Reserve space for TTP, LMP, and LAP header */
944 skb_reserve(skb, self->client.max_header_size); 944 skb_reserve(skb, self->client.max_header_size);
945 skb_put(skb, 2); 945 skb_put(skb, 2);
946 946
947 frame = skb->data; 947 frame = skb->data;
948 948
949 /* Build frame */ 949 /* Build frame */
950 frame[0] = CMD_GET_MEDIA_CHAR; 950 frame[0] = CMD_GET_MEDIA_CHAR;
951 frame[1] = 0x01; /* One parameter */ 951 frame[1] = 0x01; /* One parameter */
952 952
953 irlan_insert_string_param(skb, "MEDIA", "802.3"); 953 irlan_insert_string_param(skb, "MEDIA", "802.3");
954 irlan_ctrl_data_request(self, skb); 954 irlan_ctrl_data_request(self, skb);
955} 955}
@@ -980,7 +980,7 @@ int irlan_insert_string_param(struct sk_buff *skb, char *param, char *string)
980{ 980{
981 int string_len = strlen(string); 981 int string_len = strlen(string);
982 982
983 return __irlan_insert_param(skb, param, IRLAN_ARRAY, 0, 0, string, 983 return __irlan_insert_param(skb, param, IRLAN_ARRAY, 0, 0, string,
984 string_len); 984 string_len);
985} 985}
986 986
@@ -993,7 +993,7 @@ int irlan_insert_string_param(struct sk_buff *skb, char *param, char *string)
993int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *array, 993int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *array,
994 __u16 array_len) 994 __u16 array_len)
995{ 995{
996 return __irlan_insert_param(skb, name, IRLAN_ARRAY, 0, 0, array, 996 return __irlan_insert_param(skb, name, IRLAN_ARRAY, 0, 0, array,
997 array_len); 997 array_len);
998} 998}
999 999
@@ -1006,19 +1006,19 @@ int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *array,
1006 * | Name Length[1] | Param Name[1..255] | Val Length[2] | Value[0..1016]| 1006 * | Name Length[1] | Param Name[1..255] | Val Length[2] | Value[0..1016]|
1007 * ----------------------------------------------------------------------- 1007 * -----------------------------------------------------------------------
1008 */ 1008 */
1009static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, 1009static int __irlan_insert_param(struct sk_buff *skb, char *param, int type,
1010 __u8 value_byte, __u16 value_short, 1010 __u8 value_byte, __u16 value_short,
1011 __u8 *value_array, __u16 value_len) 1011 __u8 *value_array, __u16 value_len)
1012{ 1012{
1013 __u8 *frame; 1013 __u8 *frame;
1014 __u8 param_len; 1014 __u8 param_len;
1015 __le16 tmp_le; /* Temporary value in little endian format */ 1015 __le16 tmp_le; /* Temporary value in little endian format */
1016 int n=0; 1016 int n=0;
1017 1017
1018 if (skb == NULL) { 1018 if (skb == NULL) {
1019 IRDA_DEBUG(2, "%s(), Got NULL skb\n", __FUNCTION__ ); 1019 IRDA_DEBUG(2, "%s(), Got NULL skb\n", __FUNCTION__ );
1020 return 0; 1020 return 0;
1021 } 1021 }
1022 1022
1023 param_len = strlen(param); 1023 param_len = strlen(param);
1024 switch (type) { 1024 switch (type) {
@@ -1037,7 +1037,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type,
1037 return 0; 1037 return 0;
1038 break; 1038 break;
1039 } 1039 }
1040 1040
1041 /* Insert at end of sk-buffer */ 1041 /* Insert at end of sk-buffer */
1042 frame = skb->tail; 1042 frame = skb->tail;
1043 1043
@@ -1045,15 +1045,15 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type,
1045 if (skb_tailroom(skb) < (param_len+value_len+3)) { 1045 if (skb_tailroom(skb) < (param_len+value_len+3)) {
1046 IRDA_DEBUG(2, "%s(), No more space at end of skb\n", __FUNCTION__ ); 1046 IRDA_DEBUG(2, "%s(), No more space at end of skb\n", __FUNCTION__ );
1047 return 0; 1047 return 0;
1048 } 1048 }
1049 skb_put(skb, param_len+value_len+3); 1049 skb_put(skb, param_len+value_len+3);
1050 1050
1051 /* Insert parameter length */ 1051 /* Insert parameter length */
1052 frame[n++] = param_len; 1052 frame[n++] = param_len;
1053 1053
1054 /* Insert parameter */ 1054 /* Insert parameter */
1055 memcpy(frame+n, param, param_len); n += param_len; 1055 memcpy(frame+n, param, param_len); n += param_len;
1056 1056
1057 /* Insert value length (2 byte little endian format, LSB first) */ 1057 /* Insert value length (2 byte little endian format, LSB first) */
1058 tmp_le = cpu_to_le16(value_len); 1058 tmp_le = cpu_to_le16(value_len);
1059 memcpy(frame+n, &tmp_le, 2); n += 2; /* To avoid alignment problems */ 1059 memcpy(frame+n, &tmp_le, 2); n += 2; /* To avoid alignment problems */
@@ -1082,36 +1082,36 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type,
1082 * Function irlan_extract_param (buf, name, value, len) 1082 * Function irlan_extract_param (buf, name, value, len)
1083 * 1083 *
1084 * Extracts a single parameter name/value pair from buffer and updates 1084 * Extracts a single parameter name/value pair from buffer and updates
1085 * the buffer pointer to point to the next name/value pair. 1085 * the buffer pointer to point to the next name/value pair.
1086 */ 1086 */
1087int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) 1087int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len)
1088{ 1088{
1089 __u8 name_len; 1089 __u8 name_len;
1090 __u16 val_len; 1090 __u16 val_len;
1091 int n=0; 1091 int n=0;
1092 1092
1093 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 1093 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
1094 1094
1095 /* get length of parameter name (1 byte) */ 1095 /* get length of parameter name (1 byte) */
1096 name_len = buf[n++]; 1096 name_len = buf[n++];
1097 1097
1098 if (name_len > 254) { 1098 if (name_len > 254) {
1099 IRDA_DEBUG(2, "%s(), name_len > 254\n", __FUNCTION__ ); 1099 IRDA_DEBUG(2, "%s(), name_len > 254\n", __FUNCTION__ );
1100 return -RSP_INVALID_COMMAND_FORMAT; 1100 return -RSP_INVALID_COMMAND_FORMAT;
1101 } 1101 }
1102 1102
1103 /* get parameter name */ 1103 /* get parameter name */
1104 memcpy(name, buf+n, name_len); 1104 memcpy(name, buf+n, name_len);
1105 name[name_len] = '\0'; 1105 name[name_len] = '\0';
1106 n+=name_len; 1106 n+=name_len;
1107 1107
1108 /* 1108 /*
1109 * Get length of parameter value (2 bytes in little endian 1109 * Get length of parameter value (2 bytes in little endian
1110 * format) 1110 * format)
1111 */ 1111 */
1112 memcpy(&val_len, buf+n, 2); /* To avoid alignment problems */ 1112 memcpy(&val_len, buf+n, 2); /* To avoid alignment problems */
1113 le16_to_cpus(&val_len); n+=2; 1113 le16_to_cpus(&val_len); n+=2;
1114 1114
1115 if (val_len > 1016) { 1115 if (val_len > 1016) {
1116 IRDA_DEBUG(2, "%s(), parameter length to long\n", __FUNCTION__ ); 1116 IRDA_DEBUG(2, "%s(), parameter length to long\n", __FUNCTION__ );
1117 return -RSP_INVALID_COMMAND_FORMAT; 1117 return -RSP_INVALID_COMMAND_FORMAT;
@@ -1122,9 +1122,9 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len)
1122 memcpy(value, buf+n, val_len); 1122 memcpy(value, buf+n, val_len);
1123 value[val_len] = '\0'; 1123 value[val_len] = '\0';
1124 n+=val_len; 1124 n+=val_len;
1125 1125
1126 IRDA_DEBUG(4, "Parameter: %s ", name); 1126 IRDA_DEBUG(4, "Parameter: %s ", name);
1127 IRDA_DEBUG(4, "Value: %s\n", value); 1127 IRDA_DEBUG(4, "Value: %s\n", value);
1128 1128
1129 return n; 1129 return n;
1130} 1130}
@@ -1133,7 +1133,7 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len)
1133 1133
1134/* 1134/*
1135 * Start of reading /proc entries. 1135 * Start of reading /proc entries.
1136 * Return entry at pos, 1136 * Return entry at pos,
1137 * or start_token to indicate print header line 1137 * or start_token to indicate print header line
1138 * or NULL if end of file 1138 * or NULL if end of file
1139 */ 1139 */
@@ -1147,7 +1147,7 @@ static void *irlan_seq_start(struct seq_file *seq, loff_t *pos)
1147 return SEQ_START_TOKEN; 1147 return SEQ_START_TOKEN;
1148 1148
1149 list_for_each_entry(self, &irlans, dev_list) { 1149 list_for_each_entry(self, &irlans, dev_list) {
1150 if (*pos == i) 1150 if (*pos == i)
1151 return self; 1151 return self;
1152 ++i; 1152 ++i;
1153 } 1153 }
@@ -1160,12 +1160,12 @@ static void *irlan_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1160 struct list_head *nxt; 1160 struct list_head *nxt;
1161 1161
1162 ++*pos; 1162 ++*pos;
1163 if (v == SEQ_START_TOKEN) 1163 if (v == SEQ_START_TOKEN)
1164 nxt = irlans.next; 1164 nxt = irlans.next;
1165 else 1165 else
1166 nxt = ((struct irlan_cb *)v)->dev_list.next; 1166 nxt = ((struct irlan_cb *)v)->dev_list.next;
1167 1167
1168 return (nxt == &irlans) ? NULL 1168 return (nxt == &irlans) ? NULL
1169 : list_entry(nxt, struct irlan_cb, dev_list); 1169 : list_entry(nxt, struct irlan_cb, dev_list);
1170} 1170}
1171 1171
@@ -1185,7 +1185,7 @@ static int irlan_seq_show(struct seq_file *seq, void *v)
1185 seq_puts(seq, "IrLAN instances:\n"); 1185 seq_puts(seq, "IrLAN instances:\n");
1186 else { 1186 else {
1187 struct irlan_cb *self = v; 1187 struct irlan_cb *self = v;
1188 1188
1189 IRDA_ASSERT(self != NULL, return -1;); 1189 IRDA_ASSERT(self != NULL, return -1;);
1190 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); 1190 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;);
1191 1191
@@ -1201,17 +1201,17 @@ static int irlan_seq_show(struct seq_file *seq, void *v)
1201 self->daddr); 1201 self->daddr);
1202 seq_printf(seq,"version: %d.%d,\n", 1202 seq_printf(seq,"version: %d.%d,\n",
1203 self->version[1], self->version[0]); 1203 self->version[1], self->version[0]);
1204 seq_printf(seq,"access type: %s\n", 1204 seq_printf(seq,"access type: %s\n",
1205 irlan_access[self->client.access_type]); 1205 irlan_access[self->client.access_type]);
1206 seq_printf(seq,"media: %s\n", 1206 seq_printf(seq,"media: %s\n",
1207 irlan_media[self->media]); 1207 irlan_media[self->media]);
1208 1208
1209 seq_printf(seq,"local filter:\n"); 1209 seq_printf(seq,"local filter:\n");
1210 seq_printf(seq,"remote filter: "); 1210 seq_printf(seq,"remote filter: ");
1211 irlan_print_filter(seq, self->client.filter_type); 1211 irlan_print_filter(seq, self->client.filter_type);
1212 seq_printf(seq,"tx busy: %s\n", 1212 seq_printf(seq,"tx busy: %s\n",
1213 netif_queue_stopped(self->dev) ? "TRUE" : "FALSE"); 1213 netif_queue_stopped(self->dev) ? "TRUE" : "FALSE");
1214 1214
1215 seq_putc(seq,'\n'); 1215 seq_putc(seq,'\n');
1216 } 1216 }
1217 return 0; 1217 return 0;
@@ -1231,7 +1231,7 @@ static int irlan_seq_open(struct inode *inode, struct file *file)
1231#endif 1231#endif
1232 1232
1233MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); 1233MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
1234MODULE_DESCRIPTION("The Linux IrDA LAN protocol"); 1234MODULE_DESCRIPTION("The Linux IrDA LAN protocol");
1235MODULE_LICENSE("GPL"); 1235MODULE_LICENSE("GPL");
1236 1236
1237module_param(eth, bool, 0); 1237module_param(eth, bool, 0);
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c
index b0ccc455b747..672ab3f69033 100644
--- a/net/irda/irlan/irlan_eth.c
+++ b/net/irda/irlan/irlan_eth.c
@@ -1,8 +1,8 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irlan_eth.c 3 * Filename: irlan_eth.c
4 * Version: 4 * Version:
5 * Description: 5 * Description:
6 * Status: Experimental. 6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no> 7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Thu Oct 15 08:37:58 1998 8 * Created at: Thu Oct 15 08:37:58 1998
@@ -11,18 +11,18 @@
11 * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> 11 * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov>
12 * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> 12 * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk>
13 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> 13 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
14 * 14 *
15 * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. 15 * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved.
16 * 16 *
17 * This program is free software; you can redistribute it and/or 17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License as 18 * modify it under the terms of the GNU General Public License as
19 * published by the Free Software Foundation; either version 2 of 19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version. 20 * the License, or (at your option) any later version.
21 * 21 *
22 * Neither Dag Brattli nor University of Tromsų admit liability nor 22 * Neither Dag Brattli nor University of Tromsų admit liability nor
23 * provide warranty for any of this software. This material is 23 * provide warranty for any of this software. This material is
24 * provided "AS-IS" and at no charge. 24 * provided "AS-IS" and at no charge.
25 * 25 *
26 ********************************************************************/ 26 ********************************************************************/
27 27
28#include <linux/netdevice.h> 28#include <linux/netdevice.h>
@@ -55,7 +55,7 @@ static void irlan_eth_setup(struct net_device *dev)
55{ 55{
56 dev->open = irlan_eth_open; 56 dev->open = irlan_eth_open;
57 dev->stop = irlan_eth_close; 57 dev->stop = irlan_eth_close;
58 dev->hard_start_xmit = irlan_eth_xmit; 58 dev->hard_start_xmit = irlan_eth_xmit;
59 dev->get_stats = irlan_eth_get_stats; 59 dev->get_stats = irlan_eth_get_stats;
60 dev->set_multicast_list = irlan_eth_set_multicast_list; 60 dev->set_multicast_list = irlan_eth_set_multicast_list;
61 dev->destructor = free_netdev; 61 dev->destructor = free_netdev;
@@ -63,8 +63,8 @@ static void irlan_eth_setup(struct net_device *dev)
63 SET_MODULE_OWNER(dev); 63 SET_MODULE_OWNER(dev);
64 64
65 ether_setup(dev); 65 ether_setup(dev);
66 66
67 /* 67 /*
68 * Lets do all queueing in IrTTP instead of this device driver. 68 * Lets do all queueing in IrTTP instead of this device driver.
69 * Queueing here as well can introduce some strange latency 69 * Queueing here as well can introduce some strange latency
70 * problems, which we will avoid by setting the queue size to 0. 70 * problems, which we will avoid by setting the queue size to 0.
@@ -104,17 +104,17 @@ struct net_device *alloc_irlandev(const char *name)
104static int irlan_eth_open(struct net_device *dev) 104static int irlan_eth_open(struct net_device *dev)
105{ 105{
106 struct irlan_cb *self = netdev_priv(dev); 106 struct irlan_cb *self = netdev_priv(dev);
107 107
108 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 108 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
109 109
110 /* Ready to play! */ 110 /* Ready to play! */
111 netif_stop_queue(dev); /* Wait until data link is ready */ 111 netif_stop_queue(dev); /* Wait until data link is ready */
112 112
113 /* We are now open, so time to do some work */ 113 /* We are now open, so time to do some work */
114 self->disconnect_reason = 0; 114 self->disconnect_reason = 0;
115 irlan_client_wakeup(self, self->saddr, self->daddr); 115 irlan_client_wakeup(self, self->saddr, self->daddr);
116 116
117 /* Make sure we have a hardware address before we return, 117 /* Make sure we have a hardware address before we return,
118 so DHCP clients gets happy */ 118 so DHCP clients gets happy */
119 return wait_event_interruptible(self->open_wait, 119 return wait_event_interruptible(self->open_wait,
120 !self->tsap_data->connected); 120 !self->tsap_data->connected);
@@ -124,30 +124,30 @@ static int irlan_eth_open(struct net_device *dev)
124 * Function irlan_eth_close (dev) 124 * Function irlan_eth_close (dev)
125 * 125 *
126 * Stop the ether network device, his function will usually be called by 126 * Stop the ether network device, his function will usually be called by
127 * ifconfig down. We should now disconnect the link, We start the 127 * ifconfig down. We should now disconnect the link, We start the
128 * close timer, so that the instance will be removed if we are unable 128 * close timer, so that the instance will be removed if we are unable
129 * to discover the remote device after the disconnect. 129 * to discover the remote device after the disconnect.
130 */ 130 */
131static int irlan_eth_close(struct net_device *dev) 131static int irlan_eth_close(struct net_device *dev)
132{ 132{
133 struct irlan_cb *self = netdev_priv(dev); 133 struct irlan_cb *self = netdev_priv(dev);
134 134
135 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 135 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
136 136
137 /* Stop device */ 137 /* Stop device */
138 netif_stop_queue(dev); 138 netif_stop_queue(dev);
139 139
140 irlan_close_data_channel(self); 140 irlan_close_data_channel(self);
141 irlan_close_tsaps(self); 141 irlan_close_tsaps(self);
142 142
143 irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); 143 irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL);
144 irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); 144 irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL);
145 145
146 /* Remove frames queued on the control channel */ 146 /* Remove frames queued on the control channel */
147 skb_queue_purge(&self->client.txq); 147 skb_queue_purge(&self->client.txq);
148 148
149 self->client.tx_busy = 0; 149 self->client.tx_busy = 0;
150 150
151 return 0; 151 return 0;
152} 152}
153 153
@@ -164,7 +164,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev)
164 164
165 /* skb headroom large enough to contain all IrDA-headers? */ 165 /* skb headroom large enough to contain all IrDA-headers? */
166 if ((skb_headroom(skb) < self->max_header_size) || (skb_shared(skb))) { 166 if ((skb_headroom(skb) < self->max_header_size) || (skb_shared(skb))) {
167 struct sk_buff *new_skb = 167 struct sk_buff *new_skb =
168 skb_realloc_headroom(skb, self->max_header_size); 168 skb_realloc_headroom(skb, self->max_header_size);
169 169
170 /* We have to free the original skb anyway */ 170 /* We have to free the original skb anyway */
@@ -176,7 +176,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev)
176 176
177 /* Use the new skb instead */ 177 /* Use the new skb instead */
178 skb = new_skb; 178 skb = new_skb;
179 } 179 }
180 180
181 dev->trans_start = jiffies; 181 dev->trans_start = jiffies;
182 182
@@ -187,7 +187,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev)
187 ret = irttp_data_request(self->tsap_data, skb); 187 ret = irttp_data_request(self->tsap_data, skb);
188 188
189 if (ret < 0) { 189 if (ret < 0) {
190 /* 190 /*
191 * IrTTPs tx queue is full, so we just have to 191 * IrTTPs tx queue is full, so we just have to
192 * drop the frame! You might think that we should 192 * drop the frame! You might think that we should
193 * just return -1 and don't deallocate the frame, 193 * just return -1 and don't deallocate the frame,
@@ -195,15 +195,15 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev)
195 * we have replaced the original skb with a new 195 * we have replaced the original skb with a new
196 * one with larger headroom, and that would really 196 * one with larger headroom, and that would really
197 * confuse do_dev_queue_xmit() in dev.c! I have 197 * confuse do_dev_queue_xmit() in dev.c! I have
198 * tried :-) DB 198 * tried :-) DB
199 */ 199 */
200 /* irttp_data_request already free the packet */ 200 /* irttp_data_request already free the packet */
201 self->stats.tx_dropped++; 201 self->stats.tx_dropped++;
202 } else { 202 } else {
203 self->stats.tx_packets++; 203 self->stats.tx_packets++;
204 self->stats.tx_bytes += skb->len; 204 self->stats.tx_bytes += skb->len;
205 } 205 }
206 206
207 return 0; 207 return 0;
208} 208}
209 209
@@ -218,37 +218,37 @@ int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb)
218 struct irlan_cb *self = instance; 218 struct irlan_cb *self = instance;
219 219
220 if (skb == NULL) { 220 if (skb == NULL) {
221 ++self->stats.rx_dropped; 221 ++self->stats.rx_dropped;
222 return 0; 222 return 0;
223 } 223 }
224 if (skb->len < ETH_HLEN) { 224 if (skb->len < ETH_HLEN) {
225 IRDA_DEBUG(0, "%s() : IrLAN frame too short (%d)\n", 225 IRDA_DEBUG(0, "%s() : IrLAN frame too short (%d)\n",
226 __FUNCTION__, skb->len); 226 __FUNCTION__, skb->len);
227 ++self->stats.rx_dropped; 227 ++self->stats.rx_dropped;
228 dev_kfree_skb(skb); 228 dev_kfree_skb(skb);
229 return 0; 229 return 0;
230 } 230 }
231 231
232 /* 232 /*
233 * Adopt this frame! Important to set all these fields since they 233 * Adopt this frame! Important to set all these fields since they
234 * might have been previously set by the low level IrDA network 234 * might have been previously set by the low level IrDA network
235 * device driver 235 * device driver
236 */ 236 */
237 skb->dev = self->dev; 237 skb->dev = self->dev;
238 skb->protocol=eth_type_trans(skb, skb->dev); /* Remove eth header */ 238 skb->protocol=eth_type_trans(skb, skb->dev); /* Remove eth header */
239 239
240 self->stats.rx_packets++; 240 self->stats.rx_packets++;
241 self->stats.rx_bytes += skb->len; 241 self->stats.rx_bytes += skb->len;
242 242
243 netif_rx(skb); /* Eat it! */ 243 netif_rx(skb); /* Eat it! */
244 244
245 return 0; 245 return 0;
246} 246}
247 247
248/* 248/*
249 * Function irlan_eth_flow (status) 249 * Function irlan_eth_flow (status)
250 * 250 *
251 * Do flow control between IP/Ethernet and IrLAN/IrTTP. This is done by 251 * Do flow control between IP/Ethernet and IrLAN/IrTTP. This is done by
252 * controlling the queue stop/start. 252 * controlling the queue stop/start.
253 * 253 *
254 * The IrDA link layer has the advantage to have flow control, and 254 * The IrDA link layer has the advantage to have flow control, and
@@ -268,11 +268,11 @@ void irlan_eth_flow_indication(void *instance, void *sap, LOCAL_FLOW flow)
268 268
269 IRDA_ASSERT(self != NULL, return;); 269 IRDA_ASSERT(self != NULL, return;);
270 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 270 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
271 271
272 dev = self->dev; 272 dev = self->dev;
273 273
274 IRDA_ASSERT(dev != NULL, return;); 274 IRDA_ASSERT(dev != NULL, return;);
275 275
276 IRDA_DEBUG(0, "%s() : flow %s ; running %d\n", __FUNCTION__, 276 IRDA_DEBUG(0, "%s() : flow %s ; running %d\n", __FUNCTION__,
277 flow == FLOW_STOP ? "FLOW_STOP" : "FLOW_START", 277 flow == FLOW_STOP ? "FLOW_STOP" : "FLOW_START",
278 netif_running(dev)); 278 netif_running(dev));
@@ -301,10 +301,10 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev)
301{ 301{
302 struct in_device *in_dev; 302 struct in_device *in_dev;
303 303
304 /* 304 /*
305 * When we get a new MAC address do a gratuitous ARP. This 305 * When we get a new MAC address do a gratuitous ARP. This
306 * is useful if we have changed access points on the same 306 * is useful if we have changed access points on the same
307 * subnet. 307 * subnet.
308 */ 308 */
309#ifdef CONFIG_INET 309#ifdef CONFIG_INET
310 IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n"); 310 IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n");
@@ -313,10 +313,10 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev)
313 if (in_dev == NULL) 313 if (in_dev == NULL)
314 goto out; 314 goto out;
315 if (in_dev->ifa_list) 315 if (in_dev->ifa_list)
316 316
317 arp_send(ARPOP_REQUEST, ETH_P_ARP, 317 arp_send(ARPOP_REQUEST, ETH_P_ARP,
318 in_dev->ifa_list->ifa_address, 318 in_dev->ifa_list->ifa_address,
319 dev, 319 dev,
320 in_dev->ifa_list->ifa_address, 320 in_dev->ifa_list->ifa_address,
321 NULL, dev->dev_addr, NULL); 321 NULL, dev->dev_addr, NULL);
322out: 322out:
@@ -331,9 +331,9 @@ out:
331 * 331 *
332 */ 332 */
333#define HW_MAX_ADDRS 4 /* Must query to get it! */ 333#define HW_MAX_ADDRS 4 /* Must query to get it! */
334static void irlan_eth_set_multicast_list(struct net_device *dev) 334static void irlan_eth_set_multicast_list(struct net_device *dev)
335{ 335{
336 struct irlan_cb *self = netdev_priv(dev); 336 struct irlan_cb *self = netdev_priv(dev);
337 337
338 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 338 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
339 339
@@ -346,7 +346,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev)
346 if (dev->flags & IFF_PROMISC) { 346 if (dev->flags & IFF_PROMISC) {
347 /* Enable promiscuous mode */ 347 /* Enable promiscuous mode */
348 IRDA_WARNING("Promiscous mode not implemented by IrLAN!\n"); 348 IRDA_WARNING("Promiscous mode not implemented by IrLAN!\n");
349 } 349 }
350 else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS) { 350 else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS) {
351 /* Disable promiscuous mode, use normal mode. */ 351 /* Disable promiscuous mode, use normal mode. */
352 IRDA_DEBUG(4, "%s(), Setting multicast filter\n", __FUNCTION__ ); 352 IRDA_DEBUG(4, "%s(), Setting multicast filter\n", __FUNCTION__ );
@@ -378,7 +378,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev)
378 * Get the current statistics for this device 378 * Get the current statistics for this device
379 * 379 *
380 */ 380 */
381static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev) 381static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev)
382{ 382{
383 struct irlan_cb *self = netdev_priv(dev); 383 struct irlan_cb *self = netdev_priv(dev);
384 384
diff --git a/net/irda/irlan/irlan_event.c b/net/irda/irlan/irlan_event.c
index 2778d8c6aa31..623e0fd16c19 100644
--- a/net/irda/irlan/irlan_event.c
+++ b/net/irda/irlan/irlan_event.c
@@ -1,25 +1,25 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irlan_event.c 3 * Filename: irlan_event.c
4 * Version: 4 * Version:
5 * Description: 5 * Description:
6 * Status: Experimental. 6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no> 7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Tue Oct 20 09:10:16 1998 8 * Created at: Tue Oct 20 09:10:16 1998
9 * Modified at: Sat Oct 30 12:59:01 1999 9 * Modified at: Sat Oct 30 12:59:01 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. 12 * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
13 * 13 *
14 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as 15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * Neither Dag Brattli nor University of Tromsų admit liability nor 19 * Neither Dag Brattli nor University of Tromsų admit liability nor
20 * provide warranty for any of this software. This material is 20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charge. 21 * provided "AS-IS" and at no charge.
22 * 22 *
23 ********************************************************************/ 23 ********************************************************************/
24 24
25#include <net/irda/irlan_event.h> 25#include <net/irda/irlan_event.h>
@@ -38,7 +38,7 @@ char *irlan_state[] = {
38 "IRLAN_SYNC", 38 "IRLAN_SYNC",
39}; 39};
40 40
41void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) 41void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state)
42{ 42{
43 IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]); 43 IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]);
44 44
@@ -48,7 +48,7 @@ void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state)
48 self->client.state = state; 48 self->client.state = state;
49} 49}
50 50
51void irlan_next_provider_state(struct irlan_cb *self, IRLAN_STATE state) 51void irlan_next_provider_state(struct irlan_cb *self, IRLAN_STATE state)
52{ 52{
53 IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]); 53 IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]);
54 54
diff --git a/net/irda/irlan/irlan_filter.c b/net/irda/irlan/irlan_filter.c
index ca7d358dab52..e6346b88f934 100644
--- a/net/irda/irlan/irlan_filter.c
+++ b/net/irda/irlan/irlan_filter.c
@@ -1,25 +1,25 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irlan_filter.c 3 * Filename: irlan_filter.c
4 * Version: 4 * Version:
5 * Description: 5 * Description:
6 * Status: Experimental. 6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no> 7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Fri Jan 29 11:16:38 1999 8 * Created at: Fri Jan 29 11:16:38 1999
9 * Modified at: Sat Oct 30 12:58:45 1999 9 * Modified at: Sat Oct 30 12:58:45 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. 12 * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
13 * 13 *
14 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as 15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * Neither Dag Brattli nor University of Tromsų admit liability nor 19 * Neither Dag Brattli nor University of Tromsų admit liability nor
20 * provide warranty for any of this software. This material is 20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charge. 21 * provided "AS-IS" and at no charge.
22 * 22 *
23 ********************************************************************/ 23 ********************************************************************/
24 24
25#include <linux/skbuff.h> 25#include <linux/skbuff.h>
@@ -40,7 +40,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb)
40 IRDA_ASSERT(self != NULL, return;); 40 IRDA_ASSERT(self != NULL, return;);
41 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 41 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
42 42
43 if ((self->provider.filter_type == IRLAN_DIRECTED) && 43 if ((self->provider.filter_type == IRLAN_DIRECTED) &&
44 (self->provider.filter_operation == DYNAMIC)) 44 (self->provider.filter_operation == DYNAMIC))
45 { 45 {
46 IRDA_DEBUG(0, "Giving peer a dynamic Ethernet address\n"); 46 IRDA_DEBUG(0, "Giving peer a dynamic Ethernet address\n");
@@ -48,12 +48,12 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb)
48 self->provider.mac_address[1] = 0x00; 48 self->provider.mac_address[1] = 0x00;
49 self->provider.mac_address[2] = 0x00; 49 self->provider.mac_address[2] = 0x00;
50 self->provider.mac_address[3] = 0x00; 50 self->provider.mac_address[3] = 0x00;
51 51
52 /* Use arbitration value to generate MAC address */ 52 /* Use arbitration value to generate MAC address */
53 if (self->provider.access_type == ACCESS_PEER) { 53 if (self->provider.access_type == ACCESS_PEER) {
54 self->provider.mac_address[4] = 54 self->provider.mac_address[4] =
55 self->provider.send_arb_val & 0xff; 55 self->provider.send_arb_val & 0xff;
56 self->provider.mac_address[5] = 56 self->provider.mac_address[5] =
57 (self->provider.send_arb_val >> 8) & 0xff; 57 (self->provider.send_arb_val >> 8) & 0xff;
58 } else { 58 } else {
59 /* Just generate something for now */ 59 /* Just generate something for now */
@@ -65,12 +65,12 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb)
65 skb->data[1] = 0x03; 65 skb->data[1] = 0x03;
66 irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); 66 irlan_insert_string_param(skb, "FILTER_MODE", "NONE");
67 irlan_insert_short_param(skb, "MAX_ENTRY", 0x0001); 67 irlan_insert_short_param(skb, "MAX_ENTRY", 0x0001);
68 irlan_insert_array_param(skb, "FILTER_ENTRY", 68 irlan_insert_array_param(skb, "FILTER_ENTRY",
69 self->provider.mac_address, 6); 69 self->provider.mac_address, 6);
70 return; 70 return;
71 } 71 }
72 72
73 if ((self->provider.filter_type == IRLAN_DIRECTED) && 73 if ((self->provider.filter_type == IRLAN_DIRECTED) &&
74 (self->provider.filter_mode == FILTER)) 74 (self->provider.filter_mode == FILTER))
75 { 75 {
76 IRDA_DEBUG(0, "Directed filter on\n"); 76 IRDA_DEBUG(0, "Directed filter on\n");
@@ -78,7 +78,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb)
78 skb->data[1] = 0x00; 78 skb->data[1] = 0x00;
79 return; 79 return;
80 } 80 }
81 if ((self->provider.filter_type == IRLAN_DIRECTED) && 81 if ((self->provider.filter_type == IRLAN_DIRECTED) &&
82 (self->provider.filter_mode == NONE)) 82 (self->provider.filter_mode == NONE))
83 { 83 {
84 IRDA_DEBUG(0, "Directed filter off\n"); 84 IRDA_DEBUG(0, "Directed filter off\n");
@@ -87,7 +87,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb)
87 return; 87 return;
88 } 88 }
89 89
90 if ((self->provider.filter_type == IRLAN_BROADCAST) && 90 if ((self->provider.filter_type == IRLAN_BROADCAST) &&
91 (self->provider.filter_mode == FILTER)) 91 (self->provider.filter_mode == FILTER))
92 { 92 {
93 IRDA_DEBUG(0, "Broadcast filter on\n"); 93 IRDA_DEBUG(0, "Broadcast filter on\n");
@@ -95,7 +95,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb)
95 skb->data[1] = 0x00; 95 skb->data[1] = 0x00;
96 return; 96 return;
97 } 97 }
98 if ((self->provider.filter_type == IRLAN_BROADCAST) && 98 if ((self->provider.filter_type == IRLAN_BROADCAST) &&
99 (self->provider.filter_mode == NONE)) 99 (self->provider.filter_mode == NONE))
100 { 100 {
101 IRDA_DEBUG(0, "Broadcast filter off\n"); 101 IRDA_DEBUG(0, "Broadcast filter off\n");
@@ -103,7 +103,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb)
103 skb->data[1] = 0x00; 103 skb->data[1] = 0x00;
104 return; 104 return;
105 } 105 }
106 if ((self->provider.filter_type == IRLAN_MULTICAST) && 106 if ((self->provider.filter_type == IRLAN_MULTICAST) &&
107 (self->provider.filter_mode == FILTER)) 107 (self->provider.filter_mode == FILTER))
108 { 108 {
109 IRDA_DEBUG(0, "Multicast filter on\n"); 109 IRDA_DEBUG(0, "Multicast filter on\n");
@@ -111,7 +111,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb)
111 skb->data[1] = 0x00; 111 skb->data[1] = 0x00;
112 return; 112 return;
113 } 113 }
114 if ((self->provider.filter_type == IRLAN_MULTICAST) && 114 if ((self->provider.filter_type == IRLAN_MULTICAST) &&
115 (self->provider.filter_mode == NONE)) 115 (self->provider.filter_mode == NONE))
116 { 116 {
117 IRDA_DEBUG(0, "Multicast filter off\n"); 117 IRDA_DEBUG(0, "Multicast filter off\n");
@@ -119,7 +119,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb)
119 skb->data[1] = 0x00; 119 skb->data[1] = 0x00;
120 return; 120 return;
121 } 121 }
122 if ((self->provider.filter_type == IRLAN_MULTICAST) && 122 if ((self->provider.filter_type == IRLAN_MULTICAST) &&
123 (self->provider.filter_operation == GET)) 123 (self->provider.filter_operation == GET))
124 { 124 {
125 IRDA_DEBUG(0, "Multicast filter get\n"); 125 IRDA_DEBUG(0, "Multicast filter get\n");
diff --git a/net/irda/irlan/irlan_provider.c b/net/irda/irlan/irlan_provider.c
index 58efde919667..aac66434e473 100644
--- a/net/irda/irlan/irlan_provider.c
+++ b/net/irda/irlan/irlan_provider.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irlan_provider.c 3 * Filename: irlan_provider.c
4 * Version: 0.9 4 * Version: 0.9
5 * Description: IrDA LAN Access Protocol Implementation 5 * Description: IrDA LAN Access Protocol Implementation
@@ -11,17 +11,17 @@
11 * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> 11 * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov>
12 * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> 12 * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk>
13 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> 13 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
14 * 14 *
15 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, 15 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
16 * All Rights Reserved. 16 * All Rights Reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * Neither Dag Brattli nor University of Tromsų admit liability nor 23 * Neither Dag Brattli nor University of Tromsų admit liability nor
24 * provide warranty for any of this software. This material is 24 * provide warranty for any of this software. This material is
25 * provided "AS-IS" and at no charge. 25 * provided "AS-IS" and at no charge.
26 * 26 *
27 ********************************************************************/ 27 ********************************************************************/
@@ -52,8 +52,8 @@
52#include <net/irda/irlan_filter.h> 52#include <net/irda/irlan_filter.h>
53#include <net/irda/irlan_client.h> 53#include <net/irda/irlan_client.h>
54 54
55static void irlan_provider_connect_indication(void *instance, void *sap, 55static void irlan_provider_connect_indication(void *instance, void *sap,
56 struct qos_info *qos, 56 struct qos_info *qos,
57 __u32 max_sdu_size, 57 __u32 max_sdu_size,
58 __u8 max_header_size, 58 __u8 max_header_size,
59 struct sk_buff *skb); 59 struct sk_buff *skb);
@@ -64,14 +64,14 @@ static void irlan_provider_connect_indication(void *instance, void *sap,
64 * This function gets the data that is received on the control channel 64 * This function gets the data that is received on the control channel
65 * 65 *
66 */ 66 */
67static int irlan_provider_data_indication(void *instance, void *sap, 67static int irlan_provider_data_indication(void *instance, void *sap,
68 struct sk_buff *skb) 68 struct sk_buff *skb)
69{ 69{
70 struct irlan_cb *self; 70 struct irlan_cb *self;
71 __u8 code; 71 __u8 code;
72 72
73 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 73 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
74 74
75 self = (struct irlan_cb *) instance; 75 self = (struct irlan_cb *) instance;
76 76
77 IRDA_ASSERT(self != NULL, return -1;); 77 IRDA_ASSERT(self != NULL, return -1;);
@@ -83,16 +83,16 @@ static int irlan_provider_data_indication(void *instance, void *sap,
83 switch(code) { 83 switch(code) {
84 case CMD_GET_PROVIDER_INFO: 84 case CMD_GET_PROVIDER_INFO:
85 IRDA_DEBUG(4, "Got GET_PROVIDER_INFO command!\n"); 85 IRDA_DEBUG(4, "Got GET_PROVIDER_INFO command!\n");
86 irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb); 86 irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb);
87 break; 87 break;
88 88
89 case CMD_GET_MEDIA_CHAR: 89 case CMD_GET_MEDIA_CHAR:
90 IRDA_DEBUG(4, "Got GET_MEDIA_CHAR command!\n"); 90 IRDA_DEBUG(4, "Got GET_MEDIA_CHAR command!\n");
91 irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb); 91 irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb);
92 break; 92 break;
93 case CMD_OPEN_DATA_CHANNEL: 93 case CMD_OPEN_DATA_CHANNEL:
94 IRDA_DEBUG(4, "Got OPEN_DATA_CHANNEL command!\n"); 94 IRDA_DEBUG(4, "Got OPEN_DATA_CHANNEL command!\n");
95 irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb); 95 irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb);
96 break; 96 break;
97 case CMD_FILTER_OPERATION: 97 case CMD_FILTER_OPERATION:
98 IRDA_DEBUG(4, "Got FILTER_OPERATION command!\n"); 98 IRDA_DEBUG(4, "Got FILTER_OPERATION command!\n");
@@ -119,9 +119,9 @@ static int irlan_provider_data_indication(void *instance, void *sap,
119 * Got connection from peer IrLAN client 119 * Got connection from peer IrLAN client
120 * 120 *
121 */ 121 */
122static void irlan_provider_connect_indication(void *instance, void *sap, 122static void irlan_provider_connect_indication(void *instance, void *sap,
123 struct qos_info *qos, 123 struct qos_info *qos,
124 __u32 max_sdu_size, 124 __u32 max_sdu_size,
125 __u8 max_header_size, 125 __u8 max_header_size,
126 struct sk_buff *skb) 126 struct sk_buff *skb)
127{ 127{
@@ -130,13 +130,13 @@ static void irlan_provider_connect_indication(void *instance, void *sap,
130 __u32 saddr, daddr; 130 __u32 saddr, daddr;
131 131
132 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); 132 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
133 133
134 self = (struct irlan_cb *) instance; 134 self = (struct irlan_cb *) instance;
135 tsap = (struct tsap_cb *) sap; 135 tsap = (struct tsap_cb *) sap;
136 136
137 IRDA_ASSERT(self != NULL, return;); 137 IRDA_ASSERT(self != NULL, return;);
138 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 138 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
139 139
140 IRDA_ASSERT(tsap == self->provider.tsap_ctrl,return;); 140 IRDA_ASSERT(tsap == self->provider.tsap_ctrl,return;);
141 IRDA_ASSERT(self->provider.state == IRLAN_IDLE, return;); 141 IRDA_ASSERT(self->provider.state == IRLAN_IDLE, return;);
142 142
@@ -147,13 +147,13 @@ static void irlan_provider_connect_indication(void *instance, void *sap,
147 147
148 irlan_do_provider_event(self, IRLAN_CONNECT_INDICATION, NULL); 148 irlan_do_provider_event(self, IRLAN_CONNECT_INDICATION, NULL);
149 149
150 /* 150 /*
151 * If we are in peer mode, the client may not have got the discovery 151 * If we are in peer mode, the client may not have got the discovery
152 * indication it needs to make progress. If the client is still in 152 * indication it needs to make progress. If the client is still in
153 * IDLE state, we must kick it. 153 * IDLE state, we must kick it.
154 */ 154 */
155 if ((self->provider.access_type == ACCESS_PEER) && 155 if ((self->provider.access_type == ACCESS_PEER) &&
156 (self->client.state == IRLAN_IDLE)) 156 (self->client.state == IRLAN_IDLE))
157 { 157 {
158 irlan_client_wakeup(self, self->saddr, self->daddr); 158 irlan_client_wakeup(self, self->saddr, self->daddr);
159 } 159 }
@@ -175,38 +175,38 @@ void irlan_provider_connect_response(struct irlan_cb *self,
175 irttp_connect_response(tsap, IRLAN_MTU, NULL); 175 irttp_connect_response(tsap, IRLAN_MTU, NULL);
176} 176}
177 177
178static void irlan_provider_disconnect_indication(void *instance, void *sap, 178static void irlan_provider_disconnect_indication(void *instance, void *sap,
179 LM_REASON reason, 179 LM_REASON reason,
180 struct sk_buff *userdata) 180 struct sk_buff *userdata)
181{ 181{
182 struct irlan_cb *self; 182 struct irlan_cb *self;
183 struct tsap_cb *tsap; 183 struct tsap_cb *tsap;
184 184
185 IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); 185 IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason);
186 186
187 self = (struct irlan_cb *) instance; 187 self = (struct irlan_cb *) instance;
188 tsap = (struct tsap_cb *) sap; 188 tsap = (struct tsap_cb *) sap;
189 189
190 IRDA_ASSERT(self != NULL, return;); 190 IRDA_ASSERT(self != NULL, return;);
191 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 191 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
192 IRDA_ASSERT(tsap != NULL, return;); 192 IRDA_ASSERT(tsap != NULL, return;);
193 IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); 193 IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;);
194 194
195 IRDA_ASSERT(tsap == self->provider.tsap_ctrl, return;); 195 IRDA_ASSERT(tsap == self->provider.tsap_ctrl, return;);
196 196
197 irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); 197 irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL);
198} 198}
199 199
200/* 200/*
201 * Function irlan_parse_open_data_cmd (self, skb) 201 * Function irlan_parse_open_data_cmd (self, skb)
202 * 202 *
203 * 203 *
204 * 204 *
205 */ 205 */
206int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb) 206int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb)
207{ 207{
208 int ret; 208 int ret;
209 209
210 ret = irlan_provider_parse_command(self, CMD_OPEN_DATA_CHANNEL, skb); 210 ret = irlan_provider_parse_command(self, CMD_OPEN_DATA_CHANNEL, skb);
211 211
212 /* Open data channel */ 212 /* Open data channel */
@@ -218,12 +218,12 @@ int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb)
218/* 218/*
219 * Function parse_command (skb) 219 * Function parse_command (skb)
220 * 220 *
221 * Extract all parameters from received buffer, then feed them to 221 * Extract all parameters from received buffer, then feed them to
222 * check_params for parsing 222 * check_params for parsing
223 * 223 *
224 */ 224 */
225int irlan_provider_parse_command(struct irlan_cb *self, int cmd, 225int irlan_provider_parse_command(struct irlan_cb *self, int cmd,
226 struct sk_buff *skb) 226 struct sk_buff *skb)
227{ 227{
228 __u8 *frame; 228 __u8 *frame;
229 __u8 *ptr; 229 __u8 *ptr;
@@ -231,16 +231,16 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd,
231 __u16 val_len; 231 __u16 val_len;
232 int i; 232 int i;
233 char *name; 233 char *name;
234 char *value; 234 char *value;
235 int ret = RSP_SUCCESS; 235 int ret = RSP_SUCCESS;
236 236
237 IRDA_ASSERT(skb != NULL, return -RSP_PROTOCOL_ERROR;); 237 IRDA_ASSERT(skb != NULL, return -RSP_PROTOCOL_ERROR;);
238 238
239 IRDA_DEBUG(4, "%s(), skb->len=%d\n", __FUNCTION__ , (int)skb->len); 239 IRDA_DEBUG(4, "%s(), skb->len=%d\n", __FUNCTION__ , (int)skb->len);
240 240
241 IRDA_ASSERT(self != NULL, return -RSP_PROTOCOL_ERROR;); 241 IRDA_ASSERT(self != NULL, return -RSP_PROTOCOL_ERROR;);
242 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -RSP_PROTOCOL_ERROR;); 242 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -RSP_PROTOCOL_ERROR;);
243 243
244 if (!skb) 244 if (!skb)
245 return -RSP_PROTOCOL_ERROR; 245 return -RSP_PROTOCOL_ERROR;
246 246
@@ -259,11 +259,11 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd,
259 count = frame[1]; 259 count = frame[1];
260 260
261 IRDA_DEBUG(4, "Got %d parameters\n", count); 261 IRDA_DEBUG(4, "Got %d parameters\n", count);
262 262
263 ptr = frame+2; 263 ptr = frame+2;
264 264
265 /* For all parameters */ 265 /* For all parameters */
266 for (i=0; i<count;i++) { 266 for (i=0; i<count;i++) {
267 ret = irlan_extract_param(ptr, name, value, &val_len); 267 ret = irlan_extract_param(ptr, name, value, &val_len);
268 if (ret < 0) { 268 if (ret < 0) {
269 IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ ); 269 IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ );
@@ -286,7 +286,7 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd,
286 * Send reply to query to peer IrLAN layer 286 * Send reply to query to peer IrLAN layer
287 * 287 *
288 */ 288 */
289void irlan_provider_send_reply(struct irlan_cb *self, int command, 289void irlan_provider_send_reply(struct irlan_cb *self, int command,
290 int ret_code) 290 int ret_code)
291{ 291{
292 struct sk_buff *skb; 292 struct sk_buff *skb;
@@ -310,7 +310,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command,
310 /* Reserve space for TTP, LMP, and LAP header */ 310 /* Reserve space for TTP, LMP, and LAP header */
311 skb_reserve(skb, self->provider.max_header_size); 311 skb_reserve(skb, self->provider.max_header_size);
312 skb_put(skb, 2); 312 skb_put(skb, 2);
313 313
314 switch (command) { 314 switch (command) {
315 case CMD_GET_PROVIDER_INFO: 315 case CMD_GET_PROVIDER_INFO:
316 skb->data[0] = 0x00; /* Success */ 316 skb->data[0] = 0x00; /* Success */
@@ -356,7 +356,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command,
356 skb->data[0] = 0x00; /* Success */ 356 skb->data[0] = 0x00; /* Success */
357 if (self->provider.send_arb_val) { 357 if (self->provider.send_arb_val) {
358 skb->data[1] = 0x03; /* 3 parameters */ 358 skb->data[1] = 0x03; /* 3 parameters */
359 irlan_insert_short_param(skb, "CON_ARB", 359 irlan_insert_short_param(skb, "CON_ARB",
360 self->provider.send_arb_val); 360 self->provider.send_arb_val);
361 } else 361 } else
362 skb->data[1] = 0x02; /* 2 parameters */ 362 skb->data[1] = 0x02; /* 2 parameters */
@@ -378,13 +378,13 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command,
378 * Function irlan_provider_register(void) 378 * Function irlan_provider_register(void)
379 * 379 *
380 * Register provider support so we can accept incoming connections. 380 * Register provider support so we can accept incoming connections.
381 * 381 *
382 */ 382 */
383int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) 383int irlan_provider_open_ctrl_tsap(struct irlan_cb *self)
384{ 384{
385 struct tsap_cb *tsap; 385 struct tsap_cb *tsap;
386 notify_t notify; 386 notify_t notify;
387 387
388 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 388 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
389 389
390 IRDA_ASSERT(self != NULL, return -1;); 390 IRDA_ASSERT(self != NULL, return -1;);
@@ -393,7 +393,7 @@ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self)
393 /* Check if already open */ 393 /* Check if already open */
394 if (self->provider.tsap_ctrl) 394 if (self->provider.tsap_ctrl)
395 return -1; 395 return -1;
396 396
397 /* 397 /*
398 * First register well known control TSAP 398 * First register well known control TSAP
399 */ 399 */
diff --git a/net/irda/irlan/irlan_provider_event.c b/net/irda/irlan/irlan_provider_event.c
index 5a086f9827ed..ef401bd6ea00 100644
--- a/net/irda/irlan/irlan_provider_event.c
+++ b/net/irda/irlan/irlan_provider_event.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irlan_provider_event.c 3 * Filename: irlan_provider_event.c
4 * Version: 0.9 4 * Version: 0.9
5 * Description: IrLAN provider state machine) 5 * Description: IrLAN provider state machine)
@@ -8,16 +8,16 @@
8 * Created at: Sun Aug 31 20:14:37 1997 8 * Created at: Sun Aug 31 20:14:37 1997
9 * Modified at: Sat Oct 30 12:52:41 1999 9 * Modified at: Sat Oct 30 12:52:41 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. 12 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
13 * 13 *
14 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as 15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * Neither Dag Brattli nor University of Tromsų admit liability nor 19 * Neither Dag Brattli nor University of Tromsų admit liability nor
20 * provide warranty for any of this software. This material is 20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charge. 21 * provided "AS-IS" and at no charge.
22 * 22 *
23 ********************************************************************/ 23 ********************************************************************/
@@ -30,18 +30,18 @@
30#include <net/irda/irlan_provider.h> 30#include <net/irda/irlan_provider.h>
31#include <net/irda/irlan_event.h> 31#include <net/irda/irlan_event.h>
32 32
33static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, 33static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event,
34 struct sk_buff *skb); 34 struct sk_buff *skb);
35static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, 35static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event,
36 struct sk_buff *skb); 36 struct sk_buff *skb);
37static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, 37static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event,
38 struct sk_buff *skb); 38 struct sk_buff *skb);
39static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, 39static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event,
40 struct sk_buff *skb); 40 struct sk_buff *skb);
41 41
42static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, 42static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event,
43 struct sk_buff *skb) = 43 struct sk_buff *skb) =
44{ 44{
45 irlan_provider_state_idle, 45 irlan_provider_state_idle,
46 NULL, /* Query */ 46 NULL, /* Query */
47 NULL, /* Info */ 47 NULL, /* Info */
@@ -55,8 +55,8 @@ static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event,
55 NULL, /* Sync */ 55 NULL, /* Sync */
56}; 56};
57 57
58void irlan_do_provider_event(struct irlan_cb *self, IRLAN_EVENT event, 58void irlan_do_provider_event(struct irlan_cb *self, IRLAN_EVENT event,
59 struct sk_buff *skb) 59 struct sk_buff *skb)
60{ 60{
61 IRDA_ASSERT(*state[ self->provider.state] != NULL, return;); 61 IRDA_ASSERT(*state[ self->provider.state] != NULL, return;);
62 62
@@ -73,9 +73,9 @@ static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event,
73 struct sk_buff *skb) 73 struct sk_buff *skb)
74{ 74{
75 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 75 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
76 76
77 IRDA_ASSERT(self != NULL, return -1;); 77 IRDA_ASSERT(self != NULL, return -1;);
78 78
79 switch(event) { 79 switch(event) {
80 case IRLAN_CONNECT_INDICATION: 80 case IRLAN_CONNECT_INDICATION:
81 irlan_provider_connect_response( self, self->provider.tsap_ctrl); 81 irlan_provider_connect_response( self, self->provider.tsap_ctrl);
@@ -96,13 +96,13 @@ static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event,
96 * 96 *
97 * INFO, We have issued a GetInfo command and is awaiting a reply. 97 * INFO, We have issued a GetInfo command and is awaiting a reply.
98 */ 98 */
99static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, 99static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event,
100 struct sk_buff *skb) 100 struct sk_buff *skb)
101{ 101{
102 int ret; 102 int ret;
103 103
104 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 104 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
105 105
106 IRDA_ASSERT(self != NULL, return -1;); 106 IRDA_ASSERT(self != NULL, return -1;);
107 107
108 switch(event) { 108 switch(event) {
@@ -110,7 +110,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event,
110 /* Be sure to use 802.3 in case of peer mode */ 110 /* Be sure to use 802.3 in case of peer mode */
111 if (self->provider.access_type == ACCESS_PEER) { 111 if (self->provider.access_type == ACCESS_PEER) {
112 self->media = MEDIA_802_3; 112 self->media = MEDIA_802_3;
113 113
114 /* Check if client has started yet */ 114 /* Check if client has started yet */
115 if (self->client.state == IRLAN_IDLE) { 115 if (self->client.state == IRLAN_IDLE) {
116 /* This should get the client going */ 116 /* This should get the client going */
@@ -118,15 +118,15 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event,
118 } 118 }
119 } 119 }
120 120
121 irlan_provider_send_reply(self, CMD_GET_PROVIDER_INFO, 121 irlan_provider_send_reply(self, CMD_GET_PROVIDER_INFO,
122 RSP_SUCCESS); 122 RSP_SUCCESS);
123 /* Keep state */ 123 /* Keep state */
124 break; 124 break;
125 case IRLAN_GET_MEDIA_CMD: 125 case IRLAN_GET_MEDIA_CMD:
126 irlan_provider_send_reply(self, CMD_GET_MEDIA_CHAR, 126 irlan_provider_send_reply(self, CMD_GET_MEDIA_CHAR,
127 RSP_SUCCESS); 127 RSP_SUCCESS);
128 /* Keep state */ 128 /* Keep state */
129 break; 129 break;
130 case IRLAN_OPEN_DATA_CMD: 130 case IRLAN_OPEN_DATA_CMD:
131 ret = irlan_parse_open_data_cmd(self, skb); 131 ret = irlan_parse_open_data_cmd(self, skb);
132 if (self->provider.access_type == ACCESS_PEER) { 132 if (self->provider.access_type == ACCESS_PEER) {
@@ -152,7 +152,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event,
152 } 152 }
153 if (skb) 153 if (skb)
154 dev_kfree_skb(skb); 154 dev_kfree_skb(skb);
155 155
156 return 0; 156 return 0;
157} 157}
158 158
@@ -163,7 +163,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event,
163 * reply 163 * reply
164 * 164 *
165 */ 165 */
166static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, 166static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event,
167 struct sk_buff *skb) 167 struct sk_buff *skb)
168{ 168{
169 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 169 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
@@ -173,11 +173,11 @@ static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event,
173 switch(event) { 173 switch(event) {
174 case IRLAN_FILTER_CONFIG_CMD: 174 case IRLAN_FILTER_CONFIG_CMD:
175 irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb); 175 irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb);
176 irlan_provider_send_reply(self, CMD_FILTER_OPERATION, 176 irlan_provider_send_reply(self, CMD_FILTER_OPERATION,
177 RSP_SUCCESS); 177 RSP_SUCCESS);
178 /* Keep state */ 178 /* Keep state */
179 break; 179 break;
180 case IRLAN_DATA_CONNECT_INDICATION: 180 case IRLAN_DATA_CONNECT_INDICATION:
181 irlan_next_provider_state(self, IRLAN_DATA); 181 irlan_next_provider_state(self, IRLAN_DATA);
182 irlan_provider_connect_response(self, self->tsap_data); 182 irlan_provider_connect_response(self, self->tsap_data);
183 break; 183 break;
@@ -202,8 +202,8 @@ static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event,
202 * the local and remote machines. 202 * the local and remote machines.
203 * 203 *
204 */ 204 */
205static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, 205static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event,
206 struct sk_buff *skb) 206 struct sk_buff *skb)
207{ 207{
208 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 208 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
209 209
@@ -213,7 +213,7 @@ static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event,
213 switch(event) { 213 switch(event) {
214 case IRLAN_FILTER_CONFIG_CMD: 214 case IRLAN_FILTER_CONFIG_CMD:
215 irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb); 215 irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb);
216 irlan_provider_send_reply(self, CMD_FILTER_OPERATION, 216 irlan_provider_send_reply(self, CMD_FILTER_OPERATION,
217 RSP_SUCCESS); 217 RSP_SUCCESS);
218 break; 218 break;
219 case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */ 219 case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */
@@ -226,7 +226,7 @@ static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event,
226 } 226 }
227 if (skb) 227 if (skb)
228 dev_kfree_skb(skb); 228 dev_kfree_skb(skb);
229 229
230 return 0; 230 return 0;
231} 231}
232 232
diff --git a/net/irda/irlap.c b/net/irda/irlap.c
index e7852a07495e..fd73e4af715a 100644
--- a/net/irda/irlap.c
+++ b/net/irda/irlap.c
@@ -87,7 +87,7 @@ int __init irlap_init(void)
87 /* Allocate master array */ 87 /* Allocate master array */
88 irlap = hashbin_new(HB_LOCK); 88 irlap = hashbin_new(HB_LOCK);
89 if (irlap == NULL) { 89 if (irlap == NULL) {
90 IRDA_ERROR("%s: can't allocate irlap hashbin!\n", 90 IRDA_ERROR("%s: can't allocate irlap hashbin!\n",
91 __FUNCTION__); 91 __FUNCTION__);
92 return -ENOMEM; 92 return -ENOMEM;
93 } 93 }
@@ -701,8 +701,8 @@ void irlap_update_nr_received(struct irlap_cb *self, int nr)
701 int count = 0; 701 int count = 0;
702 702
703 /* 703 /*
704 * Remove all the ack-ed frames from the window queue. 704 * Remove all the ack-ed frames from the window queue.
705 */ 705 */
706 706
707 /* 707 /*
708 * Optimize for the common case. It is most likely that the receiver 708 * Optimize for the common case. It is most likely that the receiver
@@ -1109,13 +1109,13 @@ static void *irlap_seq_start(struct seq_file *seq, loff_t *pos)
1109 spin_lock_irq(&irlap->hb_spinlock); 1109 spin_lock_irq(&irlap->hb_spinlock);
1110 iter->id = 0; 1110 iter->id = 0;
1111 1111
1112 for (self = (struct irlap_cb *) hashbin_get_first(irlap); 1112 for (self = (struct irlap_cb *) hashbin_get_first(irlap);
1113 self; self = (struct irlap_cb *) hashbin_get_next(irlap)) { 1113 self; self = (struct irlap_cb *) hashbin_get_next(irlap)) {
1114 if (iter->id == *pos) 1114 if (iter->id == *pos)
1115 break; 1115 break;
1116 ++iter->id; 1116 ++iter->id;
1117 } 1117 }
1118 1118
1119 return self; 1119 return self;
1120} 1120}
1121 1121
@@ -1137,7 +1137,7 @@ static int irlap_seq_show(struct seq_file *seq, void *v)
1137{ 1137{
1138 const struct irlap_iter_state *iter = seq->private; 1138 const struct irlap_iter_state *iter = seq->private;
1139 const struct irlap_cb *self = v; 1139 const struct irlap_cb *self = v;
1140 1140
1141 IRDA_ASSERT(self->magic == LAP_MAGIC, return -EINVAL;); 1141 IRDA_ASSERT(self->magic == LAP_MAGIC, return -EINVAL;);
1142 1142
1143 seq_printf(seq, "irlap%d ", iter->id); 1143 seq_printf(seq, "irlap%d ", iter->id);
@@ -1222,7 +1222,7 @@ static int irlap_seq_open(struct inode *inode, struct file *file)
1222 struct seq_file *seq; 1222 struct seq_file *seq;
1223 int rc = -ENOMEM; 1223 int rc = -ENOMEM;
1224 struct irlap_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); 1224 struct irlap_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
1225 1225
1226 if (!s) 1226 if (!s)
1227 goto out; 1227 goto out;
1228 1228
diff --git a/net/irda/irlap_event.c b/net/irda/irlap_event.c
index 99faff68c399..7b6433fe1dc2 100644
--- a/net/irda/irlap_event.c
+++ b/net/irda/irlap_event.c
@@ -827,7 +827,7 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event,
827 irlap_disconnect_indication(self, LAP_DISC_INDICATION); 827 irlap_disconnect_indication(self, LAP_DISC_INDICATION);
828 break; 828 break;
829 default: 829 default:
830 IRDA_DEBUG(1, "%s(), Unknown event %d, %s\n", __FUNCTION__, 830 IRDA_DEBUG(1, "%s(), Unknown event %d, %s\n", __FUNCTION__,
831 event, irlap_event[event]); 831 event, irlap_event[event]);
832 832
833 ret = -1; 833 ret = -1;
@@ -864,7 +864,7 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
864 * between 15 msecs and 45 msecs. 864 * between 15 msecs and 45 msecs.
865 */ 865 */
866 irlap_start_backoff_timer(self, msecs_to_jiffies(20 + 866 irlap_start_backoff_timer(self, msecs_to_jiffies(20 +
867 (jiffies % 30))); 867 (jiffies % 30)));
868 } else { 868 } else {
869 /* Always switch state before calling upper layers */ 869 /* Always switch state before calling upper layers */
870 irlap_next_state(self, LAP_NDM); 870 irlap_next_state(self, LAP_NDM);
@@ -1377,7 +1377,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
1377 /* Resend rejected frames */ 1377 /* Resend rejected frames */
1378 irlap_resend_rejected_frames(self, CMD_FRAME); 1378 irlap_resend_rejected_frames(self, CMD_FRAME);
1379 1379
1380 /* Give peer some time to retransmit! 1380 /* Give peer some time to retransmit!
1381 * But account for our own Tx. */ 1381 * But account for our own Tx. */
1382 irlap_start_final_timer(self, 2 * self->final_timeout); 1382 irlap_start_final_timer(self, 2 * self->final_timeout);
1383 1383
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index dba349c832d0..0b04603e9c47 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -414,7 +414,7 @@ static void irlap_recv_discovery_xid_rsp(struct irlap_cb *self,
414 IRDA_ERROR("%s: frame to short!\n", __FUNCTION__); 414 IRDA_ERROR("%s: frame to short!\n", __FUNCTION__);
415 return; 415 return;
416 } 416 }
417 417
418 xid = (struct xid_frame *) skb->data; 418 xid = (struct xid_frame *) skb->data;
419 419
420 info->daddr = le32_to_cpu(xid->saddr); 420 info->daddr = le32_to_cpu(xid->saddr);
@@ -485,7 +485,7 @@ static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self,
485 IRDA_ERROR("%s: frame to short!\n", __FUNCTION__); 485 IRDA_ERROR("%s: frame to short!\n", __FUNCTION__);
486 return; 486 return;
487 } 487 }
488 488
489 xid = (struct xid_frame *) skb->data; 489 xid = (struct xid_frame *) skb->data;
490 490
491 info->daddr = le32_to_cpu(xid->saddr); 491 info->daddr = le32_to_cpu(xid->saddr);
@@ -524,7 +524,7 @@ static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self,
524 */ 524 */
525 if (info->s == 0xff) { 525 if (info->s == 0xff) {
526 /* Check if things are sane at this point... */ 526 /* Check if things are sane at this point... */
527 if((discovery_info == NULL) || 527 if((discovery_info == NULL) ||
528 !pskb_may_pull(skb, 3)) { 528 !pskb_may_pull(skb, 3)) {
529 IRDA_ERROR("%s: discovery frame to short!\n", 529 IRDA_ERROR("%s: discovery frame to short!\n",
530 __FUNCTION__); 530 __FUNCTION__);
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index 7e5d12ab3b90..b134c3cf2bdb 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -116,7 +116,7 @@ int __init irlmp_init(void)
116 * Remove IrLMP layer 116 * Remove IrLMP layer
117 * 117 *
118 */ 118 */
119void __exit irlmp_cleanup(void) 119void __exit irlmp_cleanup(void)
120{ 120{
121 /* Check for main structure */ 121 /* Check for main structure */
122 IRDA_ASSERT(irlmp != NULL, return;); 122 IRDA_ASSERT(irlmp != NULL, return;);
@@ -892,7 +892,7 @@ void irlmp_discovery_request(int nslots)
892 892
893 /* 893 /*
894 * Start a single discovery operation if discovery is not already 894 * Start a single discovery operation if discovery is not already
895 * running 895 * running
896 */ 896 */
897 if (!sysctl_discovery) { 897 if (!sysctl_discovery) {
898 /* Check if user wants to override the default */ 898 /* Check if user wants to override the default */
@@ -1528,12 +1528,12 @@ int irlmp_unregister_service(void *handle)
1528 1528
1529 /* Refresh current hint bits */ 1529 /* Refresh current hint bits */
1530 spin_lock_irqsave(&irlmp->services->hb_spinlock, flags); 1530 spin_lock_irqsave(&irlmp->services->hb_spinlock, flags);
1531 service = (irlmp_service_t *) hashbin_get_first(irlmp->services); 1531 service = (irlmp_service_t *) hashbin_get_first(irlmp->services);
1532 while (service) { 1532 while (service) {
1533 irlmp->hints.word |= service->hints.word; 1533 irlmp->hints.word |= service->hints.word;
1534 1534
1535 service = (irlmp_service_t *)hashbin_get_next(irlmp->services); 1535 service = (irlmp_service_t *)hashbin_get_next(irlmp->services);
1536 } 1536 }
1537 spin_unlock_irqrestore(&irlmp->services->hb_spinlock, flags); 1537 spin_unlock_irqrestore(&irlmp->services->hb_spinlock, flags);
1538 return 0; 1538 return 0;
1539} 1539}
@@ -1861,7 +1861,7 @@ static void *irlmp_seq_hb_idx(struct irlmp_iter_state *iter, loff_t *off)
1861 1861
1862 spin_lock_irq(&iter->hashbin->hb_spinlock); 1862 spin_lock_irq(&iter->hashbin->hb_spinlock);
1863 for (element = hashbin_get_first(iter->hashbin); 1863 for (element = hashbin_get_first(iter->hashbin);
1864 element != NULL; 1864 element != NULL;
1865 element = hashbin_get_next(iter->hashbin)) { 1865 element = hashbin_get_next(iter->hashbin)) {
1866 if (!off || *off-- == 0) { 1866 if (!off || *off-- == 0) {
1867 /* NB: hashbin left locked */ 1867 /* NB: hashbin left locked */
@@ -1918,7 +1918,7 @@ static void *irlmp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1918 if (v == NULL) { /* no more in this hash bin */ 1918 if (v == NULL) { /* no more in this hash bin */
1919 spin_unlock_irq(&iter->hashbin->hb_spinlock); 1919 spin_unlock_irq(&iter->hashbin->hb_spinlock);
1920 1920
1921 if (iter->hashbin == irlmp->unconnected_lsaps) 1921 if (iter->hashbin == irlmp->unconnected_lsaps)
1922 v = LINK_START_TOKEN; 1922 v = LINK_START_TOKEN;
1923 1923
1924 iter->hashbin = NULL; 1924 iter->hashbin = NULL;
diff --git a/net/irda/irlmp_event.c b/net/irda/irlmp_event.c
index 4c90dd1b4503..65ffa981510a 100644
--- a/net/irda/irlmp_event.c
+++ b/net/irda/irlmp_event.c
@@ -615,7 +615,7 @@ static int irlmp_state_connect(struct lsap_cb *self, IRLMP_EVENT event,
615 default: 615 default:
616 /* LM_LAP_DISCONNECT_INDICATION : Should never happen, we 616 /* LM_LAP_DISCONNECT_INDICATION : Should never happen, we
617 * are *not* yet bound to the IrLAP link. Jean II */ 617 * are *not* yet bound to the IrLAP link. Jean II */
618 IRDA_DEBUG(0, "%s(), Unknown event %s on LSAP %#02x\n", 618 IRDA_DEBUG(0, "%s(), Unknown event %s on LSAP %#02x\n",
619 __FUNCTION__, irlmp_event[event], self->slsap_sel); 619 __FUNCTION__, irlmp_event[event], self->slsap_sel);
620 break; 620 break;
621 } 621 }
diff --git a/net/irda/irlmp_frame.c b/net/irda/irlmp_frame.c
index 39761a1d18f5..559302d3fe66 100644
--- a/net/irda/irlmp_frame.c
+++ b/net/irda/irlmp_frame.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irlmp_frame.c 3 * Filename: irlmp_frame.c
4 * Version: 0.9 4 * Version: 0.9
5 * Description: IrLMP frame implementation 5 * Description: IrLMP frame implementation
@@ -8,18 +8,18 @@
8 * Created at: Tue Aug 19 02:09:59 1997 8 * Created at: Tue Aug 19 02:09:59 1997
9 * Modified at: Mon Dec 13 13:41:12 1999 9 * Modified at: Mon Dec 13 13:41:12 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no> 12 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>
13 * All Rights Reserved. 13 * All Rights Reserved.
14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> 14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as 17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * Neither Dag Brattli nor University of Tromsų admit liability nor 21 * Neither Dag Brattli nor University of Tromsų admit liability nor
22 * provide warranty for any of this software. This material is 22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge. 23 * provided "AS-IS" and at no charge.
24 * 24 *
25 ********************************************************************/ 25 ********************************************************************/
@@ -34,7 +34,7 @@
34#include <net/irda/irlmp_frame.h> 34#include <net/irda/irlmp_frame.h>
35#include <net/irda/discovery.h> 35#include <net/irda/discovery.h>
36 36
37static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap, 37static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap,
38 __u8 slsap, int status, hashbin_t *); 38 __u8 slsap, int status, hashbin_t *);
39 39
40inline void irlmp_send_data_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, 40inline void irlmp_send_data_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap,
@@ -56,18 +56,18 @@ inline void irlmp_send_data_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap,
56 * Send Link Control Frame to IrLAP 56 * Send Link Control Frame to IrLAP
57 */ 57 */
58void irlmp_send_lcf_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, 58void irlmp_send_lcf_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap,
59 __u8 opcode, struct sk_buff *skb) 59 __u8 opcode, struct sk_buff *skb)
60{ 60{
61 __u8 *frame; 61 __u8 *frame;
62 62
63 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 63 IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
64 64
65 IRDA_ASSERT(self != NULL, return;); 65 IRDA_ASSERT(self != NULL, return;);
66 IRDA_ASSERT(self->magic == LMP_LAP_MAGIC, return;); 66 IRDA_ASSERT(self->magic == LMP_LAP_MAGIC, return;);
67 IRDA_ASSERT(skb != NULL, return;); 67 IRDA_ASSERT(skb != NULL, return;);
68 68
69 frame = skb->data; 69 frame = skb->data;
70 70
71 frame[0] = dlsap | CONTROL_BIT; 71 frame[0] = dlsap | CONTROL_BIT;
72 frame[1] = slsap; 72 frame[1] = slsap;
73 73
@@ -87,14 +87,14 @@ void irlmp_send_lcf_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap,
87 * Used by IrLAP to pass received data frames to IrLMP layer 87 * Used by IrLAP to pass received data frames to IrLMP layer
88 * 88 *
89 */ 89 */
90void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, 90void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb,
91 int unreliable) 91 int unreliable)
92{ 92{
93 struct lsap_cb *lsap; 93 struct lsap_cb *lsap;
94 __u8 slsap_sel; /* Source (this) LSAP address */ 94 __u8 slsap_sel; /* Source (this) LSAP address */
95 __u8 dlsap_sel; /* Destination LSAP address */ 95 __u8 dlsap_sel; /* Destination LSAP address */
96 __u8 *fp; 96 __u8 *fp;
97 97
98 IRDA_DEBUG(4, "%s()\n", __FUNCTION__); 98 IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
99 99
100 IRDA_ASSERT(self != NULL, return;); 100 IRDA_ASSERT(self != NULL, return;);
@@ -104,11 +104,11 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb,
104 fp = skb->data; 104 fp = skb->data;
105 105
106 /* 106 /*
107 * The next statements may be confusing, but we do this so that 107 * The next statements may be confusing, but we do this so that
108 * destination LSAP of received frame is source LSAP in our view 108 * destination LSAP of received frame is source LSAP in our view
109 */ 109 */
110 slsap_sel = fp[0] & LSAP_MASK; 110 slsap_sel = fp[0] & LSAP_MASK;
111 dlsap_sel = fp[1]; 111 dlsap_sel = fp[1];
112 112
113 /* 113 /*
114 * Check if this is an incoming connection, since we must deal with 114 * Check if this is an incoming connection, since we must deal with
@@ -118,11 +118,11 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb,
118 IRDA_DEBUG(3, "%s(), incoming connection, " 118 IRDA_DEBUG(3, "%s(), incoming connection, "
119 "source LSAP=%d, dest LSAP=%d\n", 119 "source LSAP=%d, dest LSAP=%d\n",
120 __FUNCTION__, slsap_sel, dlsap_sel); 120 __FUNCTION__, slsap_sel, dlsap_sel);
121 121
122 /* Try to find LSAP among the unconnected LSAPs */ 122 /* Try to find LSAP among the unconnected LSAPs */
123 lsap = irlmp_find_lsap(self, dlsap_sel, slsap_sel, CONNECT_CMD, 123 lsap = irlmp_find_lsap(self, dlsap_sel, slsap_sel, CONNECT_CMD,
124 irlmp->unconnected_lsaps); 124 irlmp->unconnected_lsaps);
125 125
126 /* Maybe LSAP was already connected, so try one more time */ 126 /* Maybe LSAP was already connected, so try one more time */
127 if (!lsap) { 127 if (!lsap) {
128 IRDA_DEBUG(1, "%s(), incoming connection for LSAP already connected\n", __FUNCTION__); 128 IRDA_DEBUG(1, "%s(), incoming connection for LSAP already connected\n", __FUNCTION__);
@@ -130,9 +130,9 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb,
130 self->lsaps); 130 self->lsaps);
131 } 131 }
132 } else 132 } else
133 lsap = irlmp_find_lsap(self, dlsap_sel, slsap_sel, 0, 133 lsap = irlmp_find_lsap(self, dlsap_sel, slsap_sel, 0,
134 self->lsaps); 134 self->lsaps);
135 135
136 if (lsap == NULL) { 136 if (lsap == NULL) {
137 IRDA_DEBUG(2, "IrLMP, Sorry, no LSAP for received frame!\n"); 137 IRDA_DEBUG(2, "IrLMP, Sorry, no LSAP for received frame!\n");
138 IRDA_DEBUG(2, "%s(), slsap_sel = %02x, dlsap_sel = %02x\n", 138 IRDA_DEBUG(2, "%s(), slsap_sel = %02x, dlsap_sel = %02x\n",
@@ -146,8 +146,8 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb,
146 return; 146 return;
147 } 147 }
148 148
149 /* 149 /*
150 * Check if we received a control frame? 150 * Check if we received a control frame?
151 */ 151 */
152 if (fp[0] & CONTROL_BIT) { 152 if (fp[0] & CONTROL_BIT) {
153 switch (fp[2]) { 153 switch (fp[2]) {
@@ -161,7 +161,7 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb,
161 case DISCONNECT: 161 case DISCONNECT:
162 IRDA_DEBUG(4, "%s(), Disconnect indication!\n", 162 IRDA_DEBUG(4, "%s(), Disconnect indication!\n",
163 __FUNCTION__); 163 __FUNCTION__);
164 irlmp_do_lsap_event(lsap, LM_DISCONNECT_INDICATION, 164 irlmp_do_lsap_event(lsap, LM_DISCONNECT_INDICATION,
165 skb); 165 skb);
166 break; 166 break;
167 case ACCESSMODE_CMD: 167 case ACCESSMODE_CMD:
@@ -181,7 +181,7 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb,
181 irlmp_udata_indication(lsap, skb); 181 irlmp_udata_indication(lsap, skb);
182 else 182 else
183 irlmp_do_lsap_event(lsap, LM_UDATA_INDICATION, skb); 183 irlmp_do_lsap_event(lsap, LM_UDATA_INDICATION, skb);
184 } else { 184 } else {
185 /* Optimize and bypass the state machine if possible */ 185 /* Optimize and bypass the state machine if possible */
186 if (lsap->lsap_state == LSAP_DATA_TRANSFER_READY) 186 if (lsap->lsap_state == LSAP_DATA_TRANSFER_READY)
187 irlmp_data_indication(lsap, skb); 187 irlmp_data_indication(lsap, skb);
@@ -193,7 +193,7 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb,
193/* 193/*
194 * Function irlmp_link_unitdata_indication (self, skb) 194 * Function irlmp_link_unitdata_indication (self, skb)
195 * 195 *
196 * 196 *
197 * 197 *
198 */ 198 */
199#ifdef CONFIG_IRDA_ULTRA 199#ifdef CONFIG_IRDA_ULTRA
@@ -205,7 +205,7 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb)
205 __u8 pid; /* Protocol identifier */ 205 __u8 pid; /* Protocol identifier */
206 __u8 *fp; 206 __u8 *fp;
207 unsigned long flags; 207 unsigned long flags;
208 208
209 IRDA_DEBUG(4, "%s()\n", __FUNCTION__); 209 IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
210 210
211 IRDA_ASSERT(self != NULL, return;); 211 IRDA_ASSERT(self != NULL, return;);
@@ -215,13 +215,13 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb)
215 fp = skb->data; 215 fp = skb->data;
216 216
217 /* 217 /*
218 * The next statements may be confusing, but we do this so that 218 * The next statements may be confusing, but we do this so that
219 * destination LSAP of received frame is source LSAP in our view 219 * destination LSAP of received frame is source LSAP in our view
220 */ 220 */
221 slsap_sel = fp[0] & LSAP_MASK; 221 slsap_sel = fp[0] & LSAP_MASK;
222 dlsap_sel = fp[1]; 222 dlsap_sel = fp[1];
223 pid = fp[2]; 223 pid = fp[2];
224 224
225 if (pid & 0x80) { 225 if (pid & 0x80) {
226 IRDA_DEBUG(0, "%s(), extension in PID not supp!\n", 226 IRDA_DEBUG(0, "%s(), extension in PID not supp!\n",
227 __FUNCTION__); 227 __FUNCTION__);
@@ -233,7 +233,7 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb)
233 IRDA_DEBUG(0, "%s(), dropping frame!\n", __FUNCTION__); 233 IRDA_DEBUG(0, "%s(), dropping frame!\n", __FUNCTION__);
234 return; 234 return;
235 } 235 }
236 236
237 /* Search the connectionless LSAP */ 237 /* Search the connectionless LSAP */
238 spin_lock_irqsave(&irlmp->unconnected_lsaps->hb_spinlock, flags); 238 spin_lock_irqsave(&irlmp->unconnected_lsaps->hb_spinlock, flags);
239 lsap = (struct lsap_cb *) hashbin_get_first(irlmp->unconnected_lsaps); 239 lsap = (struct lsap_cb *) hashbin_get_first(irlmp->unconnected_lsaps);
@@ -241,10 +241,10 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb)
241 /* 241 /*
242 * Check if source LSAP and dest LSAP selectors and PID match. 242 * Check if source LSAP and dest LSAP selectors and PID match.
243 */ 243 */
244 if ((lsap->slsap_sel == slsap_sel) && 244 if ((lsap->slsap_sel == slsap_sel) &&
245 (lsap->dlsap_sel == dlsap_sel) && 245 (lsap->dlsap_sel == dlsap_sel) &&
246 (lsap->pid == pid)) 246 (lsap->pid == pid))
247 { 247 {
248 break; 248 break;
249 } 249 }
250 lsap = (struct lsap_cb *) hashbin_get_next(irlmp->unconnected_lsaps); 250 lsap = (struct lsap_cb *) hashbin_get_next(irlmp->unconnected_lsaps);
@@ -262,12 +262,12 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb)
262/* 262/*
263 * Function irlmp_link_disconnect_indication (reason, userdata) 263 * Function irlmp_link_disconnect_indication (reason, userdata)
264 * 264 *
265 * IrLAP has disconnected 265 * IrLAP has disconnected
266 * 266 *
267 */ 267 */
268void irlmp_link_disconnect_indication(struct lap_cb *lap, 268void irlmp_link_disconnect_indication(struct lap_cb *lap,
269 struct irlap_cb *irlap, 269 struct irlap_cb *irlap,
270 LAP_REASON reason, 270 LAP_REASON reason,
271 struct sk_buff *skb) 271 struct sk_buff *skb)
272{ 272{
273 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 273 IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
@@ -278,8 +278,8 @@ void irlmp_link_disconnect_indication(struct lap_cb *lap,
278 lap->reason = reason; 278 lap->reason = reason;
279 lap->daddr = DEV_ADDR_ANY; 279 lap->daddr = DEV_ADDR_ANY;
280 280
281 /* FIXME: must do something with the skb if any */ 281 /* FIXME: must do something with the skb if any */
282 282
283 /* 283 /*
284 * Inform station state machine 284 * Inform station state machine
285 */ 285 */
@@ -292,9 +292,9 @@ void irlmp_link_disconnect_indication(struct lap_cb *lap,
292 * Incoming LAP connection! 292 * Incoming LAP connection!
293 * 293 *
294 */ 294 */
295void irlmp_link_connect_indication(struct lap_cb *self, __u32 saddr, 295void irlmp_link_connect_indication(struct lap_cb *self, __u32 saddr,
296 __u32 daddr, struct qos_info *qos, 296 __u32 daddr, struct qos_info *qos,
297 struct sk_buff *skb) 297 struct sk_buff *skb)
298{ 298{
299 IRDA_DEBUG(4, "%s()\n", __FUNCTION__); 299 IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
300 300
@@ -314,7 +314,7 @@ void irlmp_link_connect_indication(struct lap_cb *self, __u32 saddr,
314 * LAP connection confirmed! 314 * LAP connection confirmed!
315 * 315 *
316 */ 316 */
317void irlmp_link_connect_confirm(struct lap_cb *self, struct qos_info *qos, 317void irlmp_link_connect_confirm(struct lap_cb *self, struct qos_info *qos,
318 struct sk_buff *skb) 318 struct sk_buff *skb)
319{ 319{
320 IRDA_DEBUG(4, "%s()\n", __FUNCTION__); 320 IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
@@ -359,7 +359,7 @@ void irlmp_link_connect_confirm(struct lap_cb *self, struct qos_info *qos,
359 * 359 *
360 * Jean II 360 * Jean II
361 */ 361 */
362void irlmp_link_discovery_indication(struct lap_cb *self, 362void irlmp_link_discovery_indication(struct lap_cb *self,
363 discovery_t *discovery) 363 discovery_t *discovery)
364{ 364{
365 IRDA_ASSERT(self != NULL, return;); 365 IRDA_ASSERT(self != NULL, return;);
@@ -367,7 +367,7 @@ void irlmp_link_discovery_indication(struct lap_cb *self,
367 367
368 /* Add to main log, cleanup */ 368 /* Add to main log, cleanup */
369 irlmp_add_discovery(irlmp->cachelog, discovery); 369 irlmp_add_discovery(irlmp->cachelog, discovery);
370 370
371 /* Just handle it the same way as a discovery confirm, 371 /* Just handle it the same way as a discovery confirm,
372 * bypass the LM_LAP state machine (see below) */ 372 * bypass the LM_LAP state machine (see below) */
373 irlmp_discovery_confirm(irlmp->cachelog, DISCOVERY_PASSIVE); 373 irlmp_discovery_confirm(irlmp->cachelog, DISCOVERY_PASSIVE);
@@ -387,7 +387,7 @@ void irlmp_link_discovery_confirm(struct lap_cb *self, hashbin_t *log)
387 387
388 IRDA_ASSERT(self != NULL, return;); 388 IRDA_ASSERT(self != NULL, return;);
389 IRDA_ASSERT(self->magic == LMP_LAP_MAGIC, return;); 389 IRDA_ASSERT(self->magic == LMP_LAP_MAGIC, return;);
390 390
391 /* Add to main log, cleanup */ 391 /* Add to main log, cleanup */
392 irlmp_add_discovery_log(irlmp->cachelog, log); 392 irlmp_add_discovery_log(irlmp->cachelog, log);
393 393
@@ -420,7 +420,7 @@ static inline void irlmp_update_cache(struct lap_cb *lap,
420 * Find handle associated with destination and source LSAP 420 * Find handle associated with destination and source LSAP
421 * 421 *
422 * Any IrDA connection (LSAP/TSAP) is uniquely identified by 422 * Any IrDA connection (LSAP/TSAP) is uniquely identified by
423 * 3 parameters, the local lsap, the remote lsap and the remote address. 423 * 3 parameters, the local lsap, the remote lsap and the remote address.
424 * We may initiate multiple connections to the same remote service 424 * We may initiate multiple connections to the same remote service
425 * (they will have different local lsap), a remote device may initiate 425 * (they will have different local lsap), a remote device may initiate
426 * multiple connections to the same local service (they will have 426 * multiple connections to the same local service (they will have
@@ -433,20 +433,20 @@ static inline void irlmp_update_cache(struct lap_cb *lap,
433 */ 433 */
434static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel, 434static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel,
435 __u8 slsap_sel, int status, 435 __u8 slsap_sel, int status,
436 hashbin_t *queue) 436 hashbin_t *queue)
437{ 437{
438 struct lsap_cb *lsap; 438 struct lsap_cb *lsap;
439 unsigned long flags; 439 unsigned long flags;
440 440
441 /* 441 /*
442 * Optimize for the common case. We assume that the last frame 442 * Optimize for the common case. We assume that the last frame
443 * received is in the same connection as the last one, so check in 443 * received is in the same connection as the last one, so check in
444 * cache first to avoid the linear search 444 * cache first to avoid the linear search
445 */ 445 */
446#ifdef CONFIG_IRDA_CACHE_LAST_LSAP 446#ifdef CONFIG_IRDA_CACHE_LAST_LSAP
447 if ((self->cache.valid) && 447 if ((self->cache.valid) &&
448 (self->cache.slsap_sel == slsap_sel) && 448 (self->cache.slsap_sel == slsap_sel) &&
449 (self->cache.dlsap_sel == dlsap_sel)) 449 (self->cache.dlsap_sel == dlsap_sel))
450 { 450 {
451 return (self->cache.lsap); 451 return (self->cache.lsap);
452 } 452 }
@@ -456,14 +456,14 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel,
456 456
457 lsap = (struct lsap_cb *) hashbin_get_first(queue); 457 lsap = (struct lsap_cb *) hashbin_get_first(queue);
458 while (lsap != NULL) { 458 while (lsap != NULL) {
459 /* 459 /*
460 * If this is an incoming connection, then the destination 460 * If this is an incoming connection, then the destination
461 * LSAP selector may have been specified as LM_ANY so that 461 * LSAP selector may have been specified as LM_ANY so that
462 * any client can connect. In that case we only need to check 462 * any client can connect. In that case we only need to check
463 * if the source LSAP (in our view!) match! 463 * if the source LSAP (in our view!) match!
464 */ 464 */
465 if ((status == CONNECT_CMD) && 465 if ((status == CONNECT_CMD) &&
466 (lsap->slsap_sel == slsap_sel) && 466 (lsap->slsap_sel == slsap_sel) &&
467 (lsap->dlsap_sel == LSAP_ANY)) { 467 (lsap->dlsap_sel == LSAP_ANY)) {
468 /* This is where the dest lsap sel is set on incoming 468 /* This is where the dest lsap sel is set on incoming
469 * lsaps */ 469 * lsaps */
@@ -473,8 +473,8 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel,
473 /* 473 /*
474 * Check if source LSAP and dest LSAP selectors match. 474 * Check if source LSAP and dest LSAP selectors match.
475 */ 475 */
476 if ((lsap->slsap_sel == slsap_sel) && 476 if ((lsap->slsap_sel == slsap_sel) &&
477 (lsap->dlsap_sel == dlsap_sel)) 477 (lsap->dlsap_sel == dlsap_sel))
478 break; 478 break;
479 479
480 lsap = (struct lsap_cb *) hashbin_get_next(queue); 480 lsap = (struct lsap_cb *) hashbin_get_next(queue);
diff --git a/net/irda/irmod.c b/net/irda/irmod.c
index 2869b16e417d..826e6c4ca5d5 100644
--- a/net/irda/irmod.c
+++ b/net/irda/irmod.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irmod.c 3 * Filename: irmod.c
4 * Version: 0.9 4 * Version: 0.9
5 * Description: IrDA stack main entry points 5 * Description: IrDA stack main entry points
@@ -8,19 +8,19 @@
8 * Created at: Mon Dec 15 13:55:39 1997 8 * Created at: Mon Dec 15 13:55:39 1997
9 * Modified at: Wed Jan 5 15:12:41 2000 9 * Modified at: Wed Jan 5 15:12:41 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1997, 1999-2000 Dag Brattli, All Rights Reserved. 12 * Copyright (c) 1997, 1999-2000 Dag Brattli, All Rights Reserved.
13 * Copyright (c) 2000-2004 Jean Tourrilhes <jt@hpl.hp.com> 13 * Copyright (c) 2000-2004 Jean Tourrilhes <jt@hpl.hp.com>
14 * 14 *
15 * This program is free software; you can redistribute it and/or 15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as 16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * Neither Dag Brattli nor University of Tromsų admit liability nor 20 * Neither Dag Brattli nor University of Tromsų admit liability nor
21 * provide warranty for any of this software. This material is 21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge. 22 * provided "AS-IS" and at no charge.
23 * 23 *
24 ********************************************************************/ 24 ********************************************************************/
25 25
26/* 26/*
@@ -52,7 +52,7 @@ extern void irda_sysctl_unregister(void);
52extern int irsock_init(void); 52extern int irsock_init(void);
53extern void irsock_cleanup(void); 53extern void irsock_cleanup(void);
54/* irlap_frame.c */ 54/* irlap_frame.c */
55extern int irlap_driver_rcv(struct sk_buff *, struct net_device *, 55extern int irlap_driver_rcv(struct sk_buff *, struct net_device *,
56 struct packet_type *, struct net_device *); 56 struct packet_type *, struct net_device *);
57 57
58/* 58/*
@@ -104,16 +104,16 @@ static int __init irda_init(void)
104 IRDA_DEBUG(0, "%s()\n", __FUNCTION__); 104 IRDA_DEBUG(0, "%s()\n", __FUNCTION__);
105 105
106 /* Lower layer of the stack */ 106 /* Lower layer of the stack */
107 irlmp_init(); 107 irlmp_init();
108 irlap_init(); 108 irlap_init();
109 109
110 /* Higher layers of the stack */ 110 /* Higher layers of the stack */
111 iriap_init(); 111 iriap_init();
112 irttp_init(); 112 irttp_init();
113 irsock_init(); 113 irsock_init();
114 114
115 /* Add IrDA packet type (Start receiving packets) */ 115 /* Add IrDA packet type (Start receiving packets) */
116 dev_add_pack(&irda_packet_type); 116 dev_add_pack(&irda_packet_type);
117 117
118 /* External APIs */ 118 /* External APIs */
119#ifdef CONFIG_PROC_FS 119#ifdef CONFIG_PROC_FS
@@ -124,7 +124,7 @@ static int __init irda_init(void)
124#endif 124#endif
125 125
126 /* Driver/dongle support */ 126 /* Driver/dongle support */
127 irda_device_init(); 127 irda_device_init();
128 128
129 return 0; 129 return 0;
130} 130}
@@ -140,14 +140,14 @@ static void __exit irda_cleanup(void)
140 /* Remove External APIs */ 140 /* Remove External APIs */
141#ifdef CONFIG_SYSCTL 141#ifdef CONFIG_SYSCTL
142 irda_sysctl_unregister(); 142 irda_sysctl_unregister();
143#endif 143#endif
144#ifdef CONFIG_PROC_FS 144#ifdef CONFIG_PROC_FS
145 irda_proc_unregister(); 145 irda_proc_unregister();
146#endif 146#endif
147 147
148 /* Remove IrDA packet type (stop receiving packets) */ 148 /* Remove IrDA packet type (stop receiving packets) */
149 dev_remove_pack(&irda_packet_type); 149 dev_remove_pack(&irda_packet_type);
150 150
151 /* Remove higher layers */ 151 /* Remove higher layers */
152 irsock_cleanup(); 152 irsock_cleanup();
153 irttp_cleanup(); 153 irttp_cleanup();
@@ -177,8 +177,8 @@ static void __exit irda_cleanup(void)
177 */ 177 */
178subsys_initcall(irda_init); 178subsys_initcall(irda_init);
179module_exit(irda_cleanup); 179module_exit(irda_cleanup);
180 180
181MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no> & Jean Tourrilhes <jt@hpl.hp.com>"); 181MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no> & Jean Tourrilhes <jt@hpl.hp.com>");
182MODULE_DESCRIPTION("The Linux IrDA Protocol Stack"); 182MODULE_DESCRIPTION("The Linux IrDA Protocol Stack");
183MODULE_LICENSE("GPL"); 183MODULE_LICENSE("GPL");
184MODULE_ALIAS_NETPROTO(PF_IRDA); 184MODULE_ALIAS_NETPROTO(PF_IRDA);
diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h
index 80887528e77e..873ae189e37a 100644
--- a/net/irda/irnet/irnet.h
+++ b/net/irda/irnet/irnet.h
@@ -44,7 +44,7 @@
44 * the generic Linux PPP driver. Because IrNET depend on recent 44 * the generic Linux PPP driver. Because IrNET depend on recent
45 * changes of the PPP driver interface, IrNET will work only with very 45 * changes of the PPP driver interface, IrNET will work only with very
46 * recent kernel (2.3.99-pre6 and up). 46 * recent kernel (2.3.99-pre6 and up).
47 * 47 *
48 * The present implementation offer the following features : 48 * The present implementation offer the following features :
49 * o simple user interface using pppd 49 * o simple user interface using pppd
50 * o efficient implementation (interface directly to PPP and IrTTP) 50 * o efficient implementation (interface directly to PPP and IrTTP)
@@ -327,7 +327,7 @@
327 327
328#define DEBUG_ASSERT 0 /* Verify all assertions */ 328#define DEBUG_ASSERT 0 /* Verify all assertions */
329 329
330/* 330/*
331 * These are the macros we are using to actually print the debug 331 * These are the macros we are using to actually print the debug
332 * statements. Don't look at it, it's ugly... 332 * statements. Don't look at it, it's ugly...
333 * 333 *
diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c
index f65c7a83bc5c..c378e668af0c 100644
--- a/net/irda/irnet/irnet_irda.c
+++ b/net/irda/irnet/irnet_irda.c
@@ -118,7 +118,7 @@ irnet_open_tsap(irnet_socket * self)
118 118
119 /* Open an IrTTP instance */ 119 /* Open an IrTTP instance */
120 self->tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, 120 self->tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT,
121 &notify); 121 &notify);
122 DABORT(self->tsap == NULL, -ENOMEM, 122 DABORT(self->tsap == NULL, -ENOMEM,
123 IRDA_SR_ERROR, "Unable to allocate TSAP !\n"); 123 IRDA_SR_ERROR, "Unable to allocate TSAP !\n");
124 124
@@ -188,7 +188,7 @@ irnet_ias_to_tsap(irnet_socket * self,
188 if(value->t.integer != -1) 188 if(value->t.integer != -1)
189 /* Get the remote TSAP selector */ 189 /* Get the remote TSAP selector */
190 dtsap_sel = value->t.integer; 190 dtsap_sel = value->t.integer;
191 else 191 else
192 self->errno = -EADDRNOTAVAIL; 192 self->errno = -EADDRNOTAVAIL;
193 break; 193 break;
194 default: 194 default:
@@ -280,8 +280,8 @@ irnet_connect_tsap(irnet_socket * self)
280 } 280 }
281 281
282 /* Connect to remote device */ 282 /* Connect to remote device */
283 err = irttp_connect_request(self->tsap, self->dtsap_sel, 283 err = irttp_connect_request(self->tsap, self->dtsap_sel,
284 self->rsaddr, self->daddr, NULL, 284 self->rsaddr, self->daddr, NULL,
285 self->max_sdu_size_rx, NULL); 285 self->max_sdu_size_rx, NULL);
286 if(err != 0) 286 if(err != 0)
287 { 287 {
@@ -438,7 +438,7 @@ irnet_dname_to_daddr(irnet_socket * self)
438 if(discoveries == NULL) 438 if(discoveries == NULL)
439 DRETURN(-ENETUNREACH, IRDA_SR_INFO, "Cachelog empty...\n"); 439 DRETURN(-ENETUNREACH, IRDA_SR_INFO, "Cachelog empty...\n");
440 440
441 /* 441 /*
442 * Now, check all discovered devices (if any), and connect 442 * Now, check all discovered devices (if any), and connect
443 * client only about the services that the client is 443 * client only about the services that the client is
444 * interested in... 444 * interested in...
@@ -627,7 +627,7 @@ irda_irnet_destroy(irnet_socket * self)
627 627
628 /* Unregister with LM-IAS */ 628 /* Unregister with LM-IAS */
629 if(self->iriap) 629 if(self->iriap)
630 { 630 {
631 iriap_close(self->iriap); 631 iriap_close(self->iriap);
632 self->iriap = NULL; 632 self->iriap = NULL;
633 } 633 }
@@ -945,7 +945,7 @@ irnet_setup_server(void)
945 945
946 /* Register with LM-IAS (so that people can connect to us) */ 946 /* Register with LM-IAS (so that people can connect to us) */
947 irnet_server.ias_obj = irias_new_object(IRNET_SERVICE_NAME, jiffies); 947 irnet_server.ias_obj = irias_new_object(IRNET_SERVICE_NAME, jiffies);
948 irias_add_integer_attrib(irnet_server.ias_obj, IRNET_IAS_VALUE, 948 irias_add_integer_attrib(irnet_server.ias_obj, IRNET_IAS_VALUE,
949 irnet_server.s.stsap_sel, IAS_KERNEL_ATTR); 949 irnet_server.s.stsap_sel, IAS_KERNEL_ATTR);
950 irias_insert_object(irnet_server.ias_obj); 950 irias_insert_object(irnet_server.ias_obj);
951 951
@@ -1076,7 +1076,7 @@ irnet_data_indication(void * instance,
1076 */ 1076 */
1077static void 1077static void
1078irnet_disconnect_indication(void * instance, 1078irnet_disconnect_indication(void * instance,
1079 void * sap, 1079 void * sap,
1080 LM_REASON reason, 1080 LM_REASON reason,
1081 struct sk_buff *skb) 1081 struct sk_buff *skb)
1082{ 1082{
@@ -1166,10 +1166,10 @@ irnet_disconnect_indication(void * instance,
1166 */ 1166 */
1167static void 1167static void
1168irnet_connect_confirm(void * instance, 1168irnet_connect_confirm(void * instance,
1169 void * sap, 1169 void * sap,
1170 struct qos_info *qos, 1170 struct qos_info *qos,
1171 __u32 max_sdu_size, 1171 __u32 max_sdu_size,
1172 __u8 max_header_size, 1172 __u8 max_header_size,
1173 struct sk_buff *skb) 1173 struct sk_buff *skb)
1174{ 1174{
1175 irnet_socket * self = (irnet_socket *) instance; 1175 irnet_socket * self = (irnet_socket *) instance;
@@ -1235,7 +1235,7 @@ irnet_connect_confirm(void * instance,
1235static void 1235static void
1236irnet_flow_indication(void * instance, 1236irnet_flow_indication(void * instance,
1237 void * sap, 1237 void * sap,
1238 LOCAL_FLOW flow) 1238 LOCAL_FLOW flow)
1239{ 1239{
1240 irnet_socket * self = (irnet_socket *) instance; 1240 irnet_socket * self = (irnet_socket *) instance;
1241 LOCAL_FLOW oldflow = self->tx_flow; 1241 LOCAL_FLOW oldflow = self->tx_flow;
@@ -1308,13 +1308,13 @@ irnet_status_indication(void * instance,
1308 * Some other node is attempting to connect to the IrNET service, and has 1308 * Some other node is attempting to connect to the IrNET service, and has
1309 * sent a connection request on our server socket. 1309 * sent a connection request on our server socket.
1310 * We just redirect the connection to the relevant IrNET socket. 1310 * We just redirect the connection to the relevant IrNET socket.
1311 * 1311 *
1312 * Note : we also make sure that between 2 irnet nodes, there can 1312 * Note : we also make sure that between 2 irnet nodes, there can
1313 * exist only one irnet connection. 1313 * exist only one irnet connection.
1314 */ 1314 */
1315static void 1315static void
1316irnet_connect_indication(void * instance, 1316irnet_connect_indication(void * instance,
1317 void * sap, 1317 void * sap,
1318 struct qos_info *qos, 1318 struct qos_info *qos,
1319 __u32 max_sdu_size, 1319 __u32 max_sdu_size,
1320 __u8 max_header_size, 1320 __u8 max_header_size,
@@ -1463,7 +1463,7 @@ irnet_connect_indication(void * instance,
1463 */ 1463 */
1464static void 1464static void
1465irnet_getvalue_confirm(int result, 1465irnet_getvalue_confirm(int result,
1466 __u16 obj_id, 1466 __u16 obj_id,
1467 struct ias_value *value, 1467 struct ias_value *value,
1468 void * priv) 1468 void * priv)
1469{ 1469{
@@ -1526,7 +1526,7 @@ irnet_getvalue_confirm(int result,
1526 */ 1526 */
1527static void 1527static void
1528irnet_discovervalue_confirm(int result, 1528irnet_discovervalue_confirm(int result,
1529 __u16 obj_id, 1529 __u16 obj_id,
1530 struct ias_value *value, 1530 struct ias_value *value,
1531 void * priv) 1531 void * priv)
1532{ 1532{
@@ -1645,7 +1645,7 @@ irnet_discovery_indication(discinfo_t * discovery,
1645 void * priv) 1645 void * priv)
1646{ 1646{
1647 irnet_socket * self = &irnet_server.s; 1647 irnet_socket * self = &irnet_server.s;
1648 1648
1649 DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self); 1649 DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self);
1650 DASSERT(priv == &irnet_server, , IRDA_OCB_ERROR, 1650 DASSERT(priv == &irnet_server, , IRDA_OCB_ERROR,
1651 "Invalid instance (0x%p) !!!\n", priv); 1651 "Invalid instance (0x%p) !!!\n", priv);
@@ -1676,7 +1676,7 @@ irnet_expiry_indication(discinfo_t * expiry,
1676 void * priv) 1676 void * priv)
1677{ 1677{
1678 irnet_socket * self = &irnet_server.s; 1678 irnet_socket * self = &irnet_server.s;
1679 1679
1680 DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self); 1680 DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self);
1681 DASSERT(priv == &irnet_server, , IRDA_OCB_ERROR, 1681 DASSERT(priv == &irnet_server, , IRDA_OCB_ERROR,
1682 "Invalid instance (0x%p) !!!\n", priv); 1682 "Invalid instance (0x%p) !!!\n", priv);
@@ -1718,7 +1718,7 @@ irnet_proc_read(char * buf,
1718 int i = 0; 1718 int i = 0;
1719 1719
1720 len = 0; 1720 len = 0;
1721 1721
1722 /* Get the IrNET server information... */ 1722 /* Get the IrNET server information... */
1723 len += sprintf(buf+len, "IrNET server - "); 1723 len += sprintf(buf+len, "IrNET server - ");
1724 len += sprintf(buf+len, "IrDA state: %s, ", 1724 len += sprintf(buf+len, "IrDA state: %s, ",
@@ -1811,7 +1811,7 @@ irda_irnet_init(void)
1811 memset(&irnet_server, 0, sizeof(struct irnet_root)); 1811 memset(&irnet_server, 0, sizeof(struct irnet_root));
1812 1812
1813 /* Setup start of irnet instance list */ 1813 /* Setup start of irnet instance list */
1814 irnet_server.list = hashbin_new(HB_NOLOCK); 1814 irnet_server.list = hashbin_new(HB_NOLOCK);
1815 DABORT(irnet_server.list == NULL, -ENOMEM, 1815 DABORT(irnet_server.list == NULL, -ENOMEM,
1816 MODULE_ERROR, "Can't allocate hashbin!\n"); 1816 MODULE_ERROR, "Can't allocate hashbin!\n");
1817 /* Init spinlock for instance list */ 1817 /* Init spinlock for instance list */
diff --git a/net/irda/irnet/irnet_irda.h b/net/irda/irnet/irnet_irda.h
index f2fecd32d8f6..0ba92d0d5204 100644
--- a/net/irda/irnet/irnet_irda.h
+++ b/net/irda/irnet/irnet_irda.h
@@ -146,7 +146,7 @@ static void
146 void *); 146 void *);
147static void 147static void
148 irnet_discovervalue_confirm(int, 148 irnet_discovervalue_confirm(int,
149 __u16, 149 __u16,
150 struct ias_value *, 150 struct ias_value *,
151 void *); 151 void *);
152#ifdef DISCOVERY_EVENTS 152#ifdef DISCOVERY_EVENTS
diff --git a/net/irda/irnet/irnet_ppp.c b/net/irda/irnet/irnet_ppp.c
index a1e502ff9070..2f9f8dce5a69 100644
--- a/net/irda/irnet/irnet_ppp.c
+++ b/net/irda/irnet/irnet_ppp.c
@@ -93,7 +93,7 @@ irnet_ctrl_write(irnet_socket * ap,
93 93
94 /* Check if we recognised one of the known command 94 /* Check if we recognised one of the known command
95 * We can't use "switch" with strings, so hack with "continue" */ 95 * We can't use "switch" with strings, so hack with "continue" */
96 96
97 /* First command : name -> Requested IrDA nickname */ 97 /* First command : name -> Requested IrDA nickname */
98 if(!strncmp(start, "name", 4)) 98 if(!strncmp(start, "name", 4))
99 { 99 {
@@ -744,7 +744,7 @@ dev_irnet_ioctl(struct inode * inode,
744 break; 744 break;
745 745
746 /* Set DTR/RTS */ 746 /* Set DTR/RTS */
747 case TIOCMBIS: 747 case TIOCMBIS:
748 case TIOCMBIC: 748 case TIOCMBIC:
749 /* Set exclusive/non-exclusive mode */ 749 /* Set exclusive/non-exclusive mode */
750 case TIOCEXCL: 750 case TIOCEXCL:
@@ -941,7 +941,7 @@ ppp_irnet_send(struct ppp_channel * chan,
941 ret = irttp_data_request(self->tsap, skb); 941 ret = irttp_data_request(self->tsap, skb);
942 if(ret < 0) 942 if(ret < 0)
943 { 943 {
944 /* 944 /*
945 * > IrTTPs tx queue is full, so we just have to 945 * > IrTTPs tx queue is full, so we just have to
946 * > drop the frame! You might think that we should 946 * > drop the frame! You might think that we should
947 * > just return -1 and don't deallocate the frame, 947 * > just return -1 and don't deallocate the frame,
@@ -949,7 +949,7 @@ ppp_irnet_send(struct ppp_channel * chan,
949 * > we have replaced the original skb with a new 949 * > we have replaced the original skb with a new
950 * > one with larger headroom, and that would really 950 * > one with larger headroom, and that would really
951 * > confuse do_dev_queue_xmit() in dev.c! I have 951 * > confuse do_dev_queue_xmit() in dev.c! I have
952 * > tried :-) DB 952 * > tried :-) DB
953 * Correction : we verify the flow control above (self->tx_flow), 953 * Correction : we verify the flow control above (self->tx_flow),
954 * so we come here only if IrTTP doesn't like the packet (empty, 954 * so we come here only if IrTTP doesn't like the packet (empty,
955 * too large, IrTTP not connected). In those rare cases, it's ok 955 * too large, IrTTP not connected). In those rare cases, it's ok
@@ -1136,6 +1136,6 @@ irnet_cleanup(void)
1136module_init(irnet_init); 1136module_init(irnet_init);
1137module_exit(irnet_cleanup); 1137module_exit(irnet_cleanup);
1138MODULE_AUTHOR("Jean Tourrilhes <jt@hpl.hp.com>"); 1138MODULE_AUTHOR("Jean Tourrilhes <jt@hpl.hp.com>");
1139MODULE_DESCRIPTION("IrNET : Synchronous PPP over IrDA"); 1139MODULE_DESCRIPTION("IrNET : Synchronous PPP over IrDA");
1140MODULE_LICENSE("GPL"); 1140MODULE_LICENSE("GPL");
1141MODULE_ALIAS_CHARDEV(10, 187); 1141MODULE_ALIAS_CHARDEV(10, 187);
diff --git a/net/irda/irproc.c b/net/irda/irproc.c
index 88b9c43f6370..d6f9aba5b9dc 100644
--- a/net/irda/irproc.c
+++ b/net/irda/irproc.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irproc.c 3 * Filename: irproc.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: Various entries in the /proc file system 5 * Description: Various entries in the /proc file system
@@ -10,17 +10,17 @@
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1998-1999, Dag Brattli <dagb@cs.uit.no> 12 * Copyright (c) 1998-1999, Dag Brattli <dagb@cs.uit.no>
13 * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, 13 * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>,
14 * All Rights Reserved. 14 * All Rights Reserved.
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as 17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * I, Thomas Davis, provide no warranty for any of this software. 21 * I, Thomas Davis, provide no warranty for any of this software.
22 * This material is provided "AS-IS" and at no charge. 22 * This material is provided "AS-IS" and at no charge.
23 * 23 *
24 ********************************************************************/ 24 ********************************************************************/
25 25
26#include <linux/miscdevice.h> 26#include <linux/miscdevice.h>
@@ -46,7 +46,7 @@ struct irda_entry {
46 46
47struct proc_dir_entry *proc_irda; 47struct proc_dir_entry *proc_irda;
48EXPORT_SYMBOL(proc_irda); 48EXPORT_SYMBOL(proc_irda);
49 49
50static struct irda_entry irda_dirs[] = { 50static struct irda_entry irda_dirs[] = {
51 {"discovery", &discovery_seq_fops}, 51 {"discovery", &discovery_seq_fops},
52 {"irttp", &irttp_seq_fops}, 52 {"irttp", &irttp_seq_fops},
@@ -61,7 +61,7 @@ static struct irda_entry irda_dirs[] = {
61 * Register irda entry in /proc file system 61 * Register irda entry in /proc file system
62 * 62 *
63 */ 63 */
64void __init irda_proc_register(void) 64void __init irda_proc_register(void)
65{ 65{
66 int i; 66 int i;
67 struct proc_dir_entry *d; 67 struct proc_dir_entry *d;
@@ -73,7 +73,7 @@ void __init irda_proc_register(void)
73 73
74 for (i=0; i<ARRAY_SIZE(irda_dirs); i++) { 74 for (i=0; i<ARRAY_SIZE(irda_dirs); i++) {
75 d = create_proc_entry(irda_dirs[i].name, 0, proc_irda); 75 d = create_proc_entry(irda_dirs[i].name, 0, proc_irda);
76 if (d) 76 if (d)
77 d->proc_fops = irda_dirs[i].fops; 77 d->proc_fops = irda_dirs[i].fops;
78 } 78 }
79} 79}
@@ -84,17 +84,17 @@ void __init irda_proc_register(void)
84 * Unregister irda entry in /proc file system 84 * Unregister irda entry in /proc file system
85 * 85 *
86 */ 86 */
87void __exit irda_proc_unregister(void) 87void __exit irda_proc_unregister(void)
88{ 88{
89 int i; 89 int i;
90 90
91 if (proc_irda) { 91 if (proc_irda) {
92 for (i=0; i<ARRAY_SIZE(irda_dirs); i++) 92 for (i=0; i<ARRAY_SIZE(irda_dirs); i++)
93 remove_proc_entry(irda_dirs[i].name, proc_irda); 93 remove_proc_entry(irda_dirs[i].name, proc_irda);
94 94
95 remove_proc_entry("irda", proc_net); 95 remove_proc_entry("irda", proc_net);
96 proc_irda = NULL; 96 proc_irda = NULL;
97 } 97 }
98} 98}
99 99
100 100
diff --git a/net/irda/irqueue.c b/net/irda/irqueue.c
index 1d26cd33ea13..92662330dbcf 100644
--- a/net/irda/irqueue.c
+++ b/net/irda/irqueue.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irqueue.c 3 * Filename: irqueue.c
4 * Version: 0.3 4 * Version: 0.3
5 * Description: General queue implementation 5 * Description: General queue implementation
@@ -10,28 +10,28 @@
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * Modified at: Thu Jan 4 14:29:10 CET 2001 11 * Modified at: Thu Jan 4 14:29:10 CET 2001
12 * Modified by: Marc Zyngier <mzyngier@freesurf.fr> 12 * Modified by: Marc Zyngier <mzyngier@freesurf.fr>
13 * 13 *
14 * Copyright (C) 1998-1999, Aage Kvalnes <aage@cs.uit.no> 14 * Copyright (C) 1998-1999, Aage Kvalnes <aage@cs.uit.no>
15 * Copyright (C) 1998, Dag Brattli, 15 * Copyright (C) 1998, Dag Brattli,
16 * All Rights Reserved. 16 * All Rights Reserved.
17 * 17 *
18 * This code is taken from the Vortex Operating System written by Aage 18 * This code is taken from the Vortex Operating System written by Aage
19 * Kvalnes. Aage has agreed that this code can use the GPL licence, 19 * Kvalnes. Aage has agreed that this code can use the GPL licence,
20 * although he does not use that licence in his own code. 20 * although he does not use that licence in his own code.
21 * 21 *
22 * This copyright does however _not_ include the ELF hash() function 22 * This copyright does however _not_ include the ELF hash() function
23 * which I currently don't know which licence or copyright it 23 * which I currently don't know which licence or copyright it
24 * has. Please inform me if you know. 24 * has. Please inform me if you know.
25 * 25 *
26 * This program is free software; you can redistribute it and/or 26 * This program is free software; you can redistribute it and/or
27 * modify it under the terms of the GNU General Public License as 27 * modify it under the terms of the GNU General Public License as
28 * published by the Free Software Foundation; either version 2 of 28 * published by the Free Software Foundation; either version 2 of
29 * the License, or (at your option) any later version. 29 * the License, or (at your option) any later version.
30 * 30 *
31 * Neither Dag Brattli nor University of Tromsų admit liability nor 31 * Neither Dag Brattli nor University of Tromsų admit liability nor
32 * provide warranty for any of this software. This material is 32 * provide warranty for any of this software. This material is
33 * provided "AS-IS" and at no charge. 33 * provided "AS-IS" and at no charge.
34 * 34 *
35 ********************************************************************/ 35 ********************************************************************/
36 36
37/* 37/*
@@ -213,7 +213,7 @@ static __u32 hash( const char* name)
213{ 213{
214 __u32 h = 0; 214 __u32 h = 0;
215 __u32 g; 215 __u32 g;
216 216
217 while(*name) { 217 while(*name) {
218 h = (h<<4) + *name++; 218 h = (h<<4) + *name++;
219 if ((g = (h & 0xf0000000))) 219 if ((g = (h & 0xf0000000)))
@@ -231,7 +231,7 @@ static __u32 hash( const char* name)
231 */ 231 */
232static void enqueue_first(irda_queue_t **queue, irda_queue_t* element) 232static void enqueue_first(irda_queue_t **queue, irda_queue_t* element)
233{ 233{
234 234
235 IRDA_DEBUG( 4, "%s()\n", __FUNCTION__); 235 IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
236 236
237 /* 237 /*
@@ -242,7 +242,7 @@ static void enqueue_first(irda_queue_t **queue, irda_queue_t* element)
242 * Queue is empty. Insert one element into the queue. 242 * Queue is empty. Insert one element into the queue.
243 */ 243 */
244 element->q_next = element->q_prev = *queue = element; 244 element->q_next = element->q_prev = *queue = element;
245 245
246 } else { 246 } else {
247 /* 247 /*
248 * Queue is not empty. Insert element into front of queue. 248 * Queue is not empty. Insert element into front of queue.
@@ -267,20 +267,20 @@ static irda_queue_t *dequeue_first(irda_queue_t **queue)
267 irda_queue_t *ret; 267 irda_queue_t *ret;
268 268
269 IRDA_DEBUG( 4, "dequeue_first()\n"); 269 IRDA_DEBUG( 4, "dequeue_first()\n");
270 270
271 /* 271 /*
272 * Set return value 272 * Set return value
273 */ 273 */
274 ret = *queue; 274 ret = *queue;
275 275
276 if ( *queue == NULL ) { 276 if ( *queue == NULL ) {
277 /* 277 /*
278 * Queue was empty. 278 * Queue was empty.
279 */ 279 */
280 } else if ( (*queue)->q_next == *queue ) { 280 } else if ( (*queue)->q_next == *queue ) {
281 /* 281 /*
282 * Queue only contained a single element. It will now be 282 * Queue only contained a single element. It will now be
283 * empty. 283 * empty.
284 */ 284 */
285 *queue = NULL; 285 *queue = NULL;
286 } else { 286 } else {
@@ -291,7 +291,7 @@ static irda_queue_t *dequeue_first(irda_queue_t **queue)
291 (*queue)->q_next->q_prev = (*queue)->q_prev; 291 (*queue)->q_next->q_prev = (*queue)->q_prev;
292 *queue = (*queue)->q_next; 292 *queue = (*queue)->q_next;
293 } 293 }
294 294
295 /* 295 /*
296 * Return the removed entry (or NULL of queue was empty). 296 * Return the removed entry (or NULL of queue was empty).
297 */ 297 */
@@ -306,25 +306,25 @@ static irda_queue_t *dequeue_first(irda_queue_t **queue)
306static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element) 306static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element)
307{ 307{
308 irda_queue_t *ret; 308 irda_queue_t *ret;
309 309
310 IRDA_DEBUG( 4, "dequeue_general()\n"); 310 IRDA_DEBUG( 4, "dequeue_general()\n");
311 311
312 /* 312 /*
313 * Set return value 313 * Set return value
314 */ 314 */
315 ret = *queue; 315 ret = *queue;
316 316
317 if ( *queue == NULL ) { 317 if ( *queue == NULL ) {
318 /* 318 /*
319 * Queue was empty. 319 * Queue was empty.
320 */ 320 */
321 } else if ( (*queue)->q_next == *queue ) { 321 } else if ( (*queue)->q_next == *queue ) {
322 /* 322 /*
323 * Queue only contained a single element. It will now be 323 * Queue only contained a single element. It will now be
324 * empty. 324 * empty.
325 */ 325 */
326 *queue = NULL; 326 *queue = NULL;
327 327
328 } else { 328 } else {
329 /* 329 /*
330 * Remove specific element. 330 * Remove specific element.
@@ -334,7 +334,7 @@ static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element
334 if ( (*queue) == element) 334 if ( (*queue) == element)
335 (*queue) = element->q_next; 335 (*queue) = element->q_next;
336 } 336 }
337 337
338 /* 338 /*
339 * Return the removed entry (or NULL of queue was empty). 339 * Return the removed entry (or NULL of queue was empty).
340 */ 340 */
@@ -352,7 +352,7 @@ static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element
352hashbin_t *hashbin_new(int type) 352hashbin_t *hashbin_new(int type)
353{ 353{
354 hashbin_t* hashbin; 354 hashbin_t* hashbin;
355 355
356 /* 356 /*
357 * Allocate new hashbin 357 * Allocate new hashbin
358 */ 358 */
@@ -380,8 +380,8 @@ EXPORT_SYMBOL(hashbin_new);
380/* 380/*
381 * Function hashbin_delete (hashbin, free_func) 381 * Function hashbin_delete (hashbin, free_func)
382 * 382 *
383 * Destroy hashbin, the free_func can be a user supplied special routine 383 * Destroy hashbin, the free_func can be a user supplied special routine
384 * for deallocating this structure if it's complex. If not the user can 384 * for deallocating this structure if it's complex. If not the user can
385 * just supply kfree, which should take care of the job. 385 * just supply kfree, which should take care of the job.
386 */ 386 */
387int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) 387int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func)
@@ -392,7 +392,7 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func)
392 392
393 IRDA_ASSERT(hashbin != NULL, return -1;); 393 IRDA_ASSERT(hashbin != NULL, return -1;);
394 IRDA_ASSERT(hashbin->magic == HB_MAGIC, return -1;); 394 IRDA_ASSERT(hashbin->magic == HB_MAGIC, return -1;);
395 395
396 /* Synchronize */ 396 /* Synchronize */
397 if ( hashbin->hb_type & HB_LOCK ) { 397 if ( hashbin->hb_type & HB_LOCK ) {
398 spin_lock_irqsave(&hashbin->hb_spinlock, flags); 398 spin_lock_irqsave(&hashbin->hb_spinlock, flags);
@@ -407,11 +407,11 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func)
407 while (queue ) { 407 while (queue ) {
408 if (free_func) 408 if (free_func)
409 (*free_func)(queue); 409 (*free_func)(queue);
410 queue = dequeue_first( 410 queue = dequeue_first(
411 (irda_queue_t**) &hashbin->hb_queue[i]); 411 (irda_queue_t**) &hashbin->hb_queue[i]);
412 } 412 }
413 } 413 }
414 414
415 /* Cleanup local data */ 415 /* Cleanup local data */
416 hashbin->hb_current = NULL; 416 hashbin->hb_current = NULL;
417 hashbin->magic = ~HB_MAGIC; 417 hashbin->magic = ~HB_MAGIC;
@@ -438,7 +438,7 @@ EXPORT_SYMBOL(hashbin_delete);
438 * Insert an entry into the hashbin 438 * Insert an entry into the hashbin
439 * 439 *
440 */ 440 */
441void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, 441void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv,
442 const char* name) 442 const char* name)
443{ 443{
444 unsigned long flags = 0; 444 unsigned long flags = 0;
@@ -460,14 +460,14 @@ void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv,
460 if ( hashbin->hb_type & HB_LOCK ) { 460 if ( hashbin->hb_type & HB_LOCK ) {
461 spin_lock_irqsave(&hashbin->hb_spinlock, flags); 461 spin_lock_irqsave(&hashbin->hb_spinlock, flags);
462 } /* Default is no-lock */ 462 } /* Default is no-lock */
463 463
464 /* 464 /*
465 * Store name and key 465 * Store name and key
466 */ 466 */
467 entry->q_hash = hashv; 467 entry->q_hash = hashv;
468 if ( name ) 468 if ( name )
469 strlcpy( entry->q_name, name, sizeof(entry->q_name)); 469 strlcpy( entry->q_name, name, sizeof(entry->q_name));
470 470
471 /* 471 /*
472 * Insert new entry first 472 * Insert new entry first
473 */ 473 */
@@ -482,7 +482,7 @@ void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv,
482} 482}
483EXPORT_SYMBOL(hashbin_insert); 483EXPORT_SYMBOL(hashbin_insert);
484 484
485/* 485/*
486 * Function hashbin_remove_first (hashbin) 486 * Function hashbin_remove_first (hashbin)
487 * 487 *
488 * Remove first entry of the hashbin 488 * Remove first entry of the hashbin
@@ -537,7 +537,7 @@ void *hashbin_remove_first( hashbin_t *hashbin)
537} 537}
538 538
539 539
540/* 540/*
541 * Function hashbin_remove (hashbin, hashv, name) 541 * Function hashbin_remove (hashbin, hashv, name)
542 * 542 *
543 * Remove entry with the given name 543 * Remove entry with the given name
@@ -561,7 +561,7 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name)
561 561
562 IRDA_ASSERT( hashbin != NULL, return NULL;); 562 IRDA_ASSERT( hashbin != NULL, return NULL;);
563 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); 563 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
564 564
565 /* 565 /*
566 * Locate hashbin 566 * Locate hashbin
567 */ 567 */
@@ -601,7 +601,7 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name)
601 entry = entry->q_next; 601 entry = entry->q_next;
602 } while ( entry != hashbin->hb_queue[ bin ] ); 602 } while ( entry != hashbin->hb_queue[ bin ] );
603 } 603 }
604 604
605 /* 605 /*
606 * If entry was found, dequeue it 606 * If entry was found, dequeue it
607 */ 607 */
@@ -622,18 +622,18 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name)
622 if ( hashbin->hb_type & HB_LOCK ) { 622 if ( hashbin->hb_type & HB_LOCK ) {
623 spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); 623 spin_unlock_irqrestore(&hashbin->hb_spinlock, flags);
624 } /* Default is no-lock */ 624 } /* Default is no-lock */
625 625
626 626
627 /* Return */ 627 /* Return */
628 if ( found ) 628 if ( found )
629 return entry; 629 return entry;
630 else 630 else
631 return NULL; 631 return NULL;
632 632
633} 633}
634EXPORT_SYMBOL(hashbin_remove); 634EXPORT_SYMBOL(hashbin_remove);
635 635
636/* 636/*
637 * Function hashbin_remove_this (hashbin, entry) 637 * Function hashbin_remove_this (hashbin, entry)
638 * 638 *
639 * Remove entry with the given name 639 * Remove entry with the given name
@@ -655,7 +655,7 @@ void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry)
655 IRDA_ASSERT( hashbin != NULL, return NULL;); 655 IRDA_ASSERT( hashbin != NULL, return NULL;);
656 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); 656 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
657 IRDA_ASSERT( entry != NULL, return NULL;); 657 IRDA_ASSERT( entry != NULL, return NULL;);
658 658
659 /* Synchronize */ 659 /* Synchronize */
660 if ( hashbin->hb_type & HB_LOCK ) { 660 if ( hashbin->hb_type & HB_LOCK ) {
661 spin_lock_irqsave(&hashbin->hb_spinlock, flags); 661 spin_lock_irqsave(&hashbin->hb_spinlock, flags);
@@ -722,7 +722,7 @@ void* hashbin_find( hashbin_t* hashbin, long hashv, const char* name )
722 if ( name ) 722 if ( name )
723 hashv = hash( name ); 723 hashv = hash( name );
724 bin = GET_HASHBIN( hashv ); 724 bin = GET_HASHBIN( hashv );
725 725
726 /* 726 /*
727 * Search for entry 727 * Search for entry
728 */ 728 */
@@ -829,7 +829,7 @@ void* hashbin_find_next( hashbin_t* hashbin, long hashv, const char* name,
829 * called before any calls to hashbin_get_next()! 829 * called before any calls to hashbin_get_next()!
830 * 830 *
831 */ 831 */
832irda_queue_t *hashbin_get_first( hashbin_t* hashbin) 832irda_queue_t *hashbin_get_first( hashbin_t* hashbin)
833{ 833{
834 irda_queue_t *entry; 834 irda_queue_t *entry;
835 int i; 835 int i;
@@ -860,7 +860,7 @@ EXPORT_SYMBOL(hashbin_get_first);
860 * Get next item in hashbin. A series of hashbin_get_next() calls must 860 * Get next item in hashbin. A series of hashbin_get_next() calls must
861 * be started by a call to hashbin_get_first(). The function returns 861 * be started by a call to hashbin_get_first(). The function returns
862 * NULL when all items have been traversed 862 * NULL when all items have been traversed
863 * 863 *
864 * The context of the search is stored within the hashbin, so you must 864 * The context of the search is stored within the hashbin, so you must
865 * protect yourself from concurrent enumerations. - Jean II 865 * protect yourself from concurrent enumerations. - Jean II
866 */ 866 */
@@ -876,13 +876,13 @@ irda_queue_t *hashbin_get_next( hashbin_t *hashbin)
876 if ( hashbin->hb_current == NULL) { 876 if ( hashbin->hb_current == NULL) {
877 IRDA_ASSERT( hashbin->hb_current != NULL, return NULL;); 877 IRDA_ASSERT( hashbin->hb_current != NULL, return NULL;);
878 return NULL; 878 return NULL;
879 } 879 }
880 entry = hashbin->hb_current->q_next; 880 entry = hashbin->hb_current->q_next;
881 bin = GET_HASHBIN( entry->q_hash); 881 bin = GET_HASHBIN( entry->q_hash);
882 882
883 /* 883 /*
884 * Make sure that we are not back at the beginning of the queue 884 * Make sure that we are not back at the beginning of the queue
885 * again 885 * again
886 */ 886 */
887 if ( entry != hashbin->hb_queue[ bin ]) { 887 if ( entry != hashbin->hb_queue[ bin ]) {
888 hashbin->hb_current = entry; 888 hashbin->hb_current = entry;
@@ -895,7 +895,7 @@ irda_queue_t *hashbin_get_next( hashbin_t *hashbin)
895 */ 895 */
896 if ( bin >= HASHBIN_SIZE) 896 if ( bin >= HASHBIN_SIZE)
897 return NULL; 897 return NULL;
898 898
899 /* 899 /*
900 * Move to next queue in hashbin 900 * Move to next queue in hashbin
901 */ 901 */
@@ -904,7 +904,7 @@ irda_queue_t *hashbin_get_next( hashbin_t *hashbin)
904 entry = hashbin->hb_queue[ i]; 904 entry = hashbin->hb_queue[ i];
905 if ( entry) { 905 if ( entry) {
906 hashbin->hb_current = entry; 906 hashbin->hb_current = entry;
907 907
908 return entry; 908 return entry;
909 } 909 }
910 } 910 }
diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c
index 86805c3d8324..bb53ba0be585 100644
--- a/net/irda/irsysctl.c
+++ b/net/irda/irsysctl.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irsysctl.c 3 * Filename: irsysctl.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: Sysctl interface for IrDA 5 * Description: Sysctl interface for IrDA
@@ -8,19 +8,19 @@
8 * Created at: Sun May 24 22:12:06 1998 8 * Created at: Sun May 24 22:12:06 1998
9 * Modified at: Fri Jun 4 02:50:15 1999 9 * Modified at: Fri Jun 4 02:50:15 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved. 12 * Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved.
13 * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> 13 * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com>
14 * 14 *
15 * This program is free software; you can redistribute it and/or 15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as 16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * Neither Dag Brattli nor University of Tromsų admit liability nor 20 * Neither Dag Brattli nor University of Tromsų admit liability nor
21 * provide warranty for any of this software. This material is 21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge. 22 * provided "AS-IS" and at no charge.
23 * 23 *
24 ********************************************************************/ 24 ********************************************************************/
25 25
26#include <linux/mm.h> 26#include <linux/mm.h>
@@ -111,7 +111,7 @@ static ctl_table irda_table[] = {
111 .strategy = &sysctl_string 111 .strategy = &sysctl_string
112 }, 112 },
113#ifdef CONFIG_IRDA_DEBUG 113#ifdef CONFIG_IRDA_DEBUG
114 { 114 {
115 .ctl_name = DEBUG, 115 .ctl_name = DEBUG,
116 .procname = "debug", 116 .procname = "debug",
117 .data = &irda_debug, 117 .data = &irda_debug,
@@ -121,7 +121,7 @@ static ctl_table irda_table[] = {
121 }, 121 },
122#endif 122#endif
123#ifdef CONFIG_IRDA_FAST_RR 123#ifdef CONFIG_IRDA_FAST_RR
124 { 124 {
125 .ctl_name = FAST_POLL, 125 .ctl_name = FAST_POLL,
126 .procname = "fast_poll_increase", 126 .procname = "fast_poll_increase",
127 .data = &sysctl_fast_poll_increase, 127 .data = &sysctl_fast_poll_increase,
@@ -287,7 +287,7 @@ int __init irda_sysctl_register(void)
287 * Unregister our sysctl interface 287 * Unregister our sysctl interface
288 * 288 *
289 */ 289 */
290void __exit irda_sysctl_unregister(void) 290void __exit irda_sysctl_unregister(void)
291{ 291{
292 unregister_sysctl_table(irda_table_header); 292 unregister_sysctl_table(irda_table_header);
293} 293}
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 03504f3e4990..68836358fdf2 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irttp.c 3 * Filename: irttp.c
4 * Version: 1.2 4 * Version: 1.2
5 * Description: Tiny Transport Protocol (TTP) implementation 5 * Description: Tiny Transport Protocol (TTP) implementation
@@ -8,18 +8,18 @@
8 * Created at: Sun Aug 31 20:14:31 1997 8 * Created at: Sun Aug 31 20:14:31 1997
9 * Modified at: Wed Jan 5 11:31:27 2000 9 * Modified at: Wed Jan 5 11:31:27 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>, 12 * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>,
13 * All Rights Reserved. 13 * All Rights Reserved.
14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> 14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as 17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * Neither Dag Brattli nor University of Tromsų admit liability nor 21 * Neither Dag Brattli nor University of Tromsų admit liability nor
22 * provide warranty for any of this software. This material is 22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge. 23 * provided "AS-IS" and at no charge.
24 * 24 *
25 ********************************************************************/ 25 ********************************************************************/
@@ -42,17 +42,17 @@ static struct irttp_cb *irttp;
42 42
43static void __irttp_close_tsap(struct tsap_cb *self); 43static void __irttp_close_tsap(struct tsap_cb *self);
44 44
45static int irttp_data_indication(void *instance, void *sap, 45static int irttp_data_indication(void *instance, void *sap,
46 struct sk_buff *skb); 46 struct sk_buff *skb);
47static int irttp_udata_indication(void *instance, void *sap, 47static int irttp_udata_indication(void *instance, void *sap,
48 struct sk_buff *skb); 48 struct sk_buff *skb);
49static void irttp_disconnect_indication(void *instance, void *sap, 49static void irttp_disconnect_indication(void *instance, void *sap,
50 LM_REASON reason, struct sk_buff *); 50 LM_REASON reason, struct sk_buff *);
51static void irttp_connect_indication(void *instance, void *sap, 51static void irttp_connect_indication(void *instance, void *sap,
52 struct qos_info *qos, __u32 max_sdu_size, 52 struct qos_info *qos, __u32 max_sdu_size,
53 __u8 header_size, struct sk_buff *skb); 53 __u8 header_size, struct sk_buff *skb);
54static void irttp_connect_confirm(void *instance, void *sap, 54static void irttp_connect_confirm(void *instance, void *sap,
55 struct qos_info *qos, __u32 max_sdu_size, 55 struct qos_info *qos, __u32 max_sdu_size,
56 __u8 header_size, struct sk_buff *skb); 56 __u8 header_size, struct sk_buff *skb);
57static void irttp_run_tx_queue(struct tsap_cb *self); 57static void irttp_run_tx_queue(struct tsap_cb *self);
58static void irttp_run_rx_queue(struct tsap_cb *self); 58static void irttp_run_rx_queue(struct tsap_cb *self);
@@ -61,7 +61,7 @@ static void irttp_flush_queues(struct tsap_cb *self);
61static void irttp_fragment_skb(struct tsap_cb *self, struct sk_buff *skb); 61static void irttp_fragment_skb(struct tsap_cb *self, struct sk_buff *skb);
62static struct sk_buff *irttp_reassemble_skb(struct tsap_cb *self); 62static struct sk_buff *irttp_reassemble_skb(struct tsap_cb *self);
63static void irttp_todo_expired(unsigned long data); 63static void irttp_todo_expired(unsigned long data);
64static int irttp_param_max_sdu_size(void *instance, irda_param_t *param, 64static int irttp_param_max_sdu_size(void *instance, irda_param_t *param,
65 int get); 65 int get);
66 66
67static void irttp_flow_indication(void *instance, void *sap, LOCAL_FLOW flow); 67static void irttp_flow_indication(void *instance, void *sap, LOCAL_FLOW flow);
@@ -109,7 +109,7 @@ int __init irttp_init(void)
109 * Called by module destruction/cleanup code 109 * Called by module destruction/cleanup code
110 * 110 *
111 */ 111 */
112void __exit irttp_cleanup(void) 112void __exit irttp_cleanup(void)
113{ 113{
114 /* Check for main structure */ 114 /* Check for main structure */
115 IRDA_ASSERT(irttp->magic == TTP_MAGIC, return;); 115 IRDA_ASSERT(irttp->magic == TTP_MAGIC, return;);
@@ -865,7 +865,7 @@ static int irttp_udata_indication(void *instance, void *sap,
865 err = self->notify.udata_indication(self->notify.instance, 865 err = self->notify.udata_indication(self->notify.instance,
866 self,skb); 866 self,skb);
867 /* Same comment as in irttp_do_data_indication() */ 867 /* Same comment as in irttp_do_data_indication() */
868 if (!err) 868 if (!err)
869 return 0; 869 return 0;
870 } 870 }
871 /* Either no handler, or handler returns an error */ 871 /* Either no handler, or handler returns an error */
@@ -940,7 +940,7 @@ static int irttp_data_indication(void *instance, void *sap,
940 940
941 /* 941 /*
942 * If the peer device has given us some credits and we didn't have 942 * If the peer device has given us some credits and we didn't have
943 * anyone from before, then we need to shedule the tx queue. 943 * anyone from before, then we need to shedule the tx queue.
944 * We need to do that because our Tx have stopped (so we may not 944 * We need to do that because our Tx have stopped (so we may not
945 * get any LAP flow indication) and the user may be stopped as 945 * get any LAP flow indication) and the user may be stopped as
946 * well. - Jean II 946 * well. - Jean II
@@ -1798,14 +1798,14 @@ static void *irttp_seq_start(struct seq_file *seq, loff_t *pos)
1798 spin_lock_irq(&irttp->tsaps->hb_spinlock); 1798 spin_lock_irq(&irttp->tsaps->hb_spinlock);
1799 iter->id = 0; 1799 iter->id = 0;
1800 1800
1801 for (self = (struct tsap_cb *) hashbin_get_first(irttp->tsaps); 1801 for (self = (struct tsap_cb *) hashbin_get_first(irttp->tsaps);
1802 self != NULL; 1802 self != NULL;
1803 self = (struct tsap_cb *) hashbin_get_next(irttp->tsaps)) { 1803 self = (struct tsap_cb *) hashbin_get_next(irttp->tsaps)) {
1804 if (iter->id == *pos) 1804 if (iter->id == *pos)
1805 break; 1805 break;
1806 ++iter->id; 1806 ++iter->id;
1807 } 1807 }
1808 1808
1809 return self; 1809 return self;
1810} 1810}
1811 1811
diff --git a/net/irda/parameters.c b/net/irda/parameters.c
index 1324942f976c..75a72d203b01 100644
--- a/net/irda/parameters.c
+++ b/net/irda/parameters.c
@@ -563,7 +563,7 @@ static int irda_param_extract(void *self, __u8 *buf, int len,
563 * safe. Returns the number of bytes that was parsed 563 * safe. Returns the number of bytes that was parsed
564 * 564 *
565 */ 565 */
566int irda_param_extract_all(void *self, __u8 *buf, int len, 566int irda_param_extract_all(void *self, __u8 *buf, int len,
567 pi_param_info_t *info) 567 pi_param_info_t *info)
568{ 568{
569 int ret = -1; 569 int ret = -1;
diff --git a/net/irda/qos.c b/net/irda/qos.c
index 95a69c013ee8..349012c926b7 100644
--- a/net/irda/qos.c
+++ b/net/irda/qos.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: qos.c 3 * Filename: qos.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: IrLAP QoS parameter negotiation 5 * Description: IrLAP QoS parameter negotiation
@@ -8,26 +8,26 @@
8 * Created at: Tue Sep 9 00:00:26 1997 8 * Created at: Tue Sep 9 00:00:26 1997
9 * Modified at: Sun Jan 30 14:29:16 2000 9 * Modified at: Sun Jan 30 14:29:16 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>, 12 * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>,
13 * All Rights Reserved. 13 * All Rights Reserved.
14 * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> 14 * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com>
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as 17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * This program is distributed in the hope that it will be useful, 21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details. 24 * GNU General Public License for more details.
25 * 25 *
26 * You should have received a copy of the GNU General Public License 26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software 27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA 29 * MA 02111-1307 USA
30 * 30 *
31 ********************************************************************/ 31 ********************************************************************/
32 32
33#include <asm/byteorder.h> 33#include <asm/byteorder.h>
@@ -84,16 +84,16 @@ unsigned sysctl_max_tx_data_size = 2042;
84unsigned sysctl_max_tx_window = 7; 84unsigned sysctl_max_tx_window = 7;
85 85
86static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get); 86static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get);
87static int irlap_param_link_disconnect(void *instance, irda_param_t *parm, 87static int irlap_param_link_disconnect(void *instance, irda_param_t *parm,
88 int get); 88 int get);
89static int irlap_param_max_turn_time(void *instance, irda_param_t *param, 89static int irlap_param_max_turn_time(void *instance, irda_param_t *param,
90 int get); 90 int get);
91static int irlap_param_data_size(void *instance, irda_param_t *param, int get); 91static int irlap_param_data_size(void *instance, irda_param_t *param, int get);
92static int irlap_param_window_size(void *instance, irda_param_t *param, 92static int irlap_param_window_size(void *instance, irda_param_t *param,
93 int get); 93 int get);
94static int irlap_param_additional_bofs(void *instance, irda_param_t *parm, 94static int irlap_param_additional_bofs(void *instance, irda_param_t *parm,
95 int get); 95 int get);
96static int irlap_param_min_turn_time(void *instance, irda_param_t *param, 96static int irlap_param_min_turn_time(void *instance, irda_param_t *param,
97 int get); 97 int get);
98 98
99#ifndef CONFIG_IRDA_DYNAMIC_WINDOW 99#ifndef CONFIG_IRDA_DYNAMIC_WINDOW
@@ -101,7 +101,7 @@ static __u32 irlap_requested_line_capacity(struct qos_info *qos);
101#endif 101#endif
102 102
103static __u32 min_turn_times[] = { 10000, 5000, 1000, 500, 100, 50, 10, 0 }; /* us */ 103static __u32 min_turn_times[] = { 10000, 5000, 1000, 500, 100, 50, 10, 0 }; /* us */
104static __u32 baud_rates[] = { 2400, 9600, 19200, 38400, 57600, 115200, 576000, 104static __u32 baud_rates[] = { 2400, 9600, 19200, 38400, 57600, 115200, 576000,
105 1152000, 4000000, 16000000 }; /* bps */ 105 1152000, 4000000, 16000000 }; /* bps */
106static __u32 data_sizes[] = { 64, 128, 256, 512, 1024, 2048 }; /* bytes */ 106static __u32 data_sizes[] = { 64, 128, 256, 512, 1024, 2048 }; /* bytes */
107static __u32 add_bofs[] = { 48, 24, 12, 5, 3, 2, 1, 0 }; /* bytes */ 107static __u32 add_bofs[] = { 48, 24, 12, 5, 3, 2, 1, 0 }; /* bytes */
@@ -165,7 +165,7 @@ static pi_param_info_t irlap_param_info = { pi_major_call_table, 2, 0x7f, 7 };
165static inline int value_index(__u32 value, __u32 *array, int size) 165static inline int value_index(__u32 value, __u32 *array, int size)
166{ 166{
167 int i; 167 int i;
168 168
169 for (i=0; i < size; i++) 169 for (i=0; i < size; i++)
170 if (array[i] == value) 170 if (array[i] == value)
171 break; 171 break;
@@ -178,7 +178,7 @@ static inline int value_index(__u32 value, __u32 *array, int size)
178 * Returns value to index in array, easy! 178 * Returns value to index in array, easy!
179 * 179 *
180 */ 180 */
181static inline __u32 index_value(int index, __u32 *array) 181static inline __u32 index_value(int index, __u32 *array)
182{ 182{
183 return array[index]; 183 return array[index];
184} 184}
@@ -189,7 +189,7 @@ static inline __u32 index_value(int index, __u32 *array)
189 * Returns index to most significant bit (MSB) in word 189 * Returns index to most significant bit (MSB) in word
190 * 190 *
191 */ 191 */
192static int msb_index (__u16 word) 192static int msb_index (__u16 word)
193{ 193{
194 __u16 msb = 0x8000; 194 __u16 msb = 0x8000;
195 int index = 15; /* Current MSB */ 195 int index = 15; /* Current MSB */
@@ -298,12 +298,12 @@ void irda_qos_compute_intersection(struct qos_info *qos, struct qos_info *new)
298 * 298 *
299 * The purpose of this function is for layers and drivers to be able to 299 * The purpose of this function is for layers and drivers to be able to
300 * set the maximum QoS possible and then "and in" their own limitations 300 * set the maximum QoS possible and then "and in" their own limitations
301 * 301 *
302 */ 302 */
303void irda_init_max_qos_capabilies(struct qos_info *qos) 303void irda_init_max_qos_capabilies(struct qos_info *qos)
304{ 304{
305 int i; 305 int i;
306 /* 306 /*
307 * These are the maximum supported values as specified on pages 307 * These are the maximum supported values as specified on pages
308 * 39-43 in IrLAP 308 * 39-43 in IrLAP
309 */ 309 */
@@ -361,25 +361,25 @@ static void irlap_adjust_qos_settings(struct qos_info *qos)
361 qos->min_turn_time.value = sysctl_min_tx_turn_time; 361 qos->min_turn_time.value = sysctl_min_tx_turn_time;
362 } 362 }
363 363
364 /* 364 /*
365 * Not allowed to use a max turn time less than 500 ms if the baudrate 365 * Not allowed to use a max turn time less than 500 ms if the baudrate
366 * is less than 115200 366 * is less than 115200
367 */ 367 */
368 if ((qos->baud_rate.value < 115200) && 368 if ((qos->baud_rate.value < 115200) &&
369 (qos->max_turn_time.value < 500)) 369 (qos->max_turn_time.value < 500))
370 { 370 {
371 IRDA_DEBUG(0, 371 IRDA_DEBUG(0,
372 "%s(), adjusting max turn time from %d to 500 ms\n", 372 "%s(), adjusting max turn time from %d to 500 ms\n",
373 __FUNCTION__, qos->max_turn_time.value); 373 __FUNCTION__, qos->max_turn_time.value);
374 qos->max_turn_time.value = 500; 374 qos->max_turn_time.value = 500;
375 } 375 }
376 376
377 /* 377 /*
378 * The data size must be adjusted according to the baud rate and max 378 * The data size must be adjusted according to the baud rate and max
379 * turn time 379 * turn time
380 */ 380 */
381 index = value_index(qos->data_size.value, data_sizes, 6); 381 index = value_index(qos->data_size.value, data_sizes, 6);
382 line_capacity = irlap_max_line_capacity(qos->baud_rate.value, 382 line_capacity = irlap_max_line_capacity(qos->baud_rate.value,
383 qos->max_turn_time.value); 383 qos->max_turn_time.value);
384 384
385#ifdef CONFIG_IRDA_DYNAMIC_WINDOW 385#ifdef CONFIG_IRDA_DYNAMIC_WINDOW
@@ -427,32 +427,32 @@ static void irlap_adjust_qos_settings(struct qos_info *qos)
427 * We just set the QoS capabilities for the peer station 427 * We just set the QoS capabilities for the peer station
428 * 428 *
429 */ 429 */
430int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb) 430int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb)
431{ 431{
432 int ret; 432 int ret;
433 433
434 ret = irda_param_extract_all(self, skb->data, skb->len, 434 ret = irda_param_extract_all(self, skb->data, skb->len,
435 &irlap_param_info); 435 &irlap_param_info);
436 436
437 /* Convert the negotiated bits to values */ 437 /* Convert the negotiated bits to values */
438 irda_qos_bits_to_value(&self->qos_tx); 438 irda_qos_bits_to_value(&self->qos_tx);
439 irda_qos_bits_to_value(&self->qos_rx); 439 irda_qos_bits_to_value(&self->qos_rx);
440 440
441 irlap_adjust_qos_settings(&self->qos_tx); 441 irlap_adjust_qos_settings(&self->qos_tx);
442 442
443 IRDA_DEBUG(2, "Setting BAUD_RATE to %d bps.\n", 443 IRDA_DEBUG(2, "Setting BAUD_RATE to %d bps.\n",
444 self->qos_tx.baud_rate.value); 444 self->qos_tx.baud_rate.value);
445 IRDA_DEBUG(2, "Setting DATA_SIZE to %d bytes\n", 445 IRDA_DEBUG(2, "Setting DATA_SIZE to %d bytes\n",
446 self->qos_tx.data_size.value); 446 self->qos_tx.data_size.value);
447 IRDA_DEBUG(2, "Setting WINDOW_SIZE to %d\n", 447 IRDA_DEBUG(2, "Setting WINDOW_SIZE to %d\n",
448 self->qos_tx.window_size.value); 448 self->qos_tx.window_size.value);
449 IRDA_DEBUG(2, "Setting XBOFS to %d\n", 449 IRDA_DEBUG(2, "Setting XBOFS to %d\n",
450 self->qos_tx.additional_bofs.value); 450 self->qos_tx.additional_bofs.value);
451 IRDA_DEBUG(2, "Setting MAX_TURN_TIME to %d ms.\n", 451 IRDA_DEBUG(2, "Setting MAX_TURN_TIME to %d ms.\n",
452 self->qos_tx.max_turn_time.value); 452 self->qos_tx.max_turn_time.value);
453 IRDA_DEBUG(2, "Setting MIN_TURN_TIME to %d usecs.\n", 453 IRDA_DEBUG(2, "Setting MIN_TURN_TIME to %d usecs.\n",
454 self->qos_tx.min_turn_time.value); 454 self->qos_tx.min_turn_time.value);
455 IRDA_DEBUG(2, "Setting LINK_DISC to %d secs.\n", 455 IRDA_DEBUG(2, "Setting LINK_DISC to %d secs.\n",
456 self->qos_tx.link_disc_time.value); 456 self->qos_tx.link_disc_time.value);
457 return ret; 457 return ret;
458} 458}
@@ -463,55 +463,55 @@ int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb)
463 * Insert QoS negotiaion pararameters into frame 463 * Insert QoS negotiaion pararameters into frame
464 * 464 *
465 */ 465 */
466int irlap_insert_qos_negotiation_params(struct irlap_cb *self, 466int irlap_insert_qos_negotiation_params(struct irlap_cb *self,
467 struct sk_buff *skb) 467 struct sk_buff *skb)
468{ 468{
469 int ret; 469 int ret;
470 470
471 /* Insert data rate */ 471 /* Insert data rate */
472 ret = irda_param_insert(self, PI_BAUD_RATE, skb->tail, 472 ret = irda_param_insert(self, PI_BAUD_RATE, skb->tail,
473 skb_tailroom(skb), &irlap_param_info); 473 skb_tailroom(skb), &irlap_param_info);
474 if (ret < 0) 474 if (ret < 0)
475 return ret; 475 return ret;
476 skb_put(skb, ret); 476 skb_put(skb, ret);
477 477
478 /* Insert max turnaround time */ 478 /* Insert max turnaround time */
479 ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb->tail, 479 ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb->tail,
480 skb_tailroom(skb), &irlap_param_info); 480 skb_tailroom(skb), &irlap_param_info);
481 if (ret < 0) 481 if (ret < 0)
482 return ret; 482 return ret;
483 skb_put(skb, ret); 483 skb_put(skb, ret);
484 484
485 /* Insert data size */ 485 /* Insert data size */
486 ret = irda_param_insert(self, PI_DATA_SIZE, skb->tail, 486 ret = irda_param_insert(self, PI_DATA_SIZE, skb->tail,
487 skb_tailroom(skb), &irlap_param_info); 487 skb_tailroom(skb), &irlap_param_info);
488 if (ret < 0) 488 if (ret < 0)
489 return ret; 489 return ret;
490 skb_put(skb, ret); 490 skb_put(skb, ret);
491 491
492 /* Insert window size */ 492 /* Insert window size */
493 ret = irda_param_insert(self, PI_WINDOW_SIZE, skb->tail, 493 ret = irda_param_insert(self, PI_WINDOW_SIZE, skb->tail,
494 skb_tailroom(skb), &irlap_param_info); 494 skb_tailroom(skb), &irlap_param_info);
495 if (ret < 0) 495 if (ret < 0)
496 return ret; 496 return ret;
497 skb_put(skb, ret); 497 skb_put(skb, ret);
498 498
499 /* Insert additional BOFs */ 499 /* Insert additional BOFs */
500 ret = irda_param_insert(self, PI_ADD_BOFS, skb->tail, 500 ret = irda_param_insert(self, PI_ADD_BOFS, skb->tail,
501 skb_tailroom(skb), &irlap_param_info); 501 skb_tailroom(skb), &irlap_param_info);
502 if (ret < 0) 502 if (ret < 0)
503 return ret; 503 return ret;
504 skb_put(skb, ret); 504 skb_put(skb, ret);
505 505
506 /* Insert minimum turnaround time */ 506 /* Insert minimum turnaround time */
507 ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb->tail, 507 ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb->tail,
508 skb_tailroom(skb), &irlap_param_info); 508 skb_tailroom(skb), &irlap_param_info);
509 if (ret < 0) 509 if (ret < 0)
510 return ret; 510 return ret;
511 skb_put(skb, ret); 511 skb_put(skb, ret);
512 512
513 /* Insert link disconnect/threshold time */ 513 /* Insert link disconnect/threshold time */
514 ret = irda_param_insert(self, PI_LINK_DISC, skb->tail, 514 ret = irda_param_insert(self, PI_LINK_DISC, skb->tail,
515 skb_tailroom(skb), &irlap_param_info); 515 skb_tailroom(skb), &irlap_param_info);
516 if (ret < 0) 516 if (ret < 0)
517 return ret; 517 return ret;
@@ -537,12 +537,12 @@ static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get)
537 537
538 if (get) { 538 if (get) {
539 param->pv.i = self->qos_rx.baud_rate.bits; 539 param->pv.i = self->qos_rx.baud_rate.bits;
540 IRDA_DEBUG(2, "%s(), baud rate = 0x%02x\n", 540 IRDA_DEBUG(2, "%s(), baud rate = 0x%02x\n",
541 __FUNCTION__, param->pv.i); 541 __FUNCTION__, param->pv.i);
542 } else { 542 } else {
543 /* 543 /*
544 * Stations must agree on baud rate, so calculate 544 * Stations must agree on baud rate, so calculate
545 * intersection 545 * intersection
546 */ 546 */
547 IRDA_DEBUG(2, "Requested BAUD_RATE: 0x%04x\n", (__u16) param->pv.i); 547 IRDA_DEBUG(2, "Requested BAUD_RATE: 0x%04x\n", (__u16) param->pv.i);
548 final = (__u16) param->pv.i & self->qos_rx.baud_rate.bits; 548 final = (__u16) param->pv.i & self->qos_rx.baud_rate.bits;
@@ -558,24 +558,24 @@ static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get)
558/* 558/*
559 * Function irlap_param_link_disconnect (instance, param, get) 559 * Function irlap_param_link_disconnect (instance, param, get)
560 * 560 *
561 * Negotiate link disconnect/threshold time. 561 * Negotiate link disconnect/threshold time.
562 * 562 *
563 */ 563 */
564static int irlap_param_link_disconnect(void *instance, irda_param_t *param, 564static int irlap_param_link_disconnect(void *instance, irda_param_t *param,
565 int get) 565 int get)
566{ 566{
567 __u16 final; 567 __u16 final;
568 568
569 struct irlap_cb *self = (struct irlap_cb *) instance; 569 struct irlap_cb *self = (struct irlap_cb *) instance;
570 570
571 IRDA_ASSERT(self != NULL, return -1;); 571 IRDA_ASSERT(self != NULL, return -1;);
572 IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); 572 IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;);
573 573
574 if (get) 574 if (get)
575 param->pv.i = self->qos_rx.link_disc_time.bits; 575 param->pv.i = self->qos_rx.link_disc_time.bits;
576 else { 576 else {
577 /* 577 /*
578 * Stations must agree on link disconnect/threshold 578 * Stations must agree on link disconnect/threshold
579 * time. 579 * time.
580 */ 580 */
581 IRDA_DEBUG(2, "LINK_DISC: %02x\n", (__u8) param->pv.i); 581 IRDA_DEBUG(2, "LINK_DISC: %02x\n", (__u8) param->pv.i);
@@ -595,14 +595,14 @@ static int irlap_param_link_disconnect(void *instance, irda_param_t *param,
595 * will be negotiated independently for each station 595 * will be negotiated independently for each station
596 * 596 *
597 */ 597 */
598static int irlap_param_max_turn_time(void *instance, irda_param_t *param, 598static int irlap_param_max_turn_time(void *instance, irda_param_t *param,
599 int get) 599 int get)
600{ 600{
601 struct irlap_cb *self = (struct irlap_cb *) instance; 601 struct irlap_cb *self = (struct irlap_cb *) instance;
602 602
603 IRDA_ASSERT(self != NULL, return -1;); 603 IRDA_ASSERT(self != NULL, return -1;);
604 IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); 604 IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;);
605 605
606 if (get) 606 if (get)
607 param->pv.i = self->qos_rx.max_turn_time.bits; 607 param->pv.i = self->qos_rx.max_turn_time.bits;
608 else 608 else
@@ -621,10 +621,10 @@ static int irlap_param_max_turn_time(void *instance, irda_param_t *param,
621static int irlap_param_data_size(void *instance, irda_param_t *param, int get) 621static int irlap_param_data_size(void *instance, irda_param_t *param, int get)
622{ 622{
623 struct irlap_cb *self = (struct irlap_cb *) instance; 623 struct irlap_cb *self = (struct irlap_cb *) instance;
624 624
625 IRDA_ASSERT(self != NULL, return -1;); 625 IRDA_ASSERT(self != NULL, return -1;);
626 IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); 626 IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;);
627 627
628 if (get) 628 if (get)
629 param->pv.i = self->qos_rx.data_size.bits; 629 param->pv.i = self->qos_rx.data_size.bits;
630 else 630 else
@@ -640,14 +640,14 @@ static int irlap_param_data_size(void *instance, irda_param_t *param, int get)
640 * will be negotiated independently for each station 640 * will be negotiated independently for each station
641 * 641 *
642 */ 642 */
643static int irlap_param_window_size(void *instance, irda_param_t *param, 643static int irlap_param_window_size(void *instance, irda_param_t *param,
644 int get) 644 int get)
645{ 645{
646 struct irlap_cb *self = (struct irlap_cb *) instance; 646 struct irlap_cb *self = (struct irlap_cb *) instance;
647 647
648 IRDA_ASSERT(self != NULL, return -1;); 648 IRDA_ASSERT(self != NULL, return -1;);
649 IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); 649 IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;);
650 650
651 if (get) 651 if (get)
652 param->pv.i = self->qos_rx.window_size.bits; 652 param->pv.i = self->qos_rx.window_size.bits;
653 else 653 else
@@ -665,10 +665,10 @@ static int irlap_param_window_size(void *instance, irda_param_t *param,
665static int irlap_param_additional_bofs(void *instance, irda_param_t *param, int get) 665static int irlap_param_additional_bofs(void *instance, irda_param_t *param, int get)
666{ 666{
667 struct irlap_cb *self = (struct irlap_cb *) instance; 667 struct irlap_cb *self = (struct irlap_cb *) instance;
668 668
669 IRDA_ASSERT(self != NULL, return -1;); 669 IRDA_ASSERT(self != NULL, return -1;);
670 IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); 670 IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;);
671 671
672 if (get) 672 if (get)
673 param->pv.i = self->qos_rx.additional_bofs.bits; 673 param->pv.i = self->qos_rx.additional_bofs.bits;
674 else 674 else
@@ -683,14 +683,14 @@ static int irlap_param_additional_bofs(void *instance, irda_param_t *param, int
683 * Negotiate the minimum turn around time. This is a type 1 parameter and 683 * Negotiate the minimum turn around time. This is a type 1 parameter and
684 * will be negotiated independently for each station 684 * will be negotiated independently for each station
685 */ 685 */
686static int irlap_param_min_turn_time(void *instance, irda_param_t *param, 686static int irlap_param_min_turn_time(void *instance, irda_param_t *param,
687 int get) 687 int get)
688{ 688{
689 struct irlap_cb *self = (struct irlap_cb *) instance; 689 struct irlap_cb *self = (struct irlap_cb *) instance;
690 690
691 IRDA_ASSERT(self != NULL, return -1;); 691 IRDA_ASSERT(self != NULL, return -1;);
692 IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); 692 IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;);
693 693
694 if (get) 694 if (get)
695 param->pv.i = self->qos_rx.min_turn_time.bits; 695 param->pv.i = self->qos_rx.min_turn_time.bits;
696 else 696 else
@@ -721,9 +721,9 @@ __u32 irlap_max_line_capacity(__u32 speed, __u32 max_turn_time)
721 721
722 line_capacity = max_line_capacities[i][j]; 722 line_capacity = max_line_capacities[i][j];
723 723
724 IRDA_DEBUG(2, "%s(), line capacity=%d bytes\n", 724 IRDA_DEBUG(2, "%s(), line capacity=%d bytes\n",
725 __FUNCTION__, line_capacity); 725 __FUNCTION__, line_capacity);
726 726
727 return line_capacity; 727 return line_capacity;
728} 728}
729 729
@@ -749,7 +749,7 @@ void irda_qos_bits_to_value(struct qos_info *qos)
749 int index; 749 int index;
750 750
751 IRDA_ASSERT(qos != NULL, return;); 751 IRDA_ASSERT(qos != NULL, return;);
752 752
753 index = msb_index(qos->baud_rate.bits); 753 index = msb_index(qos->baud_rate.bits);
754 qos->baud_rate.value = baud_rates[index]; 754 qos->baud_rate.value = baud_rates[index];
755 755
@@ -761,13 +761,13 @@ void irda_qos_bits_to_value(struct qos_info *qos)
761 761
762 index = msb_index(qos->min_turn_time.bits); 762 index = msb_index(qos->min_turn_time.bits);
763 qos->min_turn_time.value = min_turn_times[index]; 763 qos->min_turn_time.value = min_turn_times[index];
764 764
765 index = msb_index(qos->max_turn_time.bits); 765 index = msb_index(qos->max_turn_time.bits);
766 qos->max_turn_time.value = max_turn_times[index]; 766 qos->max_turn_time.value = max_turn_times[index];
767 767
768 index = msb_index(qos->link_disc_time.bits); 768 index = msb_index(qos->link_disc_time.bits);
769 qos->link_disc_time.value = link_disc_times[index]; 769 qos->link_disc_time.value = link_disc_times[index];
770 770
771 index = msb_index(qos->additional_bofs.bits); 771 index = msb_index(qos->additional_bofs.bits);
772 qos->additional_bofs.value = add_bofs[index]; 772 qos->additional_bofs.value = add_bofs[index];
773} 773}
diff --git a/net/irda/timer.c b/net/irda/timer.c
index 3871a2b911f9..d3a6ee8cc4a2 100644
--- a/net/irda/timer.c
+++ b/net/irda/timer.c
@@ -1,25 +1,25 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: timer.c 3 * Filename: timer.c
4 * Version: 4 * Version:
5 * Description: 5 * Description:
6 * Status: Experimental. 6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no> 7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Sat Aug 16 00:59:29 1997 8 * Created at: Sat Aug 16 00:59:29 1997
9 * Modified at: Wed Dec 8 12:50:34 1999 9 * Modified at: Wed Dec 8 12:50:34 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, 12 * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>,
13 * All Rights Reserved. 13 * All Rights Reserved.
14 * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> 14 * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com>
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as 17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * Neither Dag Brattli nor University of Tromsų admit liability nor 21 * Neither Dag Brattli nor University of Tromsų admit liability nor
22 * provide warranty for any of this software. This material is 22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge. 23 * provided "AS-IS" and at no charge.
24 * 24 *
25 ********************************************************************/ 25 ********************************************************************/
@@ -40,11 +40,11 @@ static void irlap_query_timer_expired(void* data);
40static void irlap_final_timer_expired(void* data); 40static void irlap_final_timer_expired(void* data);
41static void irlap_wd_timer_expired(void* data); 41static void irlap_wd_timer_expired(void* data);
42static void irlap_backoff_timer_expired(void* data); 42static void irlap_backoff_timer_expired(void* data);
43static void irlap_media_busy_expired(void* data); 43static void irlap_media_busy_expired(void* data);
44 44
45void irlap_start_slot_timer(struct irlap_cb *self, int timeout) 45void irlap_start_slot_timer(struct irlap_cb *self, int timeout)
46{ 46{
47 irda_start_timer(&self->slot_timer, timeout, (void *) self, 47 irda_start_timer(&self->slot_timer, timeout, (void *) self,
48 irlap_slot_timer_expired); 48 irlap_slot_timer_expired);
49} 49}
50 50
@@ -67,31 +67,31 @@ void irlap_start_query_timer(struct irlap_cb *self, int S, int s)
67 /* Set or re-set the timer. We reset the timer for each received 67 /* Set or re-set the timer. We reset the timer for each received
68 * discovery query, which allow us to automatically adjust to 68 * discovery query, which allow us to automatically adjust to
69 * the speed of the peer discovery (faster or slower). Jean II */ 69 * the speed of the peer discovery (faster or slower). Jean II */
70 irda_start_timer( &self->query_timer, timeout, (void *) self, 70 irda_start_timer( &self->query_timer, timeout, (void *) self,
71 irlap_query_timer_expired); 71 irlap_query_timer_expired);
72} 72}
73 73
74void irlap_start_final_timer(struct irlap_cb *self, int timeout) 74void irlap_start_final_timer(struct irlap_cb *self, int timeout)
75{ 75{
76 irda_start_timer(&self->final_timer, timeout, (void *) self, 76 irda_start_timer(&self->final_timer, timeout, (void *) self,
77 irlap_final_timer_expired); 77 irlap_final_timer_expired);
78} 78}
79 79
80void irlap_start_wd_timer(struct irlap_cb *self, int timeout) 80void irlap_start_wd_timer(struct irlap_cb *self, int timeout)
81{ 81{
82 irda_start_timer(&self->wd_timer, timeout, (void *) self, 82 irda_start_timer(&self->wd_timer, timeout, (void *) self,
83 irlap_wd_timer_expired); 83 irlap_wd_timer_expired);
84} 84}
85 85
86void irlap_start_backoff_timer(struct irlap_cb *self, int timeout) 86void irlap_start_backoff_timer(struct irlap_cb *self, int timeout)
87{ 87{
88 irda_start_timer(&self->backoff_timer, timeout, (void *) self, 88 irda_start_timer(&self->backoff_timer, timeout, (void *) self,
89 irlap_backoff_timer_expired); 89 irlap_backoff_timer_expired);
90} 90}
91 91
92void irlap_start_mbusy_timer(struct irlap_cb *self, int timeout) 92void irlap_start_mbusy_timer(struct irlap_cb *self, int timeout)
93{ 93{
94 irda_start_timer(&self->media_busy_timer, timeout, 94 irda_start_timer(&self->media_busy_timer, timeout,
95 (void *) self, irlap_media_busy_expired); 95 (void *) self, irlap_media_busy_expired);
96} 96}
97 97
@@ -109,25 +109,25 @@ void irlap_stop_mbusy_timer(struct irlap_cb *self)
109 irlap_do_event(self, MEDIA_BUSY_TIMER_EXPIRED, NULL, NULL); 109 irlap_do_event(self, MEDIA_BUSY_TIMER_EXPIRED, NULL, NULL);
110} 110}
111 111
112void irlmp_start_watchdog_timer(struct lsap_cb *self, int timeout) 112void irlmp_start_watchdog_timer(struct lsap_cb *self, int timeout)
113{ 113{
114 irda_start_timer(&self->watchdog_timer, timeout, (void *) self, 114 irda_start_timer(&self->watchdog_timer, timeout, (void *) self,
115 irlmp_watchdog_timer_expired); 115 irlmp_watchdog_timer_expired);
116} 116}
117 117
118void irlmp_start_discovery_timer(struct irlmp_cb *self, int timeout) 118void irlmp_start_discovery_timer(struct irlmp_cb *self, int timeout)
119{ 119{
120 irda_start_timer(&self->discovery_timer, timeout, (void *) self, 120 irda_start_timer(&self->discovery_timer, timeout, (void *) self,
121 irlmp_discovery_timer_expired); 121 irlmp_discovery_timer_expired);
122} 122}
123 123
124void irlmp_start_idle_timer(struct lap_cb *self, int timeout) 124void irlmp_start_idle_timer(struct lap_cb *self, int timeout)
125{ 125{
126 irda_start_timer(&self->idle_timer, timeout, (void *) self, 126 irda_start_timer(&self->idle_timer, timeout, (void *) self,
127 irlmp_idle_timer_expired); 127 irlmp_idle_timer_expired);
128} 128}
129 129
130void irlmp_stop_idle_timer(struct lap_cb *self) 130void irlmp_stop_idle_timer(struct lap_cb *self)
131{ 131{
132 /* If timer is activated, kill it! */ 132 /* If timer is activated, kill it! */
133 del_timer(&self->idle_timer); 133 del_timer(&self->idle_timer);
@@ -147,7 +147,7 @@ static void irlap_slot_timer_expired(void *data)
147 IRDA_ASSERT(self->magic == LAP_MAGIC, return;); 147 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
148 148
149 irlap_do_event(self, SLOT_TIMER_EXPIRED, NULL, NULL); 149 irlap_do_event(self, SLOT_TIMER_EXPIRED, NULL, NULL);
150} 150}
151 151
152/* 152/*
153 * Function irlap_query_timer_expired (data) 153 * Function irlap_query_timer_expired (data)
@@ -163,12 +163,12 @@ static void irlap_query_timer_expired(void *data)
163 IRDA_ASSERT(self->magic == LAP_MAGIC, return;); 163 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
164 164
165 irlap_do_event(self, QUERY_TIMER_EXPIRED, NULL, NULL); 165 irlap_do_event(self, QUERY_TIMER_EXPIRED, NULL, NULL);
166} 166}
167 167
168/* 168/*
169 * Function irda_final_timer_expired (data) 169 * Function irda_final_timer_expired (data)
170 * 170 *
171 * 171 *
172 * 172 *
173 */ 173 */
174static void irlap_final_timer_expired(void *data) 174static void irlap_final_timer_expired(void *data)
@@ -184,32 +184,32 @@ static void irlap_final_timer_expired(void *data)
184/* 184/*
185 * Function irda_wd_timer_expired (data) 185 * Function irda_wd_timer_expired (data)
186 * 186 *
187 * 187 *
188 * 188 *
189 */ 189 */
190static void irlap_wd_timer_expired(void *data) 190static void irlap_wd_timer_expired(void *data)
191{ 191{
192 struct irlap_cb *self = (struct irlap_cb *) data; 192 struct irlap_cb *self = (struct irlap_cb *) data;
193 193
194 IRDA_ASSERT(self != NULL, return;); 194 IRDA_ASSERT(self != NULL, return;);
195 IRDA_ASSERT(self->magic == LAP_MAGIC, return;); 195 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
196 196
197 irlap_do_event(self, WD_TIMER_EXPIRED, NULL, NULL); 197 irlap_do_event(self, WD_TIMER_EXPIRED, NULL, NULL);
198} 198}
199 199
200/* 200/*
201 * Function irda_backoff_timer_expired (data) 201 * Function irda_backoff_timer_expired (data)
202 * 202 *
203 * 203 *
204 * 204 *
205 */ 205 */
206static void irlap_backoff_timer_expired(void *data) 206static void irlap_backoff_timer_expired(void *data)
207{ 207{
208 struct irlap_cb *self = (struct irlap_cb *) data; 208 struct irlap_cb *self = (struct irlap_cb *) data;
209 209
210 IRDA_ASSERT(self != NULL, return;); 210 IRDA_ASSERT(self != NULL, return;);
211 IRDA_ASSERT(self->magic == LAP_MAGIC, return;); 211 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
212 212
213 irlap_do_event(self, BACKOFF_TIMER_EXPIRED, NULL, NULL); 213 irlap_do_event(self, BACKOFF_TIMER_EXPIRED, NULL, NULL);
214} 214}
215 215
@@ -217,7 +217,7 @@ static void irlap_backoff_timer_expired(void *data)
217/* 217/*
218 * Function irtty_media_busy_expired (data) 218 * Function irtty_media_busy_expired (data)
219 * 219 *
220 * 220 *
221 */ 221 */
222void irlap_media_busy_expired(void* data) 222void irlap_media_busy_expired(void* data)
223{ 223{
diff --git a/net/irda/wrapper.c b/net/irda/wrapper.c
index 87130c1c8693..5abfb71aae8d 100644
--- a/net/irda/wrapper.c
+++ b/net/irda/wrapper.c
@@ -295,7 +295,7 @@ async_unwrap_bof(struct net_device *dev,
295 case OUTSIDE_FRAME: 295 case OUTSIDE_FRAME:
296 case BEGIN_FRAME: 296 case BEGIN_FRAME:
297 default: 297 default:
298 /* We may receive multiple BOF at the start of frame */ 298 /* We may receive multiple BOF at the start of frame */
299 break; 299 break;
300 } 300 }
301 301