aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/bluetooth/hci_core.h
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-01-04 14:23:45 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-13 17:01:20 +0200
commitff9ef5787046c3fd20cf9f7ca1cd70260c1eedb9 (patch)
treeba9d936fd1aa8b3a8f4fe0685b71007f9116f30c /include/net/bluetooth/hci_core.h
parentBluetooth: Rename hdev->inq_cache to hdev->discovery (diff)
downloadlinux-dev-ff9ef5787046c3fd20cf9f7ca1cd70260c1eedb9.tar.xz
linux-dev-ff9ef5787046c3fd20cf9f7ca1cd70260c1eedb9.zip
Bluetooth: Add discovery state tracking
This patch adds proper state tracking to the device discovery process. This makes it possible to return appropriate errors when trying to stop a non-active discovery or start discovery when it is already ongoing. Once name resolving is implemented this also makes it possible to know what the right action to do is when a remote name lookup is cancelled. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net/bluetooth/hci_core.h')
-rw-r--r--include/net/bluetooth/hci_core.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 5a566fd5e2a6..2f19de4770b6 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -57,6 +57,12 @@ struct inquiry_entry {
};
struct discovery_state {
+ enum {
+ DISCOVERY_STOPPED,
+ DISCOVERY_STARTING,
+ DISCOVERY_ACTIVE,
+ DISCOVERY_STOPPING,
+ } state;
struct list_head all; /* All devices found during inquiry */
struct list_head unknown; /* Name state not known */
struct list_head resolve; /* Name needs to be resolved */
@@ -359,11 +365,14 @@ extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
static inline void discovery_init(struct hci_dev *hdev)
{
+ hdev->discovery.state = DISCOVERY_STOPPED;
INIT_LIST_HEAD(&hdev->discovery.all);
INIT_LIST_HEAD(&hdev->discovery.unknown);
INIT_LIST_HEAD(&hdev->discovery.resolve);
}
+void hci_discovery_set_state(struct hci_dev *hdev, int state);
+
static inline int inquiry_cache_empty(struct hci_dev *hdev)
{
return list_empty(&hdev->discovery.all);