summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Marcheselli <christianm@valvesoftware.com>2023-03-31 15:21:25 -0700
committerPierre-Loup A. Griffais <pgriffais@valvesoftware.com>2023-11-02 16:05:16 -0700
commit794bdbd6bad2765476d5d42aa7da4654917e9e40 (patch)
tree85bf7ea24a661990924abc730acb0f49743217f2
parent3cb918f3db546146a4ef8f9c85c5bc2e44a70786 (diff)
downloadlinux-794bdbd6bad2765476d5d42aa7da4654917e9e40.tar.gz
Added in Quectel patches for bluetooth
-rw-r--r--include/net/bluetooth/hci.h1
-rw-r--r--include/net/bluetooth/hci_core.h2
-rw-r--r--net/bluetooth/hci_core.c10
-rw-r--r--net/bluetooth/mgmt.c4
4 files changed, 9 insertions, 8 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index a674221d151d..9d5064e852ed 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -415,6 +415,7 @@ enum {
 #define HCI_CMD_TIMEOUT		msecs_to_jiffies(2000)	/* 2 seconds */
 #define HCI_NCMD_TIMEOUT	msecs_to_jiffies(4000)	/* 4 seconds */
 #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
+#define HCI_AUTO_ON_TIMEOUT	msecs_to_jiffies(200)	/* 0.2 seconds */
 #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
 #define HCI_POWER_OFF_TIMEOUT	msecs_to_jiffies(5000)	/* 5 seconds */
 #define HCI_LE_CONN_TIMEOUT	msecs_to_jiffies(20000)	/* 20 seconds */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index ddbcbf9ccb2c..a2cfa7c1cad1 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -507,7 +507,7 @@ struct hci_dev {
 	struct workqueue_struct	*workqueue;
 	struct workqueue_struct	*req_workqueue;
 
-	struct work_struct	power_on;
+	struct delayed_work	power_on;
 	struct delayed_work	power_off;
 	struct work_struct	error_reset;
 	struct work_struct	cmd_sync_work;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index d034bf2a999e..dbf36e343a9a 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -572,7 +572,7 @@ int hci_dev_close(__u16 dev)
 		goto done;
 	}
 
-	cancel_work_sync(&hdev->power_on);
+	cancel_delayed_work(&hdev->power_on);
 	if (hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF))
 		cancel_delayed_work(&hdev->power_off);
 
@@ -967,7 +967,7 @@ static const struct rfkill_ops hci_rfkill_ops = {
 
 static void hci_power_on(struct work_struct *work)
 {
-	struct hci_dev *hdev = container_of(work, struct hci_dev, power_on);
+	struct hci_dev *hdev = container_of(work, struct hci_dev, power_on.work);
 	int err;
 
 	BT_DBG("%s", hdev->name);
@@ -2554,7 +2554,7 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv)
 	INIT_WORK(&hdev->rx_work, hci_rx_work);
 	INIT_WORK(&hdev->cmd_work, hci_cmd_work);
 	INIT_WORK(&hdev->tx_work, hci_tx_work);
-	INIT_WORK(&hdev->power_on, hci_power_on);
+	INIT_DELAYED_WORK(&hdev->power_on, hci_power_on);
 	INIT_WORK(&hdev->error_reset, hci_error_reset);
 
 	hci_cmd_sync_init(hdev);
@@ -2688,7 +2688,7 @@ int hci_register_dev(struct hci_dev *hdev)
 	if (error)
 		BT_WARN("register suspend notifier failed error:%d\n", error);
 
-	queue_work(hdev->req_workqueue, &hdev->power_on);
+	queue_delayed_work(hdev->req_workqueue, &hdev->power_on,HCI_AUTO_ON_TIMEOUT);
 
 	idr_init(&hdev->adv_monitors_idr);
 	msft_register(hdev);
@@ -2719,7 +2719,7 @@ void hci_unregister_dev(struct hci_dev *hdev)
 	list_del(&hdev->list);
 	write_unlock(&hci_dev_list_lock);
 
-	cancel_work_sync(&hdev->power_on);
+	cancel_delayed_work(&hdev->power_on);
 
 	hci_cmd_sync_clear(hdev);
 
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index d2e8565d0b33..8ffc53088f27 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -7993,7 +7993,7 @@ static int set_external_config(struct sock *sk, struct hci_dev *hdev,
 			hci_dev_set_flag(hdev, HCI_CONFIG);
 			hci_dev_set_flag(hdev, HCI_AUTO_OFF);
 
-			queue_work(hdev->req_workqueue, &hdev->power_on);
+			queue_work(hdev->req_workqueue, &hdev->power_on.work);
 		} else {
 			set_bit(HCI_RAW, &hdev->flags);
 			mgmt_index_added(hdev);
@@ -8049,7 +8049,7 @@ static int set_public_address(struct sock *sk, struct hci_dev *hdev,
 		hci_dev_set_flag(hdev, HCI_CONFIG);
 		hci_dev_set_flag(hdev, HCI_AUTO_OFF);
 
-		queue_work(hdev->req_workqueue, &hdev->power_on);
+		queue_work(hdev->req_workqueue, &hdev->power_on.work);
 	}
 
 unlock: