Bluetooth: Move New LTK store hint evaluation into mgmt_new_ltk

It's simpler (one less if-statement) to just evaluate the appropriate
value for store_hint in the mgmt_new_ltk function than to pass a boolean
parameter to the function. Furthermore, this simplifies moving the mgmt
event emission out from hci_add_ltk in subsequent patches.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Johan Hedberg
2014-02-19 14:57:45 +02:00
committed by Marcel Holtmann
parent ca9142b882
commit ba74b666b5
3 changed files with 9 additions and 10 deletions

View File

@@ -2768,7 +2768,6 @@ struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
{
struct smp_ltk *key, *old_key;
bool master = ltk_type_master(type);
u8 persistent;
old_key = hci_find_ltk_by_addr(hdev, bdaddr, addr_type, master);
if (old_key)
@@ -2792,13 +2791,8 @@ struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
if (!new_key)
return key;
if (addr_type == ADDR_LE_DEV_RANDOM && (bdaddr->b[5] & 0xc0) != 0xc0)
persistent = 0;
else
persistent = 1;
if (type == HCI_SMP_LTK || type == HCI_SMP_LTK_SLAVE)
mgmt_new_ltk(hdev, key, persistent);
mgmt_new_ltk(hdev, key);
return key;
}