Linux bluetooth development
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 11/13] Bluetooth: Add hdev helper variable to hci_le_create_connection_cancel
Date: Wed, 21 Oct 2015 18:03:09 +0300	[thread overview]
Message-ID: <1445439791-2151-12-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1445439791-2151-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

The hci_le_create_connection_cancel() function needs to use the hdev
pointer in many places so add a variable for it to avoid the need to
dereference the hci_conn every time.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/hci_conn.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index c562d5d5b14e..77b2bf9e808e 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -63,6 +63,7 @@ static const struct sco_param esco_param_msbc[] = {
 static void hci_connect_le_scan_cleanup(struct hci_conn *conn)
 {
 	struct hci_conn_params *params;
+	struct hci_dev *hdev = conn->hdev;
 	struct smp_irk *irk;
 	bdaddr_t *bdaddr;
 	u8 bdaddr_type;
@@ -71,13 +72,13 @@ static void hci_connect_le_scan_cleanup(struct hci_conn *conn)
 	bdaddr_type = conn->dst_type;
 
 	/* Check if we need to convert to identity address */
-	irk = hci_get_irk(conn->hdev, bdaddr, bdaddr_type);
+	irk = hci_get_irk(hdev, bdaddr, bdaddr_type);
 	if (irk) {
 		bdaddr = &irk->bdaddr;
 		bdaddr_type = irk->addr_type;
 	}
 
-	params = hci_explicit_connect_lookup(conn->hdev, bdaddr, bdaddr_type);
+	params = hci_explicit_connect_lookup(hdev, bdaddr, bdaddr_type);
 	if (!params)
 		return;
 
@@ -92,21 +93,21 @@ static void hci_connect_le_scan_cleanup(struct hci_conn *conn)
 
 	switch (params->auto_connect) {
 	case HCI_AUTO_CONN_EXPLICIT:
-		hci_conn_params_del(conn->hdev, bdaddr, bdaddr_type);
+		hci_conn_params_del(hdev, bdaddr, bdaddr_type);
 		/* return instead of break to avoid duplicate scan update */
 		return;
 	case HCI_AUTO_CONN_DIRECT:
 	case HCI_AUTO_CONN_ALWAYS:
-		list_add(&params->action, &conn->hdev->pend_le_conns);
+		list_add(&params->action, &hdev->pend_le_conns);
 		break;
 	case HCI_AUTO_CONN_REPORT:
-		list_add(&params->action, &conn->hdev->pend_le_reports);
+		list_add(&params->action, &hdev->pend_le_reports);
 		break;
 	default:
 		break;
 	}
 
-	hci_update_background_scan(conn->hdev);
+	hci_update_background_scan(hdev);
 }
 
 static void hci_conn_cleanup(struct hci_conn *conn)
-- 
2.5.0


  parent reply	other threads:[~2015-10-21 15:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21 15:02 [PATCH 00/13] Bluetooth: Cleanups & fixes from the UPF Johan Hedberg
2015-10-21 15:02 ` [PATCH 01/13] Bluetooth: Add le_addr_type() helper function Johan Hedberg
2015-10-21 15:03 ` [PATCH 02/13] Bluetooth: Add hci_conn_hash_lookup_le() " Johan Hedberg
2015-10-21 15:03 ` [PATCH 03/13] Bluetooth: Use hci_conn_hash_lookup_le() when possible Johan Hedberg
2015-10-21 15:03 ` [PATCH 04/13] Bluetooth: 6lowpan: " Johan Hedberg
2015-10-21 15:03 ` [PATCH 05/13] Bluetooth: Remove unnecessary indentation in unpair_device() Johan Hedberg
2015-10-21 15:03 ` [PATCH 06/13] Bluetooth: Disable auto-connection parameters when unpairing Johan Hedberg
2015-10-21 15:03 ` [PATCH 07/13] Bluetooth: Introduce hci_req helper to abort a connection Johan Hedberg
2015-10-21 15:03 ` [PATCH 08/13] Bluetooth: Take advantage of connection abort helpers Johan Hedberg
2015-10-21 15:03 ` [PATCH 09/13] Bluetooth: Remove redundant (and possibly wrong) flag clearing Johan Hedberg
2015-10-21 15:03 ` [PATCH 10/13] Bluetooth: Make hci_disconnect() behave correctly for all states Johan Hedberg
2015-10-21 15:03 ` Johan Hedberg [this message]
2015-10-21 15:03 ` [PATCH 12/13] Bluetooth: Remove unnecessary hci_explicit_connect_lookup function Johan Hedberg
2015-10-21 15:03 ` [PATCH 13/13] Bluetooth: Fix crash in SMP when unpairing Johan Hedberg
2015-10-21 17:02 ` [PATCH 00/13] Bluetooth: Cleanups & fixes from the UPF Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445439791-2151-12-git-send-email-johan.hedberg@gmail.com \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox