aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/ircomm/ircomm_core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
commitcb18eccff48ef3986d1072964590bce6fec705fb (patch)
tree777fb1d15e0281341e1e02c9803d989538d346f2 /net/irda/ircomm/ircomm_core.c
parentc827ba4cb49a30ce581201fd0ba2be77cde412c7 (diff)
parent5ef213f6842277ee1df5659f59fac0ffc9beb411 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (45 commits) [IPV4]: Restore multipath routing after rt_next changes. [XFRM] IPV6: Fix outbound RO transformation which is broken by IPsec tunnel patch. [NET]: Reorder fields of struct dst_entry [DECNET]: Convert decnet route to use the new dst_entry 'next' pointer [IPV6]: Convert ipv6 route to use the new dst_entry 'next' pointer [IPV4]: Convert ipv4 route to use the new dst_entry 'next' pointer [NET]: Introduce union in struct dst_entry to hold 'next' pointer [DECNET]: fix misannotation of linkinfo_dn [DECNET]: FRA_{DST,SRC} are le16 for decnet [UDP]: UDP can use sk_hash to speedup lookups [NET]: Fix whitespace errors. [NET] XFRM: Fix whitespace errors. [NET] X25: Fix whitespace errors. [NET] WANROUTER: Fix whitespace errors. [NET] UNIX: Fix whitespace errors. [NET] TIPC: Fix whitespace errors. [NET] SUNRPC: Fix whitespace errors. [NET] SCTP: Fix whitespace errors. [NET] SCHED: Fix whitespace errors. [NET] RXRPC: Fix whitespace errors. ...
Diffstat (limited to 'net/irda/ircomm/ircomm_core.c')
-rw-r--r--net/irda/ircomm/ircomm_core.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/net/irda/ircomm/ircomm_core.c b/net/irda/ircomm/ircomm_core.c
index ad6b6af3dd9..c28ee7bce26 100644
--- a/net/irda/ircomm/ircomm_core.c
+++ b/net/irda/ircomm/ircomm_core.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: ircomm_core.c 3 * Filename: ircomm_core.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: IrCOMM service interface 5 * Description: IrCOMM service interface
@@ -8,25 +8,25 @@
8 * Created at: Sun Jun 6 20:37:34 1999 8 * Created at: Sun Jun 6 20:37:34 1999
9 * Modified at: Tue Dec 21 13:26:41 1999 9 * Modified at: Tue Dec 21 13:26:41 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1999 Dag Brattli, All Rights Reserved. 12 * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
13 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> 13 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
14 * 14 *
15 * This program is free software; you can redistribute it and/or 15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as 16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * This program is distributed in the hope that it will be useful, 20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details. 23 * GNU General Public License for more details.
24 * 24 *
25 * You should have received a copy of the GNU General Public License 25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software 26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA 28 * MA 02111-1307 USA
29 * 29 *
30 ********************************************************************/ 30 ********************************************************************/
31 31
32#include <linux/module.h> 32#include <linux/module.h>
@@ -49,7 +49,7 @@
49#include <net/irda/ircomm_core.h> 49#include <net/irda/ircomm_core.h>
50 50
51static int __ircomm_close(struct ircomm_cb *self); 51static int __ircomm_close(struct ircomm_cb *self);
52static void ircomm_control_indication(struct ircomm_cb *self, 52static void ircomm_control_indication(struct ircomm_cb *self,
53 struct sk_buff *skb, int clen); 53 struct sk_buff *skb, int clen);
54 54
55#ifdef CONFIG_PROC_FS 55#ifdef CONFIG_PROC_FS
@@ -69,22 +69,22 @@ hashbin_t *ircomm = NULL;
69 69
70static int __init ircomm_init(void) 70static int __init ircomm_init(void)
71{ 71{
72 ircomm = hashbin_new(HB_LOCK); 72 ircomm = hashbin_new(HB_LOCK);
73 if (ircomm == NULL) { 73 if (ircomm == NULL) {
74 IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__); 74 IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__);
75 return -ENOMEM; 75 return -ENOMEM;
76 } 76 }
77 77
78#ifdef CONFIG_PROC_FS 78#ifdef CONFIG_PROC_FS
79 { struct proc_dir_entry *ent; 79 { struct proc_dir_entry *ent;
80 ent = create_proc_entry("ircomm", 0, proc_irda); 80 ent = create_proc_entry("ircomm", 0, proc_irda);
81 if (ent) 81 if (ent)
82 ent->proc_fops = &ircomm_proc_fops; 82 ent->proc_fops = &ircomm_proc_fops;
83 } 83 }
84#endif /* CONFIG_PROC_FS */ 84#endif /* CONFIG_PROC_FS */
85 85
86 IRDA_MESSAGE("IrCOMM protocol (Dag Brattli)\n"); 86 IRDA_MESSAGE("IrCOMM protocol (Dag Brattli)\n");
87 87
88 return 0; 88 return 0;
89} 89}
90 90
@@ -139,7 +139,7 @@ struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line)
139 139
140 hashbin_insert(ircomm, (irda_queue_t *) self, line, NULL); 140 hashbin_insert(ircomm, (irda_queue_t *) self, line, NULL);
141 141
142 ircomm_next_state(self, IRCOMM_IDLE); 142 ircomm_next_state(self, IRCOMM_IDLE);
143 143
144 return self; 144 return self;
145} 145}
@@ -195,8 +195,8 @@ int ircomm_close(struct ircomm_cb *self)
195 entry = hashbin_remove(ircomm, self->line, NULL); 195 entry = hashbin_remove(ircomm, self->line, NULL);
196 196
197 IRDA_ASSERT(entry == self, return -1;); 197 IRDA_ASSERT(entry == self, return -1;);
198 198
199 return __ircomm_close(self); 199 return __ircomm_close(self);
200} 200}
201 201
202EXPORT_SYMBOL(ircomm_close); 202EXPORT_SYMBOL(ircomm_close);
@@ -206,9 +206,9 @@ EXPORT_SYMBOL(ircomm_close);
206 * 206 *
207 * Impl. of this function is differ from one of the reference. This 207 * Impl. of this function is differ from one of the reference. This
208 * function does discovery as well as sending connect request 208 * function does discovery as well as sending connect request
209 * 209 *
210 */ 210 */
211int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel, 211int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel,
212 __u32 saddr, __u32 daddr, struct sk_buff *skb, 212 __u32 saddr, __u32 daddr, struct sk_buff *skb,
213 __u8 service_type) 213 __u8 service_type)
214{ 214{
@@ -243,20 +243,20 @@ void ircomm_connect_indication(struct ircomm_cb *self, struct sk_buff *skb,
243 struct ircomm_info *info) 243 struct ircomm_info *info)
244{ 244{
245 int clen = 0; 245 int clen = 0;
246 246
247 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 247 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
248 248
249 /* Check if the packet contains data on the control channel */ 249 /* Check if the packet contains data on the control channel */
250 if (skb->len > 0) 250 if (skb->len > 0)
251 clen = skb->data[0]; 251 clen = skb->data[0];
252 252
253 /* 253 /*
254 * If there are any data hiding in the control channel, we must 254 * If there are any data hiding in the control channel, we must
255 * deliver it first. The side effect is that the control channel 255 * deliver it first. The side effect is that the control channel
256 * will be removed from the skb 256 * will be removed from the skb
257 */ 257 */
258 if (self->notify.connect_indication) 258 if (self->notify.connect_indication)
259 self->notify.connect_indication(self->notify.instance, self, 259 self->notify.connect_indication(self->notify.instance, self,
260 info->qos, info->max_data_size, 260 info->qos, info->max_data_size,
261 info->max_header_size, skb); 261 info->max_header_size, skb);
262 else { 262 else {
@@ -282,7 +282,7 @@ int ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata)
282 ret = ircomm_do_event(self, IRCOMM_CONNECT_RESPONSE, userdata, NULL); 282 ret = ircomm_do_event(self, IRCOMM_CONNECT_RESPONSE, userdata, NULL);
283 283
284 return ret; 284 return ret;
285} 285}
286 286
287EXPORT_SYMBOL(ircomm_connect_response); 287EXPORT_SYMBOL(ircomm_connect_response);
288 288
@@ -299,7 +299,7 @@ void ircomm_connect_confirm(struct ircomm_cb *self, struct sk_buff *skb,
299 299
300 if (self->notify.connect_confirm ) 300 if (self->notify.connect_confirm )
301 self->notify.connect_confirm(self->notify.instance, 301 self->notify.connect_confirm(self->notify.instance,
302 self, info->qos, 302 self, info->qos,
303 info->max_data_size, 303 info->max_data_size,
304 info->max_header_size, skb); 304 info->max_header_size, skb);
305 else { 305 else {
@@ -322,7 +322,7 @@ int ircomm_data_request(struct ircomm_cb *self, struct sk_buff *skb)
322 IRDA_ASSERT(self != NULL, return -EFAULT;); 322 IRDA_ASSERT(self != NULL, return -EFAULT;);
323 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;); 323 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;);
324 IRDA_ASSERT(skb != NULL, return -EFAULT;); 324 IRDA_ASSERT(skb != NULL, return -EFAULT;);
325 325
326 ret = ircomm_do_event(self, IRCOMM_DATA_REQUEST, skb, NULL); 326 ret = ircomm_do_event(self, IRCOMM_DATA_REQUEST, skb, NULL);
327 327
328 return ret; 328 return ret;
@@ -337,7 +337,7 @@ EXPORT_SYMBOL(ircomm_data_request);
337 * 337 *
338 */ 338 */
339void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb) 339void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb)
340{ 340{
341 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 341 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
342 342
343 IRDA_ASSERT(skb->len > 0, return;); 343 IRDA_ASSERT(skb->len > 0, return;);
@@ -363,9 +363,9 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb)
363 363
364 clen = skb->data[0]; 364 clen = skb->data[0];
365 365
366 /* 366 /*
367 * If there are any data hiding in the control channel, we must 367 * If there are any data hiding in the control channel, we must
368 * deliver it first. The side effect is that the control channel 368 * deliver it first. The side effect is that the control channel
369 * will be removed from the skb 369 * will be removed from the skb
370 */ 370 */
371 if (clen > 0) 371 if (clen > 0)
@@ -375,7 +375,7 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb)
375 skb_pull(skb, clen+1); 375 skb_pull(skb, clen+1);
376 376
377 if (skb->len) 377 if (skb->len)
378 ircomm_data_indication(self, skb); 378 ircomm_data_indication(self, skb);
379 else { 379 else {
380 IRDA_DEBUG(4, "%s(), data was control info only!\n", 380 IRDA_DEBUG(4, "%s(), data was control info only!\n",
381 __FUNCTION__ ); 381 __FUNCTION__ );
@@ -391,13 +391,13 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb)
391int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb) 391int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb)
392{ 392{
393 int ret; 393 int ret;
394 394
395 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 395 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
396 396
397 IRDA_ASSERT(self != NULL, return -EFAULT;); 397 IRDA_ASSERT(self != NULL, return -EFAULT;);
398 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;); 398 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;);
399 IRDA_ASSERT(skb != NULL, return -EFAULT;); 399 IRDA_ASSERT(skb != NULL, return -EFAULT;);
400 400
401 ret = ircomm_do_event(self, IRCOMM_CONTROL_REQUEST, skb, NULL); 401 ret = ircomm_do_event(self, IRCOMM_CONTROL_REQUEST, skb, NULL);
402 402
403 return ret; 403 return ret;
@@ -411,10 +411,10 @@ EXPORT_SYMBOL(ircomm_control_request);
411 * Data has arrived on the control channel 411 * Data has arrived on the control channel
412 * 412 *
413 */ 413 */
414static void ircomm_control_indication(struct ircomm_cb *self, 414static void ircomm_control_indication(struct ircomm_cb *self,
415 struct sk_buff *skb, int clen) 415 struct sk_buff *skb, int clen)
416{ 416{
417 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 417 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
418 418
419 /* Use udata for delivering data on the control channel */ 419 /* Use udata for delivering data on the control channel */
420 if (self->notify.udata_indication) { 420 if (self->notify.udata_indication) {
@@ -427,8 +427,8 @@ static void ircomm_control_indication(struct ircomm_cb *self,
427 427
428 /* Remove data channel from control channel */ 428 /* Remove data channel from control channel */
429 skb_trim(ctrl_skb, clen+1); 429 skb_trim(ctrl_skb, clen+1);
430 430
431 self->notify.udata_indication(self->notify.instance, self, 431 self->notify.udata_indication(self->notify.instance, self,
432 ctrl_skb); 432 ctrl_skb);
433 433
434 /* Drop reference count - 434 /* Drop reference count -
@@ -455,7 +455,7 @@ int ircomm_disconnect_request(struct ircomm_cb *self, struct sk_buff *userdata)
455 IRDA_ASSERT(self != NULL, return -1;); 455 IRDA_ASSERT(self != NULL, return -1;);
456 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;); 456 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;);
457 457
458 ret = ircomm_do_event(self, IRCOMM_DISCONNECT_REQUEST, userdata, 458 ret = ircomm_do_event(self, IRCOMM_DISCONNECT_REQUEST, userdata,
459 &info); 459 &info);
460 return ret; 460 return ret;
461} 461}
@@ -472,7 +472,7 @@ void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb,
472 struct ircomm_info *info) 472 struct ircomm_info *info)
473{ 473{
474 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 474 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
475 475
476 IRDA_ASSERT(info != NULL, return;); 476 IRDA_ASSERT(info != NULL, return;);
477 477
478 if (self->notify.disconnect_indication) { 478 if (self->notify.disconnect_indication) {
@@ -486,7 +486,7 @@ void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb,
486/* 486/*
487 * Function ircomm_flow_request (self, flow) 487 * Function ircomm_flow_request (self, flow)
488 * 488 *
489 * 489 *
490 * 490 *
491 */ 491 */
492void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow) 492void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow)
@@ -517,7 +517,7 @@ static void *ircomm_seq_start(struct seq_file *seq, loff_t *pos)
517 self = (struct ircomm_cb *) hashbin_get_next(ircomm)) { 517 self = (struct ircomm_cb *) hashbin_get_next(ircomm)) {
518 if (off++ == *pos) 518 if (off++ == *pos)
519 break; 519 break;
520 520
521 } 521 }
522 return self; 522 return self;
523} 523}
@@ -535,7 +535,7 @@ static void ircomm_seq_stop(struct seq_file *seq, void *v)
535} 535}
536 536
537static int ircomm_seq_show(struct seq_file *seq, void *v) 537static int ircomm_seq_show(struct seq_file *seq, void *v)
538{ 538{
539 const struct ircomm_cb *self = v; 539 const struct ircomm_cb *self = v;
540 540
541 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EINVAL; ); 541 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EINVAL; );
@@ -548,7 +548,7 @@ static int ircomm_seq_show(struct seq_file *seq, void *v)
548 seq_printf(seq, 548 seq_printf(seq,
549 " state: %s, slsap_sel: %#02x, dlsap_sel: %#02x, mode:", 549 " state: %s, slsap_sel: %#02x, dlsap_sel: %#02x, mode:",
550 ircomm_state[ self->state], 550 ircomm_state[ self->state],
551 self->slsap_sel, self->dlsap_sel); 551 self->slsap_sel, self->dlsap_sel);
552 552
553 if(self->service_type & IRCOMM_3_WIRE_RAW) 553 if(self->service_type & IRCOMM_3_WIRE_RAW)
554 seq_printf(seq, " 3-wire-raw"); 554 seq_printf(seq, " 3-wire-raw");