Skip to content

Commit d0f172b

Browse files
Johan Hedbergholtmann
authored andcommitted
Bluetooth: Add helper to get HCI channel of a socket
We'll need to have access to which HCI channel a socket is bound to, in order to manage pending mgmt commands in clean way. This patch adds a helper for the purpose. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 49c989a commit d0f172b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

include/net/bluetooth/bluetooth.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ int bt_to_errno(__u16 code);
338338
void hci_sock_set_flag(struct sock *sk, int nr);
339339
void hci_sock_clear_flag(struct sock *sk, int nr);
340340
int hci_sock_test_flag(struct sock *sk, int nr);
341+
unsigned short hci_sock_get_channel(struct sock *sk);
341342

342343
int hci_sock_init(void);
343344
void hci_sock_cleanup(void);

net/bluetooth/hci_sock.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ int hci_sock_test_flag(struct sock *sk, int nr)
6565
return test_bit(nr, &hci_pi(sk)->flags);
6666
}
6767

68+
unsigned short hci_sock_get_channel(struct sock *sk)
69+
{
70+
return hci_pi(sk)->channel;
71+
}
72+
6873
static inline int hci_test_bit(int nr, const void *addr)
6974
{
7075
return *((const __u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31));

0 commit comments

Comments
 (0)