Skip to contentSkip to conversation

Bluetooth: Remove unnecessary hci_dev_lock/unlock in smp.c

PATCH In review [email protected] 2 participants 2 messages Nov 12, 2014

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

PATCH 1/1 Bluetooth: Remove unnecessary hci_dev_lock/unlock in smp.c

From: Johan Hedberg <[email protected]>

The mgmt_user_passkey_request and related functions do not do anything else except read access to hdev->id. This member never changes after the hdev creation so there is no need to acquire a lock to read it.

---
 net/bluetooth/smp.c | 4 ----
 1 file changed, 4 deletions(-)
net/bluetooth/smp.c +0 -4
index 5fbe91178d35..138279a75583 100644
@@ -514,8 +514,6 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
 		set_bit(SMP_FLAG_TK_VALID, &smp->flags);
 	}
 
-	hci_dev_lock(hcon->hdev);
-
 	if (method == REQ_PASSKEY)
 		ret = mgmt_user_passkey_request(hcon->hdev, &hcon->dst,
 						hcon->type, hcon->dst_type);
@@ -528,8 +526,6 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
 						hcon->type, hcon->dst_type,
 						passkey, 0);
 
-	hci_dev_unlock(hcon->hdev);
-
 	return ret;
 }
 
Signature · 1 line
2.1.0
maintainer
#1 lore raw

Hi Johan,

Quoted 8 lines

The mgmt_user_passkey_request and related functions do not do anything else except read access to hdev->id. This member never changes after the hdev creation so there is no need to acquire a lock to read it.

---
net/bluetooth/smp.c | 4 ----

1 file changed, 4 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel