Skip to content

Commit 416dc94

Browse files
author
Gustavo F. Padovan
committed
Bluetooth: make hci_conn_enter_sniff_mode static
It isn't used outside hci_conn.c Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
1 parent 3e9c40a commit 416dc94

2 files changed

Lines changed: 36 additions & 37 deletions

File tree

‎include/net/bluetooth/hci_core.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,6 @@ int hci_conn_change_link_key(struct hci_conn *conn);
509509
int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
510510

511511
void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active);
512-
void hci_conn_enter_sniff_mode(struct hci_conn *conn);
513512

514513
void hci_conn_hold_device(struct hci_conn *conn);
515514
void hci_conn_put_device(struct hci_conn *conn);

‎net/bluetooth/hci_conn.c‎

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,42 @@ static void hci_conn_timeout(unsigned long arg)
311311
hci_dev_unlock(hdev);
312312
}
313313

314+
/* Enter sniff mode */
315+
static void hci_conn_enter_sniff_mode(struct hci_conn *conn)
316+
{
317+
struct hci_dev *hdev = conn->hdev;
318+
319+
BT_DBG("conn %p mode %d", conn, conn->mode);
320+
321+
if (test_bit(HCI_RAW, &hdev->flags))
322+
return;
323+
324+
if (!lmp_sniff_capable(hdev) || !lmp_sniff_capable(conn))
325+
return;
326+
327+
if (conn->mode != HCI_CM_ACTIVE || !(conn->link_policy & HCI_LP_SNIFF))
328+
return;
329+
330+
if (lmp_sniffsubr_capable(hdev) && lmp_sniffsubr_capable(conn)) {
331+
struct hci_cp_sniff_subrate cp;
332+
cp.handle = cpu_to_le16(conn->handle);
333+
cp.max_latency = cpu_to_le16(0);
334+
cp.min_remote_timeout = cpu_to_le16(0);
335+
cp.min_local_timeout = cpu_to_le16(0);
336+
hci_send_cmd(hdev, HCI_OP_SNIFF_SUBRATE, sizeof(cp), &cp);
337+
}
338+
339+
if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) {
340+
struct hci_cp_sniff_mode cp;
341+
cp.handle = cpu_to_le16(conn->handle);
342+
cp.max_interval = cpu_to_le16(hdev->sniff_max_interval);
343+
cp.min_interval = cpu_to_le16(hdev->sniff_min_interval);
344+
cp.attempt = cpu_to_le16(4);
345+
cp.timeout = cpu_to_le16(1);
346+
hci_send_cmd(hdev, HCI_OP_SNIFF_MODE, sizeof(cp), &cp);
347+
}
348+
}
349+
314350
static void hci_conn_idle(unsigned long arg)
315351
{
316352
struct hci_conn *conn = (void *) arg;
@@ -767,42 +803,6 @@ void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active)
767803
jiffies + msecs_to_jiffies(hdev->idle_timeout));
768804
}
769805

770-
/* Enter sniff mode */
771-
void hci_conn_enter_sniff_mode(struct hci_conn *conn)
772-
{
773-
struct hci_dev *hdev = conn->hdev;
774-
775-
BT_DBG("conn %p mode %d", conn, conn->mode);
776-
777-
if (test_bit(HCI_RAW, &hdev->flags))
778-
return;
779-
780-
if (!lmp_sniff_capable(hdev) || !lmp_sniff_capable(conn))
781-
return;
782-
783-
if (conn->mode != HCI_CM_ACTIVE || !(conn->link_policy & HCI_LP_SNIFF))
784-
return;
785-
786-
if (lmp_sniffsubr_capable(hdev) && lmp_sniffsubr_capable(conn)) {
787-
struct hci_cp_sniff_subrate cp;
788-
cp.handle = cpu_to_le16(conn->handle);
789-
cp.max_latency = cpu_to_le16(0);
790-
cp.min_remote_timeout = cpu_to_le16(0);
791-
cp.min_local_timeout = cpu_to_le16(0);
792-
hci_send_cmd(hdev, HCI_OP_SNIFF_SUBRATE, sizeof(cp), &cp);
793-
}
794-
795-
if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) {
796-
struct hci_cp_sniff_mode cp;
797-
cp.handle = cpu_to_le16(conn->handle);
798-
cp.max_interval = cpu_to_le16(hdev->sniff_max_interval);
799-
cp.min_interval = cpu_to_le16(hdev->sniff_min_interval);
800-
cp.attempt = cpu_to_le16(4);
801-
cp.timeout = cpu_to_le16(1);
802-
hci_send_cmd(hdev, HCI_OP_SNIFF_MODE, sizeof(cp), &cp);
803-
}
804-
}
805-
806806
/* Drop all connection on the device */
807807
void hci_conn_hash_flush(struct hci_dev *hdev)
808808
{

0 commit comments

Comments
 (0)