From patchwork Wed Jan 15 12:12:27 2020 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: 11334137 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 5E9B9138D for ; Wed, 15 Jan 2020 12:19:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29FC2222C3 for ; Wed, 15 Jan 2020 12:19:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="eII7E9kP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731054AbgAOMSz (ORCPT ); Wed, 15 Jan 2020 07:18:55 -0500 Received: from mail-co1nam11on2084.outbound.protection.outlook.com ([40.107.220.84]:24056 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730635AbgAOMMi (ORCPT ); Wed, 15 Jan 2020 07:12:38 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mk2n9F9senpdR9cPwtiVRRtWJ/05WGJtWWLXX7i8sXwPVyvI4IqGAlcpX1a0X4iQICLNX8hbZU+sYi8pPdsWojiNIH6BxuynmLA4wPKquBv7OFx5SWrbjMZFz0ZgipsylErHp6BMfmBUP7XK0RhWbFMfAHUOfduULDmD/VuxrMeai4+RyGyWViMTRVE36LhJARUJrz0+oyXWmr10OLPxTx8fpRcLbPYaOl8QWm3OjBxAYnrcs88WgyKsPjTx+iLudOykpjtolVJyfydZ6Ek+MVp1BPtLr7OvYYAf+0g/mdhv+AGtvh6YvGoe7SB8ZWIqTV3wYcalKBmtZQezuZ71Ug== 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=NlkiUJxQPHorVMQBL0ZcjgHGbnm7YMMbP4keAThtSs4=; b=SR5KcgkvPWmXDlCjJIHd6DIHVeU1OEJ9Rhse1m1TBAWow3erH1gJsD2y4f4ijVCOPgfWpcnO8xs7ol5g8zUSxwJjJ/sS+hd/biVYLZhLA72DDsbGZzTw0qs8ghWHuY/IUhMZUbz/ebqI2nypP0wRQliF7ulAXcUIToWf65kZDWUSePLL9GQi3NrFw4BxXb+le8tlhHrpmfp3oww87AhNi6WsVZZbTo20KyLB0rR167lo5BjUi28jG8lvpOcE/4dRt1lC9KH/QvPb6FoiaBdb3tgGNO6BCtrTPlLyuzPGc/7gOQucTZZxqAymSLpE91ElXCDmm9ttIv9xCwI2rhoLAQ== 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=NlkiUJxQPHorVMQBL0ZcjgHGbnm7YMMbP4keAThtSs4=; b=eII7E9kPq2iS+sGVco2ZM3DSIrlanU7xKLwijJxrZ9Usx7E2X21p/s0jmE5jH935B1BrXWmL+/ehwURjCO5705vdOXeYPHP1wbu8tOedzleGh8dc4Uhb7DoWuLitrH8XF5voASb+VWPuleH2IXRfOkoNvEi3drsbezx0azsUOVM= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB3934.namprd11.prod.outlook.com (10.255.180.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Wed, 15 Jan 2020 12:12:28 +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.2623.018; Wed, 15 Jan 2020 12:12:28 +0000 Received: from pc-42.silabs.com (37.71.187.125) by PR2PR09CA0009.eurprd09.prod.outlook.com (2603:10a6:101:16::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18 via Frontend Transport; Wed, 15 Jan 2020 12:12:26 +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 14/65] staging: wfx: drop wdev->output_power Thread-Topic: [PATCH 14/65] staging: wfx: drop wdev->output_power Thread-Index: AQHVy50NUN5rnIj6Ek2YycwTsMt/DQ== Date: Wed, 15 Jan 2020 12:12:27 +0000 Message-ID: <20200115121041.10863-15-Jerome.Pouiller@silabs.com> References: <20200115121041.10863-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20200115121041.10863-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR2PR09CA0009.eurprd09.prod.outlook.com (2603:10a6:101:16::21) 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.25.0 x-originating-ip: [37.71.187.125] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2a440b69-4fc3-4336-755a-08d799b4301f x-ms-traffictypediagnostic: MN2PR11MB3934: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 02830F0362 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39850400004)(396003)(136003)(376002)(366004)(346002)(199004)(189003)(54906003)(110136005)(86362001)(956004)(107886003)(2616005)(316002)(36756003)(71200400001)(52116002)(7696005)(478600001)(8936002)(81156014)(8676002)(4326008)(81166006)(6486002)(2906002)(26005)(66946007)(16526019)(186003)(5660300002)(66574012)(1076003)(66556008)(64756008)(66446008)(85182001)(66476007)(85202003);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3934;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: 84hWzqGWJ1QhE1SrmYSgypEkOaaeTQdn8NXQkchoyXUmHZGjxLOCY6rBuJAhS9fZA87cqDY07LSKku2+SEtBaZUf0KklSeExbral24iciglBeu1uqn9omZvGnAAiavbMvaJeG2E1uoYZURCqvSxF156yZ/1cK9KY8VQnLn2gSfCeY4V/40BkJu6c1/xpDHdGzHqA/JtmJTu2CCVrvmZa9NJV+L+rlsZdWKvCMXjR75A1FO1CWp+K8yQV2yPwkvq4rOQGCKa3Ff6JVp4ShI+6+egRZkCAIxwd1/xE76WLgFjmKapBqzXVUJgro9LqoErSgnqWbPiXWAA3WTJAtEKD7pus0WNTH5xGs1U1haPqDyeACvA4Tiid57tLgcZ2ZmPd6t/gE4YFIOknHtDhAyqBnhZ7ujoeE47tuGOZdkjWQnCx4rtDCjBrbppdA7XUbQOp Content-ID: <56FD5F5330DE414795F2EEEFB06EC88C@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a440b69-4fc3-4336-755a-08d799b4301f X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 12:12:27.9104 (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: wQD690XfIUN85AzEaa1Bpah1CwqtuI0LSUumKLi5No6BKfvHgmGfXTprHDOC8PzeehtGNH7vC7fznCvByHUomg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3934 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller mac80211 and the device are both able to control tx power per vif. But, the current code retrieve tx power from wfx_config(). So, it does not allow to setup the tx power independently for each vif. Driver just has to rely on bss_conf->txpower to get the correct information. In add, it is no more necessary to protect access to wdev->output_power with scan_lock. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/scan.c | 4 ++-- drivers/staging/wfx/sta.c | 16 ++-------------- drivers/staging/wfx/wfx.h | 2 -- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index 8e0ac89fd28f..5cc9df5eb6a1 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -60,8 +60,8 @@ static int send_scan_req(struct wfx_vif *wvif, if (timeout < 0) return timeout; ret = wait_for_completion_timeout(&wvif->scan_complete, timeout); - if (req->channels[start_idx]->max_power != wvif->wdev->output_power) - hif_set_output_power(wvif, wvif->wdev->output_power); + if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower) + hif_set_output_power(wvif, wvif->vif->bss_conf.txpower); wfx_tx_unlock(wvif->wdev); if (!ret) { dev_notice(wvif->wdev->dev, "scan timeout\n"); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index dd2d0422c9ca..a0f19d33e972 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -503,7 +503,6 @@ static void wfx_do_unjoin(struct wfx_vif *wvif) hif_keep_alive_period(wvif, 0); hif_reset(wvif, false); wfx_tx_policy_init(wvif); - hif_set_output_power(wvif, wvif->wdev->output_power); wvif->dtim_period = 0; hif_set_macaddr(wvif, wvif->vif->addr); wfx_free_event_queue(wvif); @@ -990,11 +989,8 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, info->cqm_rssi_hyst); } - if (changed & BSS_CHANGED_TXPOWER && - info->txpower != wdev->output_power) { - wdev->output_power = info->txpower; - hif_set_output_power(wvif, wdev->output_power); - } + if (changed & BSS_CHANGED_TXPOWER) + hif_set_output_power(wvif, info->txpower); mutex_unlock(&wdev->conf_mutex); if (do_join) @@ -1232,7 +1228,6 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed) { int ret = 0; struct wfx_dev *wdev = hw->priv; - struct ieee80211_conf *conf = &hw->conf; struct wfx_vif *wvif; // FIXME: Interface id should not been hardcoded @@ -1242,13 +1237,7 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed) return 0; } - mutex_lock(&wvif->scan_lock); mutex_lock(&wdev->conf_mutex); - if (changed & IEEE80211_CONF_CHANGE_POWER) { - wdev->output_power = conf->power_level; - hif_set_output_power(wvif, wdev->output_power); - } - if (changed & IEEE80211_CONF_CHANGE_PS) { wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) @@ -1257,7 +1246,6 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed) } mutex_unlock(&wdev->conf_mutex); - mutex_unlock(&wvif->scan_lock); return ret; } diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index ba6e0e923f4b..155dbe5704c9 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -59,8 +59,6 @@ struct wfx_dev { struct hif_rx_stats rx_stats; struct mutex rx_stats_lock; - - int output_power; }; struct wfx_vif {