From: Johan Hedberg <johan.hedberg@intel.com>
Date: Wed, 9 Nov 2011 11:58:57 +0000 (+0200)
Subject: Bluetooth: Remove redundant hci_dev comparisons in mgmt lookups
X-Git-Tag: firefly_0821_release~3680^2~3834^2~44^2~536^2
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2aeabcbedd51aef94b61d05b57246d1db4984453;p=firefly-linux-kernel-4.4.55.git

Bluetooth: Remove redundant hci_dev comparisons in mgmt lookups

Now that pending commands are hci_dev specific there's no need to check
whether a command matches hci_dev when iterating through them.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
---

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index a849428ffbcb..a6720c6a4d2c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -268,9 +268,6 @@ static void mgmt_pending_foreach(u16 opcode, struct hci_dev *hdev,
 		if (opcode > 0 && cmd->opcode != opcode)
 			continue;
 
-		if (hdev && cmd->index != hdev->id)
-			continue;
-
 		cb(cmd, data);
 	}
 }
@@ -280,13 +277,8 @@ static struct pending_cmd *mgmt_pending_find(u16 opcode, struct hci_dev *hdev)
 	struct pending_cmd *cmd;
 
 	list_for_each_entry(cmd, &hdev->mgmt_pending, list) {
-		if (cmd->opcode != opcode)
-			continue;
-
-		if (hdev && cmd->index != hdev->id)
-			continue;
-
-		return cmd;
+		if (cmd->opcode == opcode)
+			return cmd;
 	}
 
 	return NULL;
@@ -1300,9 +1292,6 @@ static inline struct pending_cmd *find_pairing(struct hci_conn *conn)
 		if (cmd->opcode != MGMT_OP_PAIR_DEVICE)
 			continue;
 
-		if (cmd->index != hdev->id)
-			continue;
-
 		if (cmd->user_data != conn)
 			continue;