Merge git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-drm-fsl-dcu.git] / net / irda / ircomm / ircomm_core.c
index ad6b6af3dd976c97bd75818f55e4361421923529..c28ee7bce26add7fe60f6bad0c295050d0a2b11e 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************************
- *                
+ *
  * Filename:      ircomm_core.c
  * Version:       1.0
  * Description:   IrCOMM service interface
@@ -8,25 +8,25 @@
  * Created at:    Sun Jun  6 20:37:34 1999
  * Modified at:   Tue Dec 21 13:26:41 1999
  * Modified by:   Dag Brattli <dagb@cs.uit.no>
- * 
+ *
  *     Copyright (c) 1999 Dag Brattli, All Rights Reserved.
  *     Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
- *     
- *     This program is free software; you can redistribute it and/or 
- *     modify it under the terms of the GNU General Public License as 
- *     published by the Free Software Foundation; either version 2 of 
+ *
+ *     This program is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of
  *     the License, or (at your option) any later version.
- * 
+ *
  *     This program is distributed in the hope that it will be useful,
  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  *     GNU General Public License for more details.
- * 
- *     You should have received a copy of the GNU General Public License 
- *     along with this program; if not, write to the Free Software 
- *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
+ *
+ *     You should have received a copy of the GNU General Public License
+ *     along with this program; if not, write to the Free Software
+ *     Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  *     MA 02111-1307 USA
- *     
+ *
  ********************************************************************/
 
 #include <linux/module.h>
@@ -49,7 +49,7 @@
 #include <net/irda/ircomm_core.h>
 
 static int __ircomm_close(struct ircomm_cb *self);
-static void ircomm_control_indication(struct ircomm_cb *self, 
+static void ircomm_control_indication(struct ircomm_cb *self,
                                      struct sk_buff *skb, int clen);
 
 #ifdef CONFIG_PROC_FS
@@ -69,22 +69,22 @@ hashbin_t *ircomm = NULL;
 
 static int __init ircomm_init(void)
 {
-       ircomm = hashbin_new(HB_LOCK); 
+       ircomm = hashbin_new(HB_LOCK);
        if (ircomm == NULL) {
                IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__);
                return -ENOMEM;
        }
-       
+
 #ifdef CONFIG_PROC_FS
        { struct proc_dir_entry *ent;
        ent = create_proc_entry("ircomm", 0, proc_irda);
-       if (ent) 
+       if (ent)
                ent->proc_fops = &ircomm_proc_fops;
        }
 #endif /* CONFIG_PROC_FS */
-       
+
        IRDA_MESSAGE("IrCOMM protocol (Dag Brattli)\n");
-               
+
        return 0;
 }
 
@@ -139,7 +139,7 @@ struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line)
 
        hashbin_insert(ircomm, (irda_queue_t *) self, line, NULL);
 
-       ircomm_next_state(self, IRCOMM_IDLE);   
+       ircomm_next_state(self, IRCOMM_IDLE);
 
        return self;
 }
@@ -195,8 +195,8 @@ int ircomm_close(struct ircomm_cb *self)
        entry = hashbin_remove(ircomm, self->line, NULL);
 
        IRDA_ASSERT(entry == self, return -1;);
-       
-        return __ircomm_close(self);
+
+       return __ircomm_close(self);
 }
 
 EXPORT_SYMBOL(ircomm_close);
@@ -206,9 +206,9 @@ EXPORT_SYMBOL(ircomm_close);
  *
  *    Impl. of this function is differ from one of the reference. This
  *    function does discovery as well as sending connect request
- * 
+ *
  */
-int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel, 
+int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel,
                           __u32 saddr, __u32 daddr, struct sk_buff *skb,
                           __u8 service_type)
 {
@@ -243,20 +243,20 @@ void ircomm_connect_indication(struct ircomm_cb *self, struct sk_buff *skb,
                               struct ircomm_info *info)
 {
        int clen = 0;
-       
+
        IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
 
        /* Check if the packet contains data on the control channel */
        if (skb->len > 0)
                clen = skb->data[0];
-       
-       /* 
-        * If there are any data hiding in the control channel, we must 
-        * deliver it first. The side effect is that the control channel 
+
+       /*
+        * If there are any data hiding in the control channel, we must
+        * deliver it first. The side effect is that the control channel
         * will be removed from the skb
         */
        if (self->notify.connect_indication)
-               self->notify.connect_indication(self->notify.instance, self, 
+               self->notify.connect_indication(self->notify.instance, self,
                                                info->qos, info->max_data_size,
                                                info->max_header_size, skb);
        else {
@@ -282,7 +282,7 @@ int ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata)
        ret = ircomm_do_event(self, IRCOMM_CONNECT_RESPONSE, userdata, NULL);
 
        return ret;
-}      
+}
 
 EXPORT_SYMBOL(ircomm_connect_response);
 
@@ -299,7 +299,7 @@ void ircomm_connect_confirm(struct ircomm_cb *self, struct sk_buff *skb,
 
        if (self->notify.connect_confirm )
                self->notify.connect_confirm(self->notify.instance,
-                                            self, info->qos, 
+                                            self, info->qos,
                                             info->max_data_size,
                                             info->max_header_size, skb);
        else {
@@ -322,7 +322,7 @@ int ircomm_data_request(struct ircomm_cb *self, struct sk_buff *skb)
        IRDA_ASSERT(self != NULL, return -EFAULT;);
        IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;);
        IRDA_ASSERT(skb != NULL, return -EFAULT;);
-       
+
        ret = ircomm_do_event(self, IRCOMM_DATA_REQUEST, skb, NULL);
 
        return ret;
@@ -337,7 +337,7 @@ EXPORT_SYMBOL(ircomm_data_request);
  *
  */
 void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb)
-{      
+{
        IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
 
        IRDA_ASSERT(skb->len > 0, return;);
@@ -363,9 +363,9 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb)
 
        clen = skb->data[0];
 
-       /* 
-        * If there are any data hiding in the control channel, we must 
-        * deliver it first. The side effect is that the control channel 
+       /*
+        * If there are any data hiding in the control channel, we must
+        * deliver it first. The side effect is that the control channel
         * will be removed from the skb
         */
        if (clen > 0)
@@ -375,7 +375,7 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb)
        skb_pull(skb, clen+1);
 
        if (skb->len)
-               ircomm_data_indication(self, skb);              
+               ircomm_data_indication(self, skb);
        else {
                IRDA_DEBUG(4, "%s(), data was control info only!\n",
                           __FUNCTION__ );
@@ -391,13 +391,13 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb)
 int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb)
 {
        int ret;
-       
+
        IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
 
        IRDA_ASSERT(self != NULL, return -EFAULT;);
        IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;);
        IRDA_ASSERT(skb != NULL, return -EFAULT;);
-       
+
        ret = ircomm_do_event(self, IRCOMM_CONTROL_REQUEST, skb, NULL);
 
        return ret;
@@ -411,10 +411,10 @@ EXPORT_SYMBOL(ircomm_control_request);
  *    Data has arrived on the control channel
  *
  */
-static void ircomm_control_indication(struct ircomm_cb *self, 
+static void ircomm_control_indication(struct ircomm_cb *self,
                                      struct sk_buff *skb, int clen)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 
+       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
 
        /* Use udata for delivering data on the control channel */
        if (self->notify.udata_indication) {
@@ -427,8 +427,8 @@ static void ircomm_control_indication(struct ircomm_cb *self,
 
                /* Remove data channel from control channel */
                skb_trim(ctrl_skb, clen+1);
-       
-               self->notify.udata_indication(self->notify.instance, self, 
+
+               self->notify.udata_indication(self->notify.instance, self,
                                              ctrl_skb);
 
                /* Drop reference count -
@@ -455,7 +455,7 @@ int ircomm_disconnect_request(struct ircomm_cb *self, struct sk_buff *userdata)
        IRDA_ASSERT(self != NULL, return -1;);
        IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;);
 
-       ret = ircomm_do_event(self, IRCOMM_DISCONNECT_REQUEST, userdata, 
+       ret = ircomm_do_event(self, IRCOMM_DISCONNECT_REQUEST, userdata,
                              &info);
        return ret;
 }
@@ -472,7 +472,7 @@ void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb,
                                  struct ircomm_info *info)
 {
        IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
-       
+
        IRDA_ASSERT(info != NULL, return;);
 
        if (self->notify.disconnect_indication) {
@@ -486,7 +486,7 @@ void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb,
 /*
  * Function ircomm_flow_request (self, flow)
  *
- *    
+ *
  *
  */
 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)
             self = (struct ircomm_cb *) hashbin_get_next(ircomm)) {
                if (off++ == *pos)
                        break;
-               
+
        }
        return self;
 }
@@ -535,7 +535,7 @@ static void ircomm_seq_stop(struct seq_file *seq, void *v)
 }
 
 static int ircomm_seq_show(struct seq_file *seq, void *v)
-{      
+{
        const struct ircomm_cb *self = v;
 
        IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EINVAL; );
@@ -548,7 +548,7 @@ static int ircomm_seq_show(struct seq_file *seq, void *v)
        seq_printf(seq,
                   " state: %s, slsap_sel: %#02x, dlsap_sel: %#02x, mode:",
                   ircomm_state[ self->state],
-                  self->slsap_sel, self->dlsap_sel); 
+                  self->slsap_sel, self->dlsap_sel);
 
        if(self->service_type & IRCOMM_3_WIRE_RAW)
                seq_printf(seq, " 3-wire-raw");