Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluet...
[pandora-kernel.git] / net / bluetooth / bnep / core.c
index ab2db55..021172c 100644 (file)
@@ -2,7 +2,7 @@
    BNEP implementation for Linux Bluetooth stack (BlueZ).
    Copyright (C) 2001-2002 Inventel Systemes
    Written 2001-2002 by
-       Clément Moreau <clement.moreau@inventel.fr>
+       Clément Moreau <clement.moreau@inventel.fr>
        David Libault  <david.libault@inventel.fr>
 
    Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * $Id: core.c,v 1.20 2002/08/04 21:23:58 maxk Exp $
- */
-
 #include <linux/module.h>
 
 #include <linux/kernel.h>
@@ -36,8 +32,8 @@
 #include <linux/signal.h>
 #include <linux/init.h>
 #include <linux/wait.h>
+#include <linux/freezer.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <linux/net.h>
 #include <net/sock.h>
 
@@ -135,7 +131,7 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len
        if (len < 2)
                return -EILSEQ;
 
-       n = ntohs(get_unaligned(data));
+       n = get_unaligned_be16(data);
        data++; len -= 2;
 
        if (len < n)
@@ -150,8 +146,8 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len
                int i;
 
                for (i = 0; i < n; i++) {
-                       f[i].start = ntohs(get_unaligned(data++));
-                       f[i].end   = ntohs(get_unaligned(data++));
+                       f[i].start = get_unaligned_be16(data++);
+                       f[i].end   = get_unaligned_be16(data++);
 
                        BT_DBG("proto filter start %d end %d",
                                f[i].start, f[i].end);
@@ -180,7 +176,7 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
        if (len < 2)
                return -EILSEQ;
 
-       n = ntohs(get_unaligned((__be16 *) data));
+       n = get_unaligned_be16(data);
        data += 2; len -= 2;
 
        if (len < n)
@@ -475,7 +471,6 @@ static int bnep_session(void *arg)
 
        daemonize("kbnepd %s", dev->name);
        set_user_nice(current, -15);
-       current->flags |= PF_NOFREEZE;
 
        init_waitqueue_entry(&wait, current);
        add_wait_queue(sk->sk_sleep, &wait);
@@ -508,6 +503,11 @@ static int bnep_session(void *arg)
        /* Delete network device */
        unregister_netdev(dev);
 
+       /* Wakeup user-space polling for socket errors */
+       s->sock->sk->sk_err = EUNATCH;
+
+       wake_up_interruptible(s->sock->sk->sk_sleep);
+
        /* Release the socket */
        fput(s->sock->file);