From patchwork Tue Dec 17 16:15:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 11298085 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46C516C1 for ; Tue, 17 Dec 2019 16:15:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1935921835 for ; Tue, 17 Dec 2019 16:15:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="dpYCguyo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728890AbfLQQPZ (ORCPT ); Tue, 17 Dec 2019 11:15:25 -0500 Received: from mail-bn8nam11on2073.outbound.protection.outlook.com ([40.107.236.73]:39265 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728835AbfLQQPO (ORCPT ); Tue, 17 Dec 2019 11:15:14 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cK4YN/4jKG7kIRvcqI3ya5lWdWMYjs1bL7cuQ0FSgp9bYYSQhAYd3puufA6sBOcEUAmzJBh7jn0w81h/tvRSqO3A6MoL17fJJt+C04+xmbeoVy3vW9ICl7yATPsTgqqVJXHpdpJOEX2463dvUf2kHtUR9Ce4nIi5Z/Hq88gVMKFi7GTBSjScEYUfR/v6Di83y5r8uYfSQdUb8NJJGSWp31yOagb/G9vMa51+D572FH16Rmh40ET2mAbe3T+2UhNj4oVVd8v9/5x8bii42G/aadJSwyksh4mG5IberjV9dEJA3Z6xjjSa5S7SA4SviZooYp6Irl9v6MTHK/zsUAL9DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DgRsYGpOQruqWvGnWEUUxdiA+S21vlMKBbozCs8hMqg=; b=G8mFtlxwMbrBP/Q4wfsykDn3ZyvKMhGaJz/NUk7HgyR+Kwajg1Xf/fmb7knT/U759Bm3F7eaaaqm1eNevpgwiYAvJj2dEFTUUAAF4OIYCdE63Ms1F/XhaSWw0lUoPxQIJlExj2DBnsc3nQ1YaNCKsnzDCCNIA6DPpUsq0tLqv0HG3z7Zufm0IjkEZ/kol4p04MAEJp5ou2Jox/fU/MFzC6SrlCjXsRnpf4i95nFzT/AD4xR79Qt0q8QRNkwdMOQvn92oZXBCcka4HrOUVigP4JVZiw3O15aer+Kcdz4uJTHzRzAYa30GE0AclxD1F8UCui2tXCrlGq6WoYrkiHXjxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DgRsYGpOQruqWvGnWEUUxdiA+S21vlMKBbozCs8hMqg=; b=dpYCguyo8BYZ33c+kx6JF9UAktyoLsahOJbkAErJtBML90bvVrY0Kh0Pk8qfl/i7Ai4Yi9CP/94D4VavY6TQtTbgoVVMAkFNIq8vGWNpBk6qELfZbe+io/tTyJcv828iTg+VHQnDaNWpQVewzkOuSjYl6XvQ9i7RgfDu4D2ugIg= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB4208.namprd11.prod.outlook.com (52.135.36.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.20; Tue, 17 Dec 2019 16:15:08 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::f46c:e5b4:2a85:f0bf]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::f46c:e5b4:2a85:f0bf%4]) with mapi id 15.20.2538.019; Tue, 17 Dec 2019 16:15:08 +0000 From: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= To: "devel@driverdev.osuosl.org" , "linux-wireless@vger.kernel.org" CC: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH v2 29/55] staging: wfx: simplify handling of tx_lock in wfx_do_join() Thread-Topic: [PATCH v2 29/55] staging: wfx: simplify handling of tx_lock in wfx_do_join() Thread-Index: AQHVtPUmosfEjogheUqodIyJPKuxrQ== Date: Tue, 17 Dec 2019 16:15:08 +0000 Message-ID: <20191217161318.31402-30-Jerome.Pouiller@silabs.com> References: <20191217161318.31402-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20191217161318.31402-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR0P264CA0174.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1c::18) To MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.24.0 x-originating-ip: [37.71.187.125] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 552362d5-4cfe-4523-d31b-08d7830c48fc x-ms-traffictypediagnostic: MN2PR11MB4208: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 02543CD7CD x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39850400004)(396003)(366004)(136003)(376002)(346002)(199004)(189003)(5660300002)(316002)(6506007)(85182001)(478600001)(71200400001)(2906002)(36756003)(186003)(26005)(81166006)(54906003)(1076003)(110136005)(66574012)(4326008)(8676002)(86362001)(6486002)(52116002)(6512007)(64756008)(85202003)(66946007)(66476007)(66446008)(66556008)(8936002)(107886003)(2616005)(81156014);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB4208;H:MN2PR11MB4063.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: silabs.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: hM9zcGfLv8VHYpaq22iU8lkrl1JqjQdPZlT/akPQ5PNozlt3GYfTZFDVChHwmfQ1SdQjATT4P5oSkOpRmYMkYdPp7HRiafe6XLUfoie/oshnHtk7b+2m2GjDejL/TgLFyUjuphgpXbcdUTpQIf891F9JpqWmEKHpToWmXTFlWFqV4TRvYAsryCaItexR/QLBC9DuXrJnpGXVnjXL4koQHo2thxNgSC9KJttK6NjtEC68G0u5Qt4+3aUGsWi3lWy8CQ3Bc652KKWwMPG2Jq+ZUQ5OU2VoZ1cFHo9cxZWgY5ejGBKrUyigqKXnrKVHXTwS3VI2ujnC3OUg/5zJCg+jshvfwOZ5hpMiFxfELMtfPr58nOKejB1RpoJCzn2EVa2yx2rH5d4qkpoaNLAeMjt2JtEuei8L8QzuBKZGOot7jqkWalEddwW6p/ltwwbUwWBq Content-ID: MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 552362d5-4cfe-4523-d31b-08d7830c48fc X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2019 16:15:08.5248 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SWdH+viZBM7hEXQ27QX9NEueQYZRD6MxxeLaiaMLyDRIyiz6lguVxCmDQ4dPcwx9CU484vmHHvDDvoBBVf4+1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4208 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller In the old days, wfx_do_join() could be called from different contexts. Now that wfx_do_join() is called only from one place, it is cleaner to keep lock and unlock of data inside the function. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 939c64f108ed..62e65493a4fe 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -644,7 +644,6 @@ static void wfx_set_mfp(struct wfx_vif *wvif, hif_set_mfp(wvif, mfpc, mfpr); } -/* MUST be called with tx_lock held! It will be unlocked for us. */ static void wfx_do_join(struct wfx_vif *wvif) { const u8 *bssid; @@ -659,6 +658,8 @@ static void wfx_do_join(struct wfx_vif *wvif) conf->basic_rates), }; + wfx_tx_lock_flush(wvif->wdev); + if (wvif->channel->flags & IEEE80211_CHAN_NO_IR) join.probe_for_join = 0; @@ -1180,10 +1181,8 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, } mutex_unlock(&wdev->conf_mutex); - if (do_join) { - wfx_tx_lock_flush(wdev); - wfx_do_join(wvif); /* Will unlock it for us */ - } + if (do_join) + wfx_do_join(wvif); } static void wfx_ps_notify(struct wfx_vif *wvif, enum sta_notify_cmd notify_cmd,