Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3602943pxb; Mon, 24 Jan 2022 13:16:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJySgh33Hafqi9fBvUXA73//ANX1cBE7+L6FtAPp0zDwb/fPNQCcWEKcImZabb66QHjsqKAy X-Received: by 2002:a17:902:e84b:b0:14b:707a:2b2a with SMTP id t11-20020a170902e84b00b0014b707a2b2amr894005plg.69.1643059016555; Mon, 24 Jan 2022 13:16:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643059016; cv=none; d=google.com; s=arc-20160816; b=LKULX4SOxBPUIRG24vTKX221L+Wr0IZDyrVD42Lp4v7ZNdApQVp+SuuKkfAHcGF4h6 pTMioNlBhe85VYfj+9dAas5XwP/QQMyDahkhtK5iJYrN05rbyXCOWEF3dDXAh5x6Maf9 qRH1u1P6gv6ENi3alxDyrsDATR98KHCiI6aVAHXFgsSqLwzHqghwd17LgowNKw/OnWg0 mzTniCgUCTF8W54HyGgx1t+0t8ekWPOuqq9D5fVbH7SrimBkx3K9pb4c57MDo+eRo7xP wQQAPpx6nLk0aT4DVPVlvYfi8B5ghWeeKjQ6DH9PrlrOeeUlE0ppLSlyxJ21DZW34NCs XzYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=o4Evj+XwZBobXmS3nDd8LDj1Or7vAm73tbaBn7fO+eY=; b=QU76nN3JHk0XcVv6tInV+z7kiYmUtUJgQzbVH9QElnWO8knzXPtvT7e5HQTdx8t/ai V43gbKXQAZphaPOJw3/EWz+1mStQy4AI4GfQrAhAPBFbjW0d2N/3nnzGa2/ZvkjiFhj3 A6UZ2gjtJmr0zRwVvNQIfSU/X4W5OYlAJeYfQs/gC9wOxHfjS9k1kF4dX74xva5bC5Je 9ggdvYRO4ZyflnFLvRIcaDvphpfmgMiL8nIkF/Yt+rL9f8isZlB/9Cl8ARgXG9bxFzt1 nTbU9XfFaQIo+2k1/MHlg0DcolJG5XMjXrudC+IeIRnKCXoVhOiJwllrpyiSw/04DcYR 2skA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Bqdwh/9N"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si16209366plg.418.2022.01.24.13.16.44; Mon, 24 Jan 2022 13:16:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Bqdwh/9N"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352434AbiAXUl6 (ORCPT + 99 others); Mon, 24 Jan 2022 15:41:58 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59196 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344555AbiAXUWx (ORCPT ); Mon, 24 Jan 2022 15:22:53 -0500 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 ams.source.kernel.org (Postfix) with ESMTPS id 2E8CCB80FA1; Mon, 24 Jan 2022 20:22:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AA11C340E5; Mon, 24 Jan 2022 20:22:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055770; bh=9ChZlTwI84NfQP4O3pQKbJA5EkmXR+lHMMoaN8VW+L4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bqdwh/9NHX6InlWieepLWYnI5IyxBkKWlgFmFcewi/FwuenC1uMawCnzoqH75u692 UT2Kg0D1qDb1l7HGBgDu0pvVDopPLLJjpimaqC1A2mUCJmcZ26b3WbZiaMcDR/rZjB fYhi6HDoGUJcgVzv0Am/3pY5ShUyFqQJOU52yJWE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.15 217/846] Bluetooth: MGMT: Use hci_dev_test_and_{set,clear}_flag Date: Mon, 24 Jan 2022 19:35:34 +0100 Message-Id: <20220124184108.416306932@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luiz Augusto von Dentz [ Upstream commit 6f59f991b4e735323f099ac6490e725ae8c750a5 ] This make use of hci_dev_test_and_{set,clear}_flag instead of doing 2 operations in a row. Fixes: cbbdfa6f33198 ("Bluetooth: Enable controller RPA resolution using Experimental feature") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/mgmt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index d7306c1ffbef5..f09f0a78eb7be 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -3919,10 +3919,10 @@ static int set_zero_key_func(struct sock *sk, struct hci_dev *hdev, #endif if (hdev && use_ll_privacy(hdev) && !hdev_is_powered(hdev)) { - bool changed = hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY); - - hci_dev_clear_flag(hdev, HCI_ENABLE_LL_PRIVACY); + bool changed; + changed = hci_dev_test_and_clear_flag(hdev, + HCI_ENABLE_LL_PRIVACY); if (changed) exp_ll_privacy_feature_changed(false, hdev, sk); } @@ -4017,15 +4017,15 @@ static int set_rpa_resolution_func(struct sock *sk, struct hci_dev *hdev, val = !!cp->param[0]; if (val) { - changed = !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY); - hci_dev_set_flag(hdev, HCI_ENABLE_LL_PRIVACY); + changed = !hci_dev_test_and_set_flag(hdev, + HCI_ENABLE_LL_PRIVACY); hci_dev_clear_flag(hdev, HCI_ADVERTISING); /* Enable LL privacy + supported settings changed */ flags = BIT(0) | BIT(1); } else { - changed = hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY); - hci_dev_clear_flag(hdev, HCI_ENABLE_LL_PRIVACY); + changed = hci_dev_test_and_clear_flag(hdev, + HCI_ENABLE_LL_PRIVACY); /* Disable LL privacy + supported settings changed */ flags = BIT(1); -- 2.34.1