From patchwork Fri Jun 2 08:19:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 688355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9715DC7EE29 for ; Fri, 2 Jun 2023 08:19:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234365AbjFBITr (ORCPT ); Fri, 2 Jun 2023 04:19:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233890AbjFBITq (ORCPT ); Fri, 2 Jun 2023 04:19:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CFB318C; Fri, 2 Jun 2023 01:19:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9036C60C84; Fri, 2 Jun 2023 08:19:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE418C433D2; Fri, 2 Jun 2023 08:19:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685693984; bh=8wWxcrhAkWwOt1iifMgfXitGD3MNLRHAUz9oHOPbCaA=; h=From:To:Cc:Subject:Date:From; b=Gu75y8hkSbm1lcT9LawORB3NzdNOniPJuclU5ljMLxFg3ICuBV77DkoVw+lCFwpYb a/o/0ZLnHzwTEQ0XDLZr2LC/wgg9vpufzWEXurlXnxekQuosbgRDPWMpH0AXEBVmWR lQRvMUGxllhb3Ya5HHmSuKy7bIKoFP3SSB6gy0vY4hBYiiQ/AiiQfM6yOAzko7LyaS RyjxOEmPR/uN3cXMNDEyY4bbceG3GiFXzy/aSUCb5dN8Qu55wnZ47vubY2vhuQoy6W o47GnHAv4IpmYjtY2k3PeAM9l+xYVwz2M+MspW+6ichuKHgUll/2HK0AW5r8KlfIf8 a4iiANTcho/Ug== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1q500n-0001EU-RF; Fri, 02 Jun 2023 10:19:53 +0200 From: Johan Hovold To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: Matthias Kaehlcke , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , Marek Szyprowski Subject: [PATCH] Bluetooth: hci_bcm: do not mark valid bd_addr as invalid Date: Fri, 2 Jun 2023 10:19:12 +0200 Message-Id: <20230602081912.4708-1-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org A recent commit restored the original (and still documented) semantics for the HCI_QUIRK_USE_BDADDR_PROPERTY quirk so that the device address is considered invalid unless an address is provided by firmware. This specifically means that this flag must only be set for devices with invalid addresses, but the Broadcom driver has so far been setting this flag unconditionally. Fortunately the driver already checks for invalid addresses during setup and sets the HCI_QUIRK_INVALID_BDADDR flag. Use this flag to indicate when the address can be overridden by firmware (long term, this should probably just always be allowed). Fixes: 6ac517d8cf8b ("Bluetooth: fix use-bdaddr-property quirk") Reported-by: Marek Szyprowski Link: https://lore.kernel.org/lkml/ecef83c8-497f-4011-607b-a63c24764867@samsung.com Signed-off-by: Johan Hovold Tested-by: Marek Szyprowski --- drivers/bluetooth/hci_bcm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index 83bf5d4330c4..874d23089b39 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -643,7 +643,8 @@ static int bcm_setup(struct hci_uart *hu) * Allow the bootloader to set a valid address through the * device tree. */ - set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hu->hdev->quirks); + if (test_bit(HCI_QUIRK_INVALID_BDADDR, &hu->hdev->quirks)) + set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hu->hdev->quirks); if (!bcm_request_irq(bcm)) err = bcm_setup_sleep(hu);