mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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>
This commit is contained in:
parent
7a0e5b15ca
commit
de79a9df16
1 changed files with 3 additions and 28 deletions
|
@ -28,7 +28,6 @@
|
||||||
struct btqcomsmd {
|
struct btqcomsmd {
|
||||||
struct hci_dev *hdev;
|
struct hci_dev *hdev;
|
||||||
|
|
||||||
bdaddr_t bdaddr;
|
|
||||||
struct rpmsg_endpoint *acl_channel;
|
struct rpmsg_endpoint *acl_channel;
|
||||||
struct rpmsg_endpoint *cmd_channel;
|
struct rpmsg_endpoint *cmd_channel;
|
||||||
};
|
};
|
||||||
|
@ -116,32 +115,17 @@ static int btqcomsmd_close(struct hci_dev *hdev)
|
||||||
|
|
||||||
static int btqcomsmd_setup(struct hci_dev *hdev)
|
static int btqcomsmd_setup(struct hci_dev *hdev)
|
||||||
{
|
{
|
||||||
struct btqcomsmd *btq = hci_get_drvdata(hdev);
|
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
int err;
|
|
||||||
|
|
||||||
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
|
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
|
||||||
if (IS_ERR(skb))
|
if (IS_ERR(skb))
|
||||||
return PTR_ERR(skb);
|
return PTR_ERR(skb);
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
|
|
||||||
/* Devices do not have persistent storage for BD address. If no
|
/* Devices do not have persistent storage for BD address. Retrieve
|
||||||
* BD address has been retrieved during probe, mark the device
|
* it from the firmware node property.
|
||||||
* as having an invalid BD address.
|
|
||||||
*/
|
*/
|
||||||
if (!bacmp(&btq->bdaddr, BDADDR_ANY)) {
|
set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
|
||||||
set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* When setting a configured BD address fails, mark the device
|
|
||||||
* as having an invalid BD address.
|
|
||||||
*/
|
|
||||||
err = qca_set_bdaddr_rome(hdev, &btq->bdaddr);
|
|
||||||
if (err) {
|
|
||||||
set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -169,15 +153,6 @@ static int btqcomsmd_probe(struct platform_device *pdev)
|
||||||
if (IS_ERR(btq->cmd_channel))
|
if (IS_ERR(btq->cmd_channel))
|
||||||
return PTR_ERR(btq->cmd_channel);
|
return PTR_ERR(btq->cmd_channel);
|
||||||
|
|
||||||
/* The local-bd-address property is usually injected by the
|
|
||||||
* bootloader which has access to the allocated BD address.
|
|
||||||
*/
|
|
||||||
if (!of_property_read_u8_array(pdev->dev.of_node, "local-bd-address",
|
|
||||||
(u8 *)&btq->bdaddr, sizeof(bdaddr_t))) {
|
|
||||||
dev_info(&pdev->dev, "BD address %pMR retrieved from device-tree",
|
|
||||||
&btq->bdaddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
hdev = hci_alloc_dev();
|
hdev = hci_alloc_dev();
|
||||||
if (!hdev)
|
if (!hdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue