From patchwork Wed Jan 15 12:12:16 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: 11334145 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 13C4B139A for ; Wed, 15 Jan 2020 12:19:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D2BF4207FF for ; Wed, 15 Jan 2020 12:19:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="jPQIsgyh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731608AbgAOMT3 (ORCPT ); Wed, 15 Jan 2020 07:19:29 -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 S1730472AbgAOMMb (ORCPT ); Wed, 15 Jan 2020 07:12:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AivXb5v0EMcBrB4VV1/F39gVKJSsmR5F357bGI02YMNEs+cnNyxqqhnHq1NELDAB69hGSknxaNtDHIeMnevZWseYQanuWQN/6E07IwTP+Gc+xWLCV+XwEqotw8d5BF0/xQCeGFwr9X130Sftu/FMscBuo0h+n2l3S50CU4mjGGowsNARAPS7FXE7gFa5IYvVt8JYArI+1zYJyM6WeaUX++FG/KUZxk0zeKFjfKawwRsy7+TLD6Vni06rOWkx/5YLITSb9PmGSV7wAVCnKheezOPqQdTrOjTgKW3xI+alHxtEts4Qo5xRYJ5+aZNRYlJ+14IeSGrXezLFZ8XKSYeODw== 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=ZUo8LwBo1qK4cZ/ojBZuyySQUx8sEw77KK5ENOyqfFo=; b=WDt0KtFsaWkUYn/2+g1wlyQ0nEM4GJpVXrqQIr52jZfHgRkNj0JLJEIUZ84Xe2SOUk0akCQVONr0vAvvyzRLYtct8TSuefm64rarbV3urv2bvZ8POldhJ3HcVjN8YDQECNpgFpMnp7v5hDxFXhhZwggqlTuiTPCA3p0FP8uhKPvpht696g/NNsy1uaqViFkwRRf+rHIz0JMH8QxalhCMtYFXns9vpfegAMDgUuRULWk31LRddtfTAvN1y/NiG6Ab5QqBbzisj+thHEu3JnbAFzD8V++unVX/fxziZiKOjprd2tfSUsb1rBHfH2Oift7KYq9YOuVk3dtJB3JeCHX1vw== 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=ZUo8LwBo1qK4cZ/ojBZuyySQUx8sEw77KK5ENOyqfFo=; b=jPQIsgyh9vyzHt9IaYQCttd4MbAaQz7RlYWqZVrMtoDXiDWh5xh7nihuu14Zip3KNitns/PGRInGjwO81mlXpj0DWMKB11iMLKI8LR4qOSfybRYwIxsMgr43INtzmU7DQ3Lh96QwdhToci4EOqnOr7rEN5Iwq1X9EzAdBgdAkd8= 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:16 +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:16 +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:15 +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 06/65] staging: wfx: simplify hif_set_output_power() usage Thread-Topic: [PATCH 06/65] staging: wfx: simplify hif_set_output_power() usage Thread-Index: AQHVy50H/O483S9OBU2uPei1KFhd3g== Date: Wed, 15 Jan 2020 12:12:16 +0000 Message-ID: <20200115121041.10863-7-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: 318814c5-b1ee-4d00-5c7c-08d799b42964 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: lDHhnp3Erxe9yb7GForCB+M0qOK5KWJsIqVe0zBEEtmnpIlImywMOiHThbJLbvw3Z9+Lc+0a/xIsLBJZOXBJ9mwgEXUjcb2p9UDXXJqYicr8q6Yrr/e27Z3kytVidKkBqv8uy4Jjh8Ollt/xdA1xYHh0msLBlbbKQfKPBZ2RCjIltYLmk8e73E7mZRvznnQnLIY7rJZNBJHPhklDlyu69GMPpJk4FvN2ew5uC7aKfeUnpiOg0KExZEOuuzoOjxr2ZNRlQ6p27vH5SKYbBa38T6C64SLYrlII2X6aBztRipjGghYxkBc5DlgOBtgWHkeVo9rlY1WbzR11oRS5QqflkRP1lrNoPwe5gZ4L7rn0DYXaUBlOH72AMsXQktWBEz3MdR3nTBLPqZBrCo33yC53GMOvNju05rABZ6pmwcp5LXXcwsC9jRybZvbXN6okbKC9 Content-ID: MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 318814c5-b1ee-4d00-5c7c-08d799b42964 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 12:12:16.5529 (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: /kJWNwCHR5ViGsi6cIn2VofKs1esCVsWY6YzYRP7tvlE3mBejXgKlO9aGJU6m6y19GIAkE8FW7A7soDA1GKZZw== 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 Hardware API use 10th of dBm for output power unit. Upper layers should use same units than mac80211 and the conversion should be done by low level layer of the driver (hif_set_output_power()) In add, current code of hif_set_output_power() use a __le32 while the device API specify a specific structure for this. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_tx_mib.h | 8 +++++--- drivers/staging/wfx/scan.c | 2 +- drivers/staging/wfx/sta.c | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index ef033a409381..749df67131c3 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -15,13 +15,15 @@ #include "hif_tx.h" #include "hif_api_mib.h" -static inline int hif_set_output_power(struct wfx_vif *wvif, int power_level) +static inline int hif_set_output_power(struct wfx_vif *wvif, int val) { - __le32 val = cpu_to_le32(power_level); + struct hif_mib_current_tx_power_level arg = { + .power_level = cpu_to_le32(val * 10), + }; return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_CURRENT_TX_POWER_LEVEL, - &val, sizeof(val)); + &arg, sizeof(arg)); } static inline int hif_set_beacon_wakeup_period(struct wfx_vif *wvif, diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index 9b3674b3226a..8e0ac89fd28f 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -61,7 +61,7 @@ static int send_scan_req(struct wfx_vif *wvif, 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 * 10); + hif_set_output_power(wvif, wvif->wdev->output_power); 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 8f53a78d7215..11e33a6d5bb5 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -503,7 +503,7 @@ 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 * 10); + 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); @@ -1063,7 +1063,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, if (changed & BSS_CHANGED_TXPOWER && info->txpower != wdev->output_power) { wdev->output_power = info->txpower; - hif_set_output_power(wvif, wdev->output_power * 10); + hif_set_output_power(wvif, wdev->output_power); } mutex_unlock(&wdev->conf_mutex); @@ -1317,7 +1317,7 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed) 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 * 10); + hif_set_output_power(wvif, wdev->output_power); } if (changed & IEEE80211_CONF_CHANGE_PS) {