linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andre Guedes <aguedespe@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: andre.guedes@openbossa.org
Subject: [PATCH 3/3] Bluetooth: Use advertising cache thread-safe functions
Date: Tue,  7 Feb 2012 01:29:57 -0300	[thread overview]
Message-ID: <1328588997-25029-4-git-send-email-aguedespe@gmail.com> (raw)
In-Reply-To: <1328588997-25029-1-git-send-email-aguedespe@gmail.com>

This patch replaces some advertising cache unsafe function calls
by its thread-safe versions where applicable.

Signed-off-by: Andre Guedes <aguedespe@gmail.com>
---
 net/bluetooth/hci_core.c  |    6 +-----
 net/bluetooth/hci_event.c |    6 +-----
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 536248d..24b7621 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1532,11 +1532,7 @@ static void hci_clear_adv_cache(struct work_struct *work)
 	struct hci_dev *hdev = container_of(work, struct hci_dev,
 							adv_work.work);
 
-	hci_dev_lock(hdev);
-
-	__hci_adv_entries_clear(hdev);
-
-	hci_dev_unlock(hdev);
+	hci_adv_entries_clear(hdev);
 }
 
 /* Must be holding hdev->lock */
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 6808069..3933ccd 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3255,12 +3255,10 @@ static inline void hci_le_adv_report_evt(struct hci_dev *hdev,
 	void *ptr = &skb->data[1];
 	s8 rssi;
 
-	hci_dev_lock(hdev);
-
 	while (num_reports--) {
 		struct hci_ev_le_advertising_info *ev = ptr;
 
-		__hci_add_adv_entry(hdev, ev);
+		hci_add_adv_entry(hdev, ev);
 
 		rssi = ev->data[ev->length];
 		mgmt_device_found(hdev, &ev->bdaddr, LE_LINK, ev->bdaddr_type,
@@ -3268,8 +3266,6 @@ static inline void hci_le_adv_report_evt(struct hci_dev *hdev,
 
 		ptr += sizeof(*ev) + ev->length + 1;
 	}
-
-	hci_dev_unlock(hdev);
 }
 
 static inline void hci_le_ltk_request_evt(struct hci_dev *hdev,
-- 
1.7.9


  parent reply	other threads:[~2012-02-07  4:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07  4:29 [PATCH 0/3] Advertising cache locking code refactoring Andre Guedes
2012-02-07  4:29 ` [PATCH 1/3] Bluetooth: Add prefix "__" to advertising cache functions Andre Guedes
2012-02-07  4:29 ` [PATCH 2/3] Bluetooth: Create thread-safe " Andre Guedes
2012-02-07  4:29 ` Andre Guedes [this message]
2012-02-07 10:48   ` [PATCH 3/3] Bluetooth: Use advertising cache thread-safe functions Anderson Lizardo
2012-02-07 12:20     ` Andre Guedes
2012-02-07 13:26       ` Ulisses Furquim
2012-02-07 14:46         ` Andre Guedes
2012-02-07 15:20           ` Ulisses Furquim
2012-02-07 17:41             ` Andre Guedes
2012-02-07 17:47               ` Ulisses Furquim
2012-02-09 13:49 ` [PATCH 0/3] Advertising cache locking code refactoring Marcel Holtmann
2012-02-09 17:23   ` Ulisses Furquim
2012-02-09 19:18     ` 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=1328588997-25029-4-git-send-email-aguedespe@gmail.com \
    --to=aguedespe@gmail.com \
    --cc=andre.guedes@openbossa.org \
    --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;
as well as URLs for NNTP newsgroup(s).