diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2015-03-14 22:28:00 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2015-03-15 03:57:31 -0400 |
commit | c85be545ea23a4fe590c89683242a9be823394e0 (patch) | |
tree | 3807191476a15efd18b7d6b4468fc0eed770ab47 /net/bluetooth/hci_sock.c | |
parent | c08b1a1dba524c1cdef331c1f169db3a1b37bb4c (diff) |
Bluetooth: Add hci_sock_test_flag helper function
The management interface will need access to the socket flags and so
provide a helper function for checking them.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_sock.c')
-rw-r--r-- | net/bluetooth/hci_sock.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index e7f463f6fd69..df23c184c897 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -60,6 +60,11 @@ void hci_sock_clear_flag(struct sock *sk, int nr) | |||
60 | clear_bit(nr, &hci_pi(sk)->flags); | 60 | clear_bit(nr, &hci_pi(sk)->flags); |
61 | } | 61 | } |
62 | 62 | ||
63 | int hci_sock_test_flag(struct sock *sk, int nr) | ||
64 | { | ||
65 | return test_bit(nr, &hci_pi(sk)->flags); | ||
66 | } | ||
67 | |||
63 | static inline int hci_test_bit(int nr, const void *addr) | 68 | static inline int hci_test_bit(int nr, const void *addr) |
64 | { | 69 | { |
65 | return *((const __u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31)); | 70 | return *((const __u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31)); |
@@ -211,7 +216,7 @@ void hci_send_to_channel(unsigned short channel, struct sk_buff *skb, | |||
211 | struct sk_buff *nskb; | 216 | struct sk_buff *nskb; |
212 | 217 | ||
213 | /* Ignore socket without the flag set */ | 218 | /* Ignore socket without the flag set */ |
214 | if (!test_bit(flag, &hci_pi(sk)->flags)) | 219 | if (!hci_sock_test_flag(sk, flag)) |
215 | continue; | 220 | continue; |
216 | 221 | ||
217 | /* Skip the original socket */ | 222 | /* Skip the original socket */ |