[Bluetooth] Add open and close callbacks for HID device
[pandora-kernel.git] / net / decnet / dn_nsp_in.c
index 7683d4f..9d20904 100644 (file)
@@ -33,7 +33,7 @@
 
 /******************************************************************************
     (c) 1995-1998 E.M. Serrat          emserrat@geocities.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 the License, or
@@ -50,7 +50,6 @@
 #include <linux/socket.h>
 #include <linux/in.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/timer.h>
 #include <linux/string.h>
 #include <linux/sockios.h>
@@ -63,7 +62,7 @@
 #include <asm/system.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
-#include <linux/termios.h>      
+#include <linux/termios.h>
 #include <linux/interrupt.h>
 #include <linux/proc_fs.h>
 #include <linux/stat.h>
@@ -139,7 +138,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth)
                ptr++;
                len += 2;
                if ((ack & 0x4000) == 0) {
-                       if (oth) 
+                       if (oth)
                                ack ^= 0x2000;
                        dn_ack(sk, skb, ack);
                }
@@ -152,7 +151,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth)
                skb_pull(skb, 2);
                len += 2;
                if ((ack & 0x4000) == 0) {
-                       if (oth) 
+                       if (oth)
                                ack ^= 0x2000;
                        dn_ack(sk, skb, ack);
                }
@@ -349,9 +348,9 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb)
 
        if ((scp->state == DN_CI) || (scp->state == DN_CD)) {
                scp->persist = 0;
-                scp->addrrem = cb->src_port;
-                sk->sk_state = TCP_ESTABLISHED;
-                scp->state = DN_RUN;
+               scp->addrrem = cb->src_port;
+               sk->sk_state = TCP_ESTABLISHED;
+               scp->state = DN_RUN;
                scp->services_rem = cb->services;
                scp->info_rem = cb->info;
                scp->segsize_rem = cb->segsize;
@@ -366,13 +365,13 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb)
                                memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen);
                        }
                }
-                dn_nsp_send_link(sk, DN_NOCHANGE, 0);
-                if (!sock_flag(sk, SOCK_DEAD))
-                       sk->sk_state_change(sk);
-        }
+               dn_nsp_send_link(sk, DN_NOCHANGE, 0);
+               if (!sock_flag(sk, SOCK_DEAD))
+                       sk->sk_state_change(sk);
+       }
 
 out:
-        kfree_skb(skb);
+       kfree_skb(skb);
 }
 
 static void dn_nsp_conn_ack(struct sock *sk, struct sk_buff *skb)
@@ -435,7 +434,7 @@ static void dn_nsp_disc_init(struct sock *sk, struct sk_buff *skb)
                sk->sk_state_change(sk);
        }
 
-       /* 
+       /*
         * It appears that its possible for remote machines to send disc
         * init messages with no port identifier if we are in the CI and
         * possibly also the CD state. Obviously we shouldn't reply with
@@ -519,7 +518,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
 
        /*
         * Here we ignore erronous packets which should really
-        * should cause a connection abort. It is not critical 
+        * should cause a connection abort. It is not critical
         * for now though.
         */
        if (lsflags & 0xf8)
@@ -530,7 +529,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
                switch(lsflags & 0x04) { /* FCVAL INT */
                case 0x00: /* Normal Request */
                        switch(lsflags & 0x03) { /* FCVAL MOD */
-                               case 0x00: /* Request count */
+                       case 0x00: /* Request count */
                                if (fcval < 0) {
                                        unsigned char p_fcval = -fcval;
                                        if ((scp->flowrem_dat > p_fcval) &&
@@ -541,7 +540,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
                                        scp->flowrem_dat += fcval;
                                        wake_up = 1;
                                }
-                                       break;
+                               break;
                        case 0x01: /* Stop outgoing data */
                                scp->flowrem_sw = DN_DONTSEND;
                                break;
@@ -557,10 +556,10 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb)
                                wake_up = 1;
                        }
                        break;
-                }
+               }
                if (wake_up && !sock_flag(sk, SOCK_DEAD))
                        sk->sk_state_change(sk);
-        }
+       }
 
        dn_nsp_send_oth_ack(sk);
 
@@ -576,38 +575,38 @@ out:
 static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue)
 {
        int err;
-       
-        /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
-           number of warnings when compiling with -W --ANK
-         */
-        if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
+
+       /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
+          number of warnings when compiling with -W --ANK
+        */
+       if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
            (unsigned)sk->sk_rcvbuf) {
-               err = -ENOMEM;
-               goto out;
-        }
+               err = -ENOMEM;
+               goto out;
+       }
 
        err = sk_filter(sk, skb);
        if (err)
                goto out;
 
-        skb_set_owner_r(skb, sk);
-        skb_queue_tail(queue, skb);
+       skb_set_owner_r(skb, sk);
+       skb_queue_tail(queue, skb);
 
        /* This code only runs from BH or BH protected context.
         * Therefore the plain read_lock is ok here. -DaveM
         */
        read_lock(&sk->sk_callback_lock);
-        if (!sock_flag(sk, SOCK_DEAD)) {
+       if (!sock_flag(sk, SOCK_DEAD)) {
                struct socket *sock = sk->sk_socket;
                wake_up_interruptible(sk->sk_sleep);
                if (sock && sock->fasync_list &&
                    !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
-                       __kill_fasync(sock->fasync_list, sig, 
+                       __kill_fasync(sock->fasync_list, sig,
                                    (sig == SIGURG) ? POLL_PRI : POLL_IN);
        }
        read_unlock(&sk->sk_callback_lock);
 out:
-        return err;
+       return err;
 }
 
 static void dn_nsp_otherdata(struct sock *sk, struct sk_buff *skb)
@@ -652,16 +651,16 @@ static void dn_nsp_data(struct sock *sk, struct sk_buff *skb)
        skb_pull(skb, 2);
 
        if (seq_next(scp->numdat_rcv, segnum)) {
-                if (dn_queue_skb(sk, skb, SIGIO, &sk->sk_receive_queue) == 0) {
+               if (dn_queue_skb(sk, skb, SIGIO, &sk->sk_receive_queue) == 0) {
                        seq_add(&scp->numdat_rcv, 1);
-                       queued = 1;
-                }
+                       queued = 1;
+               }
 
                if ((scp->flowloc_sw == DN_SEND) && dn_congested(sk)) {
                        scp->flowloc_sw = DN_DONTSEND;
                        dn_nsp_send_link(sk, DN_DONTSEND, 0);
                }
-        }
+       }
 
        dn_nsp_send_data_ack(sk);
 out:
@@ -732,7 +731,7 @@ static int dn_nsp_rx_packet(struct sk_buff *skb)
        if (decnet_debug_level & 2)
                printk(KERN_DEBUG "dn_nsp_rx: Message type 0x%02x\n", (int)cb->nsp_flags);
 
-       if (cb->nsp_flags & 0x83) 
+       if (cb->nsp_flags & 0x83)
                goto free_out;
 
        /*
@@ -804,7 +803,7 @@ got_it:
                                goto free_out;
                }
 
-               return sk_receive_skb(sk, skb);
+               return sk_receive_skb(sk, skb, 0);
        }
 
        return dn_nsp_no_socket(skb, reason);
@@ -852,7 +851,7 @@ int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb)
                        case 0x30:
                                dn_nsp_disc_init(sk, skb);
                                break;
-                       case 0x40:      
+                       case 0x40:
                                dn_nsp_disc_conf(sk, skb);
                                break;
                }