Commit d1c5ea97 authored by Marcel Holtmann's avatar Marcel Holtmann

[Bluetooth] Add notify callback for host drivers

This patch adds a notification callback to the hci_dev structure which
is used by the HCI core to tell the driver about connection creation
and clearing. It also notifies about changed voice setting.
parent 430e67b3
......@@ -42,6 +42,11 @@
#define HCI_DEV_SUSPEND 5
#define HCI_DEV_RESUME 6
/* HCI notify events */
#define HCI_NOTIFY_CONN_ADD 1
#define HCI_NOTIFY_CONN_DEL 2
#define HCI_NOTIFY_VOICE_SETTING 3
/* HCI device types */
#define HCI_VHCI 0
#define HCI_USB 1
......
......@@ -130,6 +130,7 @@ struct hci_dev {
int (*flush)(struct hci_dev *hdev);
int (*send)(struct sk_buff *skb);
void (*destruct)(struct hci_dev *hdev);
void (*notify)(struct hci_dev *hdev, unsigned int evt);
int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
};
......
......@@ -170,6 +170,9 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
hci_conn_hash_add(hdev, conn);
tasklet_enable(&hdev->tx_task);
if (hdev->notify)
hdev->notify(hdev, HCI_NOTIFY_CONN_ADD);
return conn;
}
......@@ -196,6 +199,9 @@ int hci_conn_del(struct hci_conn *conn)
hdev->acl_cnt += conn->sent;
}
if (hdev->notify)
hdev->notify(hdev, HCI_NOTIFY_CONN_DEL);
tasklet_disable(&hdev->tx_task);
hci_conn_hash_del(hdev, conn);
tasklet_enable(&hdev->tx_task);
......
......@@ -232,6 +232,9 @@ static void hci_cc_host_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb
hdev->voice_setting = setting;
BT_DBG("%s: voice setting 0x%04x", hdev->name, setting);
if (hdev->notify)
hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING);
}
break;
......@@ -247,6 +250,9 @@ static void hci_cc_host_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb
hdev->voice_setting = setting;
BT_DBG("%s: voice setting 0x%04x", hdev->name, setting);
if (hdev->notify)
hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING);
}
hci_req_complete(hdev, status);
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment