Skip to content

Commit de79a9d

Browse files
Matthias Kaehlckeholtmann
authored andcommitted
Bluetooth: btqcomsmd: use HCI_QUIRK_USE_BDADDR_PROPERTY
Use the HCI_QUIRK_USE_BDADDR_PROPERTY quirk to let the HCI core handle the reading of 'local-bd-address'. With this there is no need to set HCI_QUIRK_INVALID_BDADDR, the case of a non-existing or invalid fwnode property is handled by the core code. Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Balakrishna Godavarthi <bgodavar@codeaurora.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 7a0e5b1 commit de79a9d

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

drivers/bluetooth/btqcomsmd.c

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
struct btqcomsmd {
2929
struct hci_dev *hdev;
3030

31-
bdaddr_t bdaddr;
3231
struct rpmsg_endpoint *acl_channel;
3332
struct rpmsg_endpoint *cmd_channel;
3433
};
@@ -116,32 +115,17 @@ static int btqcomsmd_close(struct hci_dev *hdev)
116115

117116
static int btqcomsmd_setup(struct hci_dev *hdev)
118117
{
119-
struct btqcomsmd *btq = hci_get_drvdata(hdev);
120118
struct sk_buff *skb;
121-
int err;
122119

123120
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
124121
if (IS_ERR(skb))
125122
return PTR_ERR(skb);
126123
kfree_skb(skb);
127124

128-
/* Devices do not have persistent storage for BD address. If no
129-
* BD address has been retrieved during probe, mark the device
130-
* as having an invalid BD address.
131-
*/
132-
if (!bacmp(&btq->bdaddr, BDADDR_ANY)) {
133-
set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
134-
return 0;
135-
}
136-
137-
/* When setting a configured BD address fails, mark the device
138-
* as having an invalid BD address.
125+
/* Devices do not have persistent storage for BD address. Retrieve
126+
* it from the firmware node property.
139127
*/
140-
err = qca_set_bdaddr_rome(hdev, &btq->bdaddr);
141-
if (err) {
142-
set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
143-
return 0;
144-
}
128+
set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
145129

146130
return 0;
147131
}
@@ -169,15 +153,6 @@ static int btqcomsmd_probe(struct platform_device *pdev)
169153
if (IS_ERR(btq->cmd_channel))
170154
return PTR_ERR(btq->cmd_channel);
171155

172-
/* The local-bd-address property is usually injected by the
173-
* bootloader which has access to the allocated BD address.
174-
*/
175-
if (!of_property_read_u8_array(pdev->dev.of_node, "local-bd-address",
176-
(u8 *)&btq->bdaddr, sizeof(bdaddr_t))) {
177-
dev_info(&pdev->dev, "BD address %pMR retrieved from device-tree",
178-
&btq->bdaddr);
179-
}
180-
181156
hdev = hci_alloc_dev();
182157
if (!hdev)
183158
return -ENOMEM;

0 commit comments

Comments
 (0)