Skip to content

Commit 090beba

Browse files
pelwellpopcornmix
authored andcommitted
Bluetooth: hci_sync: Add fallback-bd-address prop
The kernel Bluetooth framework understands that devices may not be programmed with valid Bluetooth addresses. It also has the ability to override a Bluetooth address with the value of the local-bd-address DT property, but it ignores the validity of the existing address when doing so. Add a new boolean property, fallback-bd-address, which indicates that the given local-bd-address property should only be used if the device does not already have a valid BDADDR. Signed-off-by: Phil Elwell <[email protected]>
1 parent 461fc2b commit 090beba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/bluetooth/hci_sync.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4540,6 +4540,7 @@ static const struct {
45404540
*/
45414541
static int hci_dev_setup_sync(struct hci_dev *hdev)
45424542
{
4543+
struct fwnode_handle *fwnode = dev_fwnode(hdev->dev.parent);
45434544
int ret = 0;
45444545
bool invalid_bdaddr;
45454546
size_t i;
@@ -4568,7 +4569,9 @@ static int hci_dev_setup_sync(struct hci_dev *hdev)
45684569

45694570
if (!ret) {
45704571
if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) &&
4571-
!bacmp(&hdev->public_addr, BDADDR_ANY))
4572+
!bacmp(&hdev->public_addr, BDADDR_ANY) &&
4573+
(invalid_bdaddr ||
4574+
!fwnode_property_present(fwnode, "fallback-bd-address")))
45724575
hci_dev_get_bd_addr_from_property(hdev);
45734576

45744577
if ((invalid_bdaddr ||

0 commit comments

Comments
 (0)