diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-01 18:02:01 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-01 18:02:01 -0400 |
commit | e3ee3b78f83688a0ae4315e8be71b2eac559904a (patch) | |
tree | deb03bcdd020262af450ed23382d7c921263f5cf /net/bluetooth/hci_sock.c | |
parent | 91cb70c1769d9b72dd1efe40c31f01005820b09e (diff) | |
parent | 6b39374a27eb4be7e9d82145ae270ba02ea90dc8 (diff) |
/spare/repo/netdev-2.6 branch 'master'
Diffstat (limited to 'net/bluetooth/hci_sock.c')
-rw-r--r-- | net/bluetooth/hci_sock.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index ebdcce5e7ca0..32ef7975a139 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -110,11 +110,11 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb) | |||
110 | /* Apply filter */ | 110 | /* Apply filter */ |
111 | flt = &hci_pi(sk)->filter; | 111 | flt = &hci_pi(sk)->filter; |
112 | 112 | ||
113 | if (!test_bit((skb->pkt_type == HCI_VENDOR_PKT) ? | 113 | if (!test_bit((bt_cb(skb)->pkt_type == HCI_VENDOR_PKT) ? |
114 | 0 : (skb->pkt_type & HCI_FLT_TYPE_BITS), &flt->type_mask)) | 114 | 0 : (bt_cb(skb)->pkt_type & HCI_FLT_TYPE_BITS), &flt->type_mask)) |
115 | continue; | 115 | continue; |
116 | 116 | ||
117 | if (skb->pkt_type == HCI_EVENT_PKT) { | 117 | if (bt_cb(skb)->pkt_type == HCI_EVENT_PKT) { |
118 | register int evt = (*(__u8 *)skb->data & HCI_FLT_EVENT_BITS); | 118 | register int evt = (*(__u8 *)skb->data & HCI_FLT_EVENT_BITS); |
119 | 119 | ||
120 | if (!hci_test_bit(evt, &flt->event_mask)) | 120 | if (!hci_test_bit(evt, &flt->event_mask)) |
@@ -131,7 +131,7 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb) | |||
131 | continue; | 131 | continue; |
132 | 132 | ||
133 | /* Put type byte before the data */ | 133 | /* Put type byte before the data */ |
134 | memcpy(skb_push(nskb, 1), &nskb->pkt_type, 1); | 134 | memcpy(skb_push(nskb, 1), &bt_cb(nskb)->pkt_type, 1); |
135 | 135 | ||
136 | if (sock_queue_rcv_skb(sk, nskb)) | 136 | if (sock_queue_rcv_skb(sk, nskb)) |
137 | kfree_skb(nskb); | 137 | kfree_skb(nskb); |
@@ -327,11 +327,17 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ | |||
327 | { | 327 | { |
328 | __u32 mask = hci_pi(sk)->cmsg_mask; | 328 | __u32 mask = hci_pi(sk)->cmsg_mask; |
329 | 329 | ||
330 | if (mask & HCI_CMSG_DIR) | 330 | if (mask & HCI_CMSG_DIR) { |
331 | put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(int), &bt_cb(skb)->incoming); | 331 | int incoming = bt_cb(skb)->incoming; |
332 | put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(incoming), &incoming); | ||
333 | } | ||
334 | |||
335 | if (mask & HCI_CMSG_TSTAMP) { | ||
336 | struct timeval tv; | ||
332 | 337 | ||
333 | if (mask & HCI_CMSG_TSTAMP) | 338 | skb_get_timestamp(skb, &tv); |
334 | put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp); | 339 | put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(tv), &tv); |
340 | } | ||
335 | } | 341 | } |
336 | 342 | ||
337 | static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | 343 | static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, |
@@ -405,11 +411,11 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
405 | goto drop; | 411 | goto drop; |
406 | } | 412 | } |
407 | 413 | ||
408 | skb->pkt_type = *((unsigned char *) skb->data); | 414 | bt_cb(skb)->pkt_type = *((unsigned char *) skb->data); |
409 | skb_pull(skb, 1); | 415 | skb_pull(skb, 1); |
410 | skb->dev = (void *) hdev; | 416 | skb->dev = (void *) hdev; |
411 | 417 | ||
412 | if (skb->pkt_type == HCI_COMMAND_PKT) { | 418 | if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) { |
413 | u16 opcode = __le16_to_cpu(get_unaligned((u16 *)skb->data)); | 419 | u16 opcode = __le16_to_cpu(get_unaligned((u16 *)skb->data)); |
414 | u16 ogf = hci_opcode_ogf(opcode); | 420 | u16 ogf = hci_opcode_ogf(opcode); |
415 | u16 ocf = hci_opcode_ocf(opcode); | 421 | u16 ocf = hci_opcode_ocf(opcode); |