Skip to contentSkip to conversation

Bluetooth: Add clarifying comment why schedule_work is used

PATCH In review Johan Hedberg 2 participants 2 messages Nov 6, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Add clarifying comment why schedule_work is used

From: Johan Hedberg <[email protected]>

It's not obvious why schedule_work is used instead of queue_work. Add a comment explaining why.

---
 net/bluetooth/hci_conn.c | 4 ++++
 1 file changed, 4 insertions(+)
net/bluetooth/hci_conn.c +4 -0
index 85b82f7adbd2..fd6120a41138 100644
@@ -178,6 +178,10 @@ static void hci_connect_le_scan_remove(struct hci_conn *conn)
 	hci_dev_hold(conn->hdev);
 	hci_conn_get(conn);
 
+	/* Even though we hold a reference to the hdev, many other
+	 * things might get cleaned up meanwhile, including the hdev's
+	 * own workqueue, so we can't use that for scheduling.
+	 */
 	schedule_work(&conn->le_scan_cleanup);
 }
 
Signature · 1 line
2.5.0
maintainer
#1 lore raw

Hi Johan,

Quoted 7 lines

It's not obvious why schedule_work is used instead of queue_work. Add a comment explaining why.

---
net/bluetooth/hci_conn.c | 4 ++++

1 file changed, 4 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel