summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorJohan Hedberg2012-01-04 12:39:52 +0100
committerJohan Hedberg2012-02-13 16:01:20 +0100
commit3175405b906a85ed2bad21e09c444266e4a05a8e (patch)
treecf75dda123120a5a48ee322c3248ea73d37cbdcc /net/bluetooth/hci_core.c
parentBluetooth: Add initial mgmt_confirm_name support (diff)
downloadkernel-qcow2-linux-3175405b906a85ed2bad21e09c444266e4a05a8e.tar.gz
kernel-qcow2-linux-3175405b906a85ed2bad21e09c444266e4a05a8e.tar.xz
kernel-qcow2-linux-3175405b906a85ed2bad21e09c444266e4a05a8e.zip
Bluetooth: Return updated name state with hci_inquiry_cache_update
If user-space has already confirmed the name for a remote device we shouldn't request confirmation again. The simplest way to do this is to return the name state from hci_inquiry_cache_update (if it is anything else than unknown then we do not need confirmation from user-space). Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index fc09a3cbe20c..162176151db9 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -400,7 +400,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev,
return NULL;
}
-void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
+bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
bool name_known)
{
struct inquiry_cache *cache = &hdev->inq_cache;
@@ -415,7 +415,7 @@ void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
/* Entry not in the cache. Add new one. */
ie = kzalloc(sizeof(struct inquiry_entry), GFP_ATOMIC);
if (!ie)
- return;
+ return false;
list_add(&ie->all, &cache->all);
@@ -436,6 +436,11 @@ update:
memcpy(&ie->data, data, sizeof(*data));
ie->timestamp = jiffies;
cache->timestamp = jiffies;
+
+ if (ie->name_state == NAME_NOT_KNOWN)
+ return false;
+
+ return true;
}
static int inquiry_cache_dump(struct hci_dev *hdev, int num, __u8 *buf)