Bluetooth: Return updated name state with hci_inquiry_cache_update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / net / bluetooth / hci_core.h
index 5e2e984584968f0e6beea90c8657eb1639a1cba2..236f7f0e596e8cc950682f409ee4af0629a2b648 100644 (file)
@@ -44,14 +44,23 @@ struct inquiry_data {
 };
 
 struct inquiry_entry {
-       struct inquiry_entry    *next;
+       struct list_head        all;            /* inq_cache.all */
+       struct list_head        list;           /* unknown or resolve */
+       enum {
+               NAME_NOT_KNOWN,
+               NAME_NEEDED,
+               NAME_PENDING,
+               NAME_KNOWN,
+       } name_state;
        __u32                   timestamp;
        struct inquiry_data     data;
 };
 
 struct inquiry_cache {
-       __u32                   timestamp;
-       struct inquiry_entry    *list;
+       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 */
+       __u32           timestamp;
 };
 
 struct hci_conn_hash {
@@ -127,7 +136,7 @@ struct hci_dev {
        __u8            major_class;
        __u8            minor_class;
        __u8            features[8];
-       __u8            extfeatures[8];
+       __u8            host_features[8];
        __u8            commands[64];
        __u8            ssp_mode;
        __u8            hci_ver;
@@ -350,14 +359,14 @@ extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
 
 static inline void inquiry_cache_init(struct hci_dev *hdev)
 {
-       struct inquiry_cache *c = &hdev->inq_cache;
-       c->list = NULL;
+       INIT_LIST_HEAD(&hdev->inq_cache.all);
+       INIT_LIST_HEAD(&hdev->inq_cache.unknown);
+       INIT_LIST_HEAD(&hdev->inq_cache.resolve);
 }
 
 static inline int inquiry_cache_empty(struct hci_dev *hdev)
 {
-       struct inquiry_cache *c = &hdev->inq_cache;
-       return c->list == NULL;
+       return list_empty(&hdev->inq_cache.all);
 }
 
 static inline long inquiry_cache_age(struct hci_dev *hdev)
@@ -373,7 +382,10 @@ static inline long inquiry_entry_age(struct inquiry_entry *e)
 
 struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev,
                                                        bdaddr_t *bdaddr);
-void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data);
+struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev,
+                                                       bdaddr_t *bdaddr);
+bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
+                                                       bool name_known);
 
 /* ----- HCI Connections ----- */
 enum {
@@ -676,7 +688,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
 #define lmp_le_capable(dev)        ((dev)->features[4] & LMP_LE)
 
 /* ----- Extended LMP capabilities ----- */
-#define lmp_host_le_capable(dev)   ((dev)->extfeatures[0] & LMP_HOST_LE)
+#define lmp_host_le_capable(dev)   ((dev)->host_features[0] & LMP_HOST_LE)
 
 /* ----- HCI protocols ----- */
 static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
@@ -915,7 +927,8 @@ int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
 int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
                                                u8 *randomizer, u8 status);
 int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
-                               u8 addr_type, u8 *dev_class, s8 rssi, u8 *eir);
+                                       u8 addr_type, u8 *dev_class, s8 rssi,
+                                       u8 cfm_name, u8 *eir);
 int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name);
 int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
 int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status);