mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-25 21:54:06 +08:00
Bluetooth: Use hci_copy_identity_addr() helper for SMP chan creation
The only reason the SMP code is essentially duplicating the hci_copy_identity_addr() function is that the helper returns the address type in the HCI format rather than the three-value format expected by l2cap_chan. This patch converts the SMP code to use the helper and then do a simple conversion from one address type to another. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
a2cb01de1c
commit
39e3e74423
@ -2951,24 +2951,14 @@ create_chan:
|
|||||||
l2cap_chan_set_defaults(chan);
|
l2cap_chan_set_defaults(chan);
|
||||||
|
|
||||||
if (cid == L2CAP_CID_SMP) {
|
if (cid == L2CAP_CID_SMP) {
|
||||||
/* If usage of static address is forced or if the devices
|
u8 bdaddr_type;
|
||||||
* does not have a public address, then listen on the static
|
|
||||||
* address.
|
hci_copy_identity_address(hdev, &chan->src, &bdaddr_type);
|
||||||
*
|
|
||||||
* In case BR/EDR has been disabled on a dual-mode controller
|
if (bdaddr_type == ADDR_LE_DEV_PUBLIC)
|
||||||
* and a static address has been configued, then listen on
|
|
||||||
* the static address instead.
|
|
||||||
*/
|
|
||||||
if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) ||
|
|
||||||
!bacmp(&hdev->bdaddr, BDADDR_ANY) ||
|
|
||||||
(!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) &&
|
|
||||||
bacmp(&hdev->static_addr, BDADDR_ANY))) {
|
|
||||||
bacpy(&chan->src, &hdev->static_addr);
|
|
||||||
chan->src_type = BDADDR_LE_RANDOM;
|
|
||||||
} else {
|
|
||||||
bacpy(&chan->src, &hdev->bdaddr);
|
|
||||||
chan->src_type = BDADDR_LE_PUBLIC;
|
chan->src_type = BDADDR_LE_PUBLIC;
|
||||||
}
|
else
|
||||||
|
chan->src_type = BDADDR_LE_RANDOM;
|
||||||
} else {
|
} else {
|
||||||
bacpy(&chan->src, &hdev->bdaddr);
|
bacpy(&chan->src, &hdev->bdaddr);
|
||||||
chan->src_type = BDADDR_BREDR;
|
chan->src_type = BDADDR_BREDR;
|
||||||
|
Loading…
Reference in New Issue
Block a user