drivers/net/tulip/eeprom.c: fix bogus "(null)" in tulip init messages
[safe/jmp/linux-2.6] / net / bluetooth / hci_sock.c
index d62579b..38f08f6 100644 (file)
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci_core.h>
 
-#ifndef CONFIG_BT_HCI_SOCK_DEBUG
-#undef  BT_DBG
-#define BT_DBG(D...)
-#endif
-
 /* ----- HCI socket interface ----- */
 
 static inline int hci_test_bit(int nr, void *addr)
@@ -334,6 +329,9 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
        }
 
        if (mask & HCI_CMSG_TSTAMP) {
+#ifdef CONFIG_COMPAT
+               struct compat_timeval ctv;
+#endif
                struct timeval tv;
                void *data;
                int len;
@@ -344,7 +342,6 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
                len = sizeof(tv);
 #ifdef CONFIG_COMPAT
                if (msg->msg_flags & MSG_CMSG_COMPAT) {
-                       struct compat_timeval ctv;
                        ctv.tv_sec = tv.tv_sec;
                        ctv.tv_usec = tv.tv_usec;
                        data = &ctv;
@@ -419,6 +416,11 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
                goto done;
        }
 
+       if (!test_bit(HCI_UP, &hdev->flags)) {
+               err = -ENETDOWN;
+               goto done;
+       }
+
        if (!(skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err)))
                goto done;
 
@@ -445,10 +447,10 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
 
                if (test_bit(HCI_RAW, &hdev->flags) || (ogf == 0x3f)) {
                        skb_queue_tail(&hdev->raw_q, skb);
-                       hci_sched_tx(hdev);
+                       tasklet_schedule(&hdev->tx_task);
                } else {
                        skb_queue_tail(&hdev->cmd_q, skb);
-                       hci_sched_cmd(hdev);
+                       tasklet_schedule(&hdev->cmd_task);
                }
        } else {
                if (!capable(CAP_NET_RAW)) {
@@ -457,7 +459,7 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
                }
 
                skb_queue_tail(&hdev->raw_q, skb);
-               hci_sched_tx(hdev);
+               tasklet_schedule(&hdev->tx_task);
        }
 
        err = len;
@@ -471,7 +473,7 @@ drop:
        goto done;
 }
 
-static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int len)
+static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int len)
 {
        struct hci_ufilter uf = { .opcode = 0 };
        struct sock *sk = sock->sk;
@@ -626,7 +628,8 @@ static struct proto hci_sk_proto = {
        .obj_size       = sizeof(struct hci_pinfo)
 };
 
-static int hci_sock_create(struct net *net, struct socket *sock, int protocol)
+static int hci_sock_create(struct net *net, struct socket *sock, int protocol,
+                          int kern)
 {
        struct sock *sk;
 
@@ -692,7 +695,7 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
        return NOTIFY_DONE;
 }
 
-static struct net_proto_family hci_sock_family_ops = {
+static const struct net_proto_family hci_sock_family_ops = {
        .family = PF_BLUETOOTH,
        .owner  = THIS_MODULE,
        .create = hci_sock_create,