summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeomho Seo <beomho.seo@samsung.com>2014-05-15 03:37:20 (GMT)
committerBeomho Seo <beomho.seo@samsung.com>2014-05-15 03:37:20 (GMT)
commit991ee82715845141497b29fa6f918739c6a4b47e (patch)
tree56402d6f504d7a1bb774710c88ab6e203453057f
parent23ea545052bb086e1177aa6e820e2e03331599e1 (diff)
downloadlinux-3.10-991ee82715845141497b29fa6f918739c6a4b47e.zip
linux-3.10-991ee82715845141497b29fa6f918739c6a4b47e.tar.gz
linux-3.10-991ee82715845141497b29fa6f918739c6a4b47e.tar.bz2
WORKAROUND: Bluetooth: add hci event notificationrefs/changes/79/21079/1
WORKAROUND: Temporary workaround for bluetooth enable. For specific hci events, operations are needed. So this patch adds event notification and its notifier registration. Change-Id: I6f8fe0b3b90c12d7f4fe35823d25b9fbdcd98d06 Signed-off-by: Beomho Seo <beomho.seo@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
-rw-r--r--include/net/bluetooth/hci.h1
-rw-r--r--include/net/bluetooth/hci_core.h2
-rw-r--r--net/bluetooth/hci_core.c17
3 files changed, 20 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 0ef0006..67c824b 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -42,6 +42,7 @@
#define HCI_DEV_DOWN 4
#define HCI_DEV_SUSPEND 5
#define HCI_DEV_RESUME 6
+#define HCI_DEV_WRITE 7
/* HCI notify events */
#define HCI_NOTIFY_CONN_ADD 1
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7cb6d36..1c8ae61 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1068,6 +1068,8 @@ static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
int hci_register_cb(struct hci_cb *hcb);
int hci_unregister_cb(struct hci_cb *hcb);
+int hci_register_notifier(struct notifier_block *nb);
+int hci_unregister_notifier(struct notifier_block *nb);
struct hci_request {
struct hci_dev *hdev;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 7c88f5f..14f56e5 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -49,10 +49,25 @@ DEFINE_RWLOCK(hci_cb_list_lock);
static DEFINE_IDA(hci_index_ida);
/* ---- HCI notifications ---- */
+static ATOMIC_NOTIFIER_HEAD(hci_notifier);
+
+int hci_register_notifier(struct notifier_block *nb)
+{
+ return atomic_notifier_chain_register(&hci_notifier, nb);
+}
+
+int hci_unregister_notifier(struct notifier_block *nb)
+{
+ return atomic_notifier_chain_unregister(&hci_notifier, nb);
+}
static void hci_notify(struct hci_dev *hdev, int event)
{
hci_sock_dev_event(hdev, event);
+
+ if (event == HCI_DEV_REG || event == HCI_DEV_UNREG
+ || event == HCI_DEV_WRITE)
+ atomic_notifier_call_chain(&hci_notifier, event, hdev);
}
/* ---- HCI requests ---- */
@@ -2593,6 +2608,8 @@ static int hci_send_frame(struct sk_buff *skb)
/* Get rid of skb owner, prior to sending to the driver. */
skb_orphan(skb);
+ hci_notify(hdev, HCI_DEV_WRITE);
+
return hdev->send(skb);
}