From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Kaehlcke Subject: [PATCH v2 2/3] Bluetooth: btqcomsmd: use HCI_QUIRK_USE_BDADDR_PROPERTY Date: Mon, 29 Oct 2018 17:44:14 -0700 Message-ID: <20181030004415.237101-3-mka@chromium.org> References: <20181030004415.237101-1-mka@chromium.org> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Balakrishna Godavarthi , Brian Norris , Dmitry Grinberg , Matthias Kaehlcke To: Marcel Holtmann , Johan Hedberg , "David S . Miller" , Loic Poulain Return-path: Received: from mail-pg1-f195.google.com ([209.85.215.195]:41267 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726523AbeJ3JgO (ORCPT ); Tue, 30 Oct 2018 05:36:14 -0400 Received: by mail-pg1-f195.google.com with SMTP id 23-v6so4726867pgc.8 for ; Mon, 29 Oct 2018 17:45:02 -0700 (PDT) In-Reply-To: <20181030004415.237101-1-mka@chromium.org> Sender: netdev-owner@vger.kernel.org List-ID: 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 Reviewed-by: Balakrishna Godavarthi --- I couldn't actually test the changes in this driver since I don't have a device with this controller. Could someone from Qualcomm help with this? Changes in v2: - removed now unused field 'bdaddr' from struct btqcomsmd - added 'Reviewed-by: Balakrishna Godavarthi ' tag --- drivers/bluetooth/btqcomsmd.c | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c index 7df3eed1ef5e..b3020fab6c8e 100644 --- a/drivers/bluetooth/btqcomsmd.c +++ b/drivers/bluetooth/btqcomsmd.c @@ -28,7 +28,6 @@ struct btqcomsmd { struct hci_dev *hdev; - bdaddr_t bdaddr; struct rpmsg_endpoint *acl_channel; struct rpmsg_endpoint *cmd_channel; }; @@ -125,23 +124,10 @@ static int btqcomsmd_setup(struct hci_dev *hdev) return PTR_ERR(skb); kfree_skb(skb); - /* Devices do not have persistent storage for BD address. If no - * BD address has been retrieved during probe, mark the device - * as having an invalid BD address. + /* Devices do not have persistent storage for BD address. Retrieve + * it from the firmware node property. */ - if (!bacmp(&btq->bdaddr, BDADDR_ANY)) { - 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; - } + set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); return 0; } @@ -169,15 +155,6 @@ static int btqcomsmd_probe(struct platform_device *pdev) if (IS_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(); if (!hdev) return -ENOMEM; -- 2.19.1.568.g152ad8e336-goog