From 1be712d0fa0b90f9945e22d0fd1adfdfca950538 Mon Sep 17 00:00:00 2001 From: Paolo Pisati Date: Mon, 14 Jan 2019 16:21:41 +0000 Subject: [PATCH 1/2] UBUNTU: SAUCE: btqcomsmd: introduce BT_QCOMSMD_HACK BugLink: https://bugs.launchpad.net/bugs/1810797 Signed-off-by: Paolo Pisati --- drivers/bluetooth/Kconfig | 8 ++++++++ drivers/bluetooth/btqcomsmd.c | 21 ++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index 60e1c7d6986d..e1df81d3d65c 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig @@ -378,4 +378,12 @@ config BT_QCOMSMD Say Y here to compile support for HCI over Qualcomm SMD into the kernel or say M to compile as a module. +config BT_QCOMSMD_HACK + bool "Don't hook hci setup if BD is not present" + default n + help + Don't blindly hook the hci setup function, leaving hci the + task of generating a BT address instead of failing, in case a BD + address wasn't assigned to hcidev during qcomsmd_probe(). + endmenu diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c index 2c9a5fc9137d..375e9fa7c827 100644 --- a/drivers/bluetooth/btqcomsmd.c +++ b/drivers/bluetooth/btqcomsmd.c @@ -159,15 +159,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; @@ -180,7 +171,19 @@ static int btqcomsmd_probe(struct platform_device *pdev) hdev->open = btqcomsmd_open; hdev->close = btqcomsmd_close; hdev->send = btqcomsmd_send; +#ifdef CONFIG_BT_QCOMSMD_HACK + /* 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->setup = btqcomsmd_setup; + } +#else hdev->setup = btqcomsmd_setup; +#endif hdev->set_bdaddr = qca_set_bdaddr_rome; ret = hci_register_dev(hdev); -- 2.17.1