summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorMarcel Holtmann2014-07-06 12:11:15 +0200
committerJohan Hedberg2014-07-06 12:42:20 +0200
commit9713c17b086c1ebfe34ea4d34147a778276e2dab (patch)
tree2e5dcc1d74effed93b919b8b3c617e937d7292e5 /net/bluetooth/hci_core.c
parentBluetooth: Run controller setup after external configuration (diff)
downloadkernel-qcow2-linux-9713c17b086c1ebfe34ea4d34147a778276e2dab.tar.gz
kernel-qcow2-linux-9713c17b086c1ebfe34ea4d34147a778276e2dab.tar.xz
kernel-qcow2-linux-9713c17b086c1ebfe34ea4d34147a778276e2dab.zip
Bluetooth: Add support for changing the public device address
This adds support for changing the public device address. This feature is required by controllers that do not provide a public address and have HCI_QUIRK_INVALID_BDADDR set. Even if a controller has a public device address, this is useful when an embedded system wants to use its own value. As long as the driver provides the set_bdaddr callback, this allows changing the device address before powering on the controller. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index bf7cf512df88..c96b96ca41ac 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2302,12 +2302,14 @@ static int hci_dev_do_open(struct hci_dev *hdev)
ret = __hci_unconf_init(hdev);
}
- /* If public address change is configured, ensure that the
- * address gets programmed. If the driver does not support
- * changing the public address, fail the power on procedure.
- */
- if (!ret && bacmp(&hdev->public_addr, BDADDR_ANY)) {
- if (hdev->set_bdaddr)
+ if (test_bit(HCI_CONFIG, &hdev->dev_flags)) {
+ /* If public address change is configured, ensure that
+ * the address gets programmed. If the driver does not
+ * support changing the public address, fail the power
+ * on procedure.
+ */
+ if (bacmp(&hdev->public_addr, BDADDR_ANY) &&
+ hdev->set_bdaddr)
ret = hdev->set_bdaddr(hdev, &hdev->public_addr);
else
ret = -EADDRNOTAVAIL;