diff options
author | Matthias Kaehlcke <mka@chromium.org> | 2019-02-19 15:05:58 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2019-02-26 04:08:26 -0500 |
commit | de79a9df169269d6481b39d46d14768337ee4463 (patch) | |
tree | d7b52a45defb7702d50a3922cc1051498fbb14d7 /drivers/bluetooth | |
parent | 7a0e5b15ca458dd47e4c60b7fa9f22b84c7068c7 (diff) |
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>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r-- | drivers/bluetooth/btqcomsmd.c | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c index 7df3eed1ef5e..e0d4c6f1d3ab 100644 --- a/drivers/bluetooth/btqcomsmd.c +++ b/drivers/bluetooth/btqcomsmd.c | |||
@@ -28,7 +28,6 @@ | |||
28 | struct btqcomsmd { | 28 | struct btqcomsmd { |
29 | struct hci_dev *hdev; | 29 | struct hci_dev *hdev; |
30 | 30 | ||
31 | bdaddr_t bdaddr; | ||
32 | struct rpmsg_endpoint *acl_channel; | 31 | struct rpmsg_endpoint *acl_channel; |
33 | struct rpmsg_endpoint *cmd_channel; | 32 | struct rpmsg_endpoint *cmd_channel; |
34 | }; | 33 | }; |
@@ -116,32 +115,17 @@ static int btqcomsmd_close(struct hci_dev *hdev) | |||
116 | 115 | ||
117 | static int btqcomsmd_setup(struct hci_dev *hdev) | 116 | static int btqcomsmd_setup(struct hci_dev *hdev) |
118 | { | 117 | { |
119 | struct btqcomsmd *btq = hci_get_drvdata(hdev); | ||
120 | struct sk_buff *skb; | 118 | struct sk_buff *skb; |
121 | int err; | ||
122 | 119 | ||
123 | skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); | 120 | skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); |
124 | if (IS_ERR(skb)) | 121 | if (IS_ERR(skb)) |
125 | return PTR_ERR(skb); | 122 | return PTR_ERR(skb); |
126 | kfree_skb(skb); | 123 | kfree_skb(skb); |
127 | 124 | ||
128 | /* Devices do not have persistent storage for BD address. If no | 125 | /* Devices do not have persistent storage for BD address. Retrieve |
129 | * BD address has been retrieved during probe, mark the device | 126 | * it from the firmware node property. |
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. | ||
139 | */ | 127 | */ |
140 | err = qca_set_bdaddr_rome(hdev, &btq->bdaddr); | 128 | set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); |
141 | if (err) { | ||
142 | set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); | ||
143 | return 0; | ||
144 | } | ||
145 | 129 | ||
146 | return 0; | 130 | return 0; |
147 | } | 131 | } |
@@ -169,15 +153,6 @@ static int btqcomsmd_probe(struct platform_device *pdev) | |||
169 | if (IS_ERR(btq->cmd_channel)) | 153 | if (IS_ERR(btq->cmd_channel)) |
170 | return PTR_ERR(btq->cmd_channel); | 154 | return PTR_ERR(btq->cmd_channel); |
171 | 155 | ||
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 | |||
181 | hdev = hci_alloc_dev(); | 156 | hdev = hci_alloc_dev(); |
182 | if (!hdev) | 157 | if (!hdev) |
183 | return -ENOMEM; | 158 | return -ENOMEM; |