diff options
Diffstat (limited to 'net/irda/ircomm')
-rw-r--r-- | net/irda/ircomm/ircomm_core.c | 98 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_event.c | 72 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_lmp.c | 110 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_param.c | 94 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_ttp.c | 88 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_tty.c | 288 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_tty_attach.c | 236 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_tty_ioctl.c | 86 |
8 files changed, 536 insertions, 536 deletions
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 | ||
51 | static int __ircomm_close(struct ircomm_cb *self); | 51 | static int __ircomm_close(struct ircomm_cb *self); |
52 | static void ircomm_control_indication(struct ircomm_cb *self, | 52 | static 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 | ||
70 | static int __init ircomm_init(void) | 70 | static 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 | ||
202 | EXPORT_SYMBOL(ircomm_close); | 202 | EXPORT_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 | */ |
211 | int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel, | 211 | int 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 | ||
287 | EXPORT_SYMBOL(ircomm_connect_response); | 287 | EXPORT_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 | */ |
339 | void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb) | 339 | void 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) | |||
391 | int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb) | 391 | int 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 | */ |
414 | static void ircomm_control_indication(struct ircomm_cb *self, | 414 | static 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 | */ |
492 | void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow) | 492 | void 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 | ||
537 | static int ircomm_seq_show(struct seq_file *seq, void *v) | 537 | static 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 | ||
44 | static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, | 44 | static 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); |
46 | static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, | 46 | static 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); |
48 | static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, | 48 | static 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); |
50 | static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, | 50 | static 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 | ||
53 | char *ircomm_state[] = { | 53 | char *ircomm_state[] = { |
@@ -60,26 +60,26 @@ char *ircomm_state[] = { | |||
60 | #ifdef CONFIG_IRDA_DEBUG | 60 | #ifdef CONFIG_IRDA_DEBUG |
61 | static char *ircomm_event[] = { | 61 | static 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 | ||
81 | static int (*state[])(struct ircomm_cb *self, IRCOMM_EVENT event, | 81 | static 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 | */ |
96 | static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, | 96 | static 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 | */ |
125 | static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, | 125 | static 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 | */ |
155 | static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, | 155 | static 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 | */ |
188 | static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, | 188 | static 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 | */ |
230 | int ircomm_do_event(struct ircomm_cb *self, IRCOMM_EVENT event, | 230 | int 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, | |||
245 | void ircomm_next_state(struct ircomm_cb *self, IRCOMM_STATE state) | 245 | void 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 | */ |
51 | static int ircomm_lmp_connect_request(struct ircomm_cb *self, | 51 | static 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 | */ |
74 | static int ircomm_lmp_connect_response(struct ircomm_cb *self, | 74 | static 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 | ||
108 | static int ircomm_lmp_disconnect_request(struct ircomm_cb *self, | 108 | static 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 | */ |
142 | static void ircomm_lmp_flow_control(struct sk_buff *skb) | 142 | static 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 | */ |
182 | static int ircomm_lmp_data_request(struct ircomm_cb *self, | 182 | static 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 | */ |
250 | static void ircomm_lmp_connect_confirm(void *instance, void *sap, | 250 | static 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 | */ |
315 | static void ircomm_lmp_disconnect_indication(void *instance, void *sap, | 315 | static 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 | ||
44 | static int ircomm_param_service_type(void *instance, irda_param_t *param, | 44 | static int ircomm_param_service_type(void *instance, irda_param_t *param, |
45 | int get); | 45 | int get); |
46 | static int ircomm_param_port_type(void *instance, irda_param_t *param, | 46 | static int ircomm_param_port_type(void *instance, irda_param_t *param, |
47 | int get); | 47 | int get); |
48 | static int ircomm_param_port_name(void *instance, irda_param_t *param, | 48 | static int ircomm_param_port_name(void *instance, irda_param_t *param, |
49 | int get); | 49 | int get); |
50 | static int ircomm_param_service_type(void *instance, irda_param_t *param, | 50 | static int ircomm_param_service_type(void *instance, irda_param_t *param, |
51 | int get); | 51 | int get); |
52 | static int ircomm_param_data_rate(void *instance, irda_param_t *param, | 52 | static int ircomm_param_data_rate(void *instance, irda_param_t *param, |
53 | int get); | 53 | int get); |
54 | static int ircomm_param_data_format(void *instance, irda_param_t *param, | 54 | static int ircomm_param_data_format(void *instance, irda_param_t *param, |
55 | int get); | 55 | int get); |
56 | static int ircomm_param_flow_control(void *instance, irda_param_t *param, | 56 | static int ircomm_param_flow_control(void *instance, irda_param_t *param, |
57 | int get); | 57 | int get); |
58 | static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get); | 58 | static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get); |
59 | static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get); | 59 | static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get); |
60 | static int ircomm_param_line_status(void *instance, irda_param_t *param, | 60 | static int ircomm_param_line_status(void *instance, irda_param_t *param, |
61 | int get); | 61 | int get); |
62 | static int ircomm_param_dte(void *instance, irda_param_t *param, int get); | 62 | static int ircomm_param_dte(void *instance, irda_param_t *param, int get); |
63 | static int ircomm_param_dce(void *instance, irda_param_t *param, int get); | 63 | static 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[] = { | |||
85 | static pi_major_info_t pi_major_call_table[] = { | 85 | static 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 | */ |
165 | static int ircomm_param_service_type(void *instance, irda_param_t *param, | 165 | static 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) | |||
256 | static int ircomm_param_port_name(void *instance, irda_param_t *param, int get) | 256 | static 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) | |||
279 | static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get) | 279 | static 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 | */ |
302 | static int ircomm_param_data_format(void *instance, irda_param_t *param, | 302 | static 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 | */ |
324 | static int ircomm_param_flow_control(void *instance, irda_param_t *param, | 324 | static 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 | */ |
402 | static int ircomm_param_line_status(void *instance, irda_param_t *param, | 402 | static 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 | */ |
461 | static int ircomm_param_dce(void *instance, irda_param_t *param, int get) | 461 | static 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 @@ | |||
43 | static int ircomm_ttp_data_indication(void *instance, void *sap, | 43 | static int ircomm_ttp_data_indication(void *instance, void *sap, |
44 | struct sk_buff *skb); | 44 | struct sk_buff *skb); |
45 | static void ircomm_ttp_connect_confirm(void *instance, void *sap, | 45 | static 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); |
50 | static void ircomm_ttp_connect_indication(void *instance, void *sap, | 50 | static 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); |
55 | static void ircomm_ttp_flow_indication(void *instance, void *sap, | 55 | static void ircomm_ttp_flow_indication(void *instance, void *sap, |
56 | LOCAL_FLOW cmd); | 56 | LOCAL_FLOW cmd); |
57 | static void ircomm_ttp_disconnect_indication(void *instance, void *sap, | 57 | static 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); |
60 | static int ircomm_ttp_data_request(struct ircomm_cb *self, | 60 | static 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); |
63 | static int ircomm_ttp_connect_request(struct ircomm_cb *self, | 63 | static 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); |
66 | static int ircomm_ttp_connect_response(struct ircomm_cb *self, | 66 | static int ircomm_ttp_connect_response(struct ircomm_cb *self, |
67 | struct sk_buff *userdata); | 67 | struct sk_buff *userdata); |
68 | static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, | 68 | static 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 | */ |
78 | int ircomm_open_tsap(struct ircomm_cb *self) | 78 | int 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 | */ |
119 | static int ircomm_ttp_connect_request(struct ircomm_cb *self, | 119 | static 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 | */ |
144 | static int ircomm_ttp_connect_response(struct ircomm_cb *self, | 144 | static 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 | */ |
169 | static int ircomm_ttp_data_request(struct ircomm_cb *self, | 169 | static 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 | ||
226 | static void ircomm_ttp_connect_confirm(void *instance, void *sap, | 226 | static 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 | */ |
267 | static void ircomm_ttp_connect_indication(void *instance, void *sap, | 267 | static 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 | */ |
307 | static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, | 307 | static 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 | */ |
328 | static void ircomm_ttp_disconnect_indication(void *instance, void *sap, | 328 | static 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); |
70 | static int ircomm_tty_control_indication(void *instance, void *sap, | 70 | static int ircomm_tty_control_indication(void *instance, void *sap, |
71 | struct sk_buff *skb); | 71 | struct sk_buff *skb); |
72 | static void ircomm_tty_flow_indication(void *instance, void *sap, | 72 | static 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 |
75 | static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len, | 75 | static 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 | */ |
185 | static int ircomm_tty_startup(struct ircomm_tty_cb *self) | 185 | static 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(¬ify, self->service_type, | 216 | self->ircomm = ircomm_open(¬ify, 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 | */ |
243 | static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | 243 | static 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 | */ |
582 | static void ircomm_tty_flush_buffer(struct tty_struct *tty) | 582 | static 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 | */ |
603 | static void ircomm_tty_do_softint(struct work_struct *work) | 603 | static 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 | */ |
881 | static void ircomm_tty_throttle(struct tty_struct *tty) | 881 | static 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 | */ |
1006 | static void ircomm_tty_hangup(struct tty_struct *tty) | 1006 | static 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 | */ |
1049 | void ircomm_tty_start(struct tty_struct *tty) | 1049 | void 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 | */ |
1062 | static void ircomm_tty_stop(struct tty_struct *tty) | 1062 | static 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 | */ |
1220 | static void ircomm_tty_flow_indication(void *instance, void *sap, | 1220 | static 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 | ||
1248 | static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf) | 1248 | static 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; |
1385 | done: | 1385 | done: |
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); | |||
50 | static void ircomm_tty_discovery_indication(discinfo_t *discovery, | 50 | static void ircomm_tty_discovery_indication(discinfo_t *discovery, |
51 | DISCOVERY_MODE mode, | 51 | DISCOVERY_MODE mode, |
52 | void *priv); | 52 | void *priv); |
53 | static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, | 53 | static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, |
54 | struct ias_value *value, void *priv); | 54 | struct ias_value *value, void *priv); |
55 | static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, | 55 | static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, |
56 | int timeout); | 56 | int timeout); |
57 | static void ircomm_tty_watchdog_timer_expired(void *data); | 57 | static void ircomm_tty_watchdog_timer_expired(void *data); |
58 | 58 | ||
59 | static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, | 59 | static 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); |
63 | static int ircomm_tty_state_search(struct ircomm_tty_cb *self, | 63 | static 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); |
67 | static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, | 67 | static 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); |
71 | static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, | 71 | static 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); |
75 | static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, | 75 | static 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); |
79 | static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, | 79 | static 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 | ||
84 | char *ircomm_tty_state[] = { | 84 | char *ircomm_tty_state[] = { |
@@ -111,7 +111,7 @@ static char *ircomm_tty_event[] = { | |||
111 | #endif /* CONFIG_IRDA_DEBUG */ | 111 | #endif /* CONFIG_IRDA_DEBUG */ |
112 | 112 | ||
113 | static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, | 113 | static 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 | */ |
131 | int ircomm_tty_attach_cable(struct ircomm_tty_cb *self) | 131 | int 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 | */ |
405 | void ircomm_tty_disconnect_indication(void *instance, void *sap, | 405 | void 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 | */ |
435 | static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, | 435 | static 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 | */ |
494 | void ircomm_tty_connect_confirm(void *instance, void *sap, | 494 | void 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 | */ |
524 | void ircomm_tty_connect_indication(void *instance, void *sap, | 524 | void 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 | */ |
600 | static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, | 600 | static 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, | |||
616 | static void ircomm_tty_watchdog_timer_expired(void *data) | 616 | static 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 | */ |
635 | int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, | 635 | int 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 | */ |
671 | static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, | 671 | static 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 | */ |
735 | static int ircomm_tty_state_search(struct ircomm_tty_cb *self, | 735 | static 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 | */ |
808 | static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, | 808 | static 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 | */ |
866 | static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, | 866 | static 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 | */ |
915 | static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, | 915 | static 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 | */ |
969 | static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, | 969 | static 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 | */ |
148 | void ircomm_tty_set_termios(struct tty_struct *tty, | 148 | void 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 | */ |
198 | int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file) | 198 | int 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 | */ |
223 | int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, | 223 | int 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 | */ |
262 | static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, | 262 | static 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 | */ |
299 | static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, | 299 | static 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 | */ |
374 | int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, | 374 | int 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 */ |