From patchwork Wed Jan 15 12:12:21 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: 216649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF477C33CB1 for ; Wed, 15 Jan 2020 12:20:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 71B25222C3 for ; Wed, 15 Jan 2020 12:20:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="hvpE6VqJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730237AbgAOMTy (ORCPT ); Wed, 15 Jan 2020 07:19:54 -0500 Received: from mail-bn7nam10on2050.outbound.protection.outlook.com ([40.107.92.50]:24527 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730223AbgAOMM1 (ORCPT ); Wed, 15 Jan 2020 07:12:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gJZbRQolcu1G/oxoklS7YlprRezAnmwhUujEH4xorsoXqAEGydeXElUveSdSTKMwTAofcahtB1hRoOnqWm+q/CC2fouwRop/unnPl0OGl6S8WDLUf45rnGHix/InJPwObTEwvnYpmwOxUCxP7HB2irxX4AdW32HlrwjQ+tDs4uuAxOIBqjSWd83QgD9/St1VdxUheA0Bjm5jTYcYrn4p4tkOyRBNbZ4kmg2oDdCh5nSk4CG5mpOrJnPlQSThoLgZDMPw1wXMkwRj3m0/nCVLlq+nClay7pUggVneQMF52aQqZxYVzDEi3HGIFAs5KxsZXVpp/zcGzG36zHmD1tBX7w== 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=NyI3qpeaw1sCvgNMoy3SoJLojFxutx56dQKR09Nvy+U=; b=e50kVGnCEFrDYPAckq6xODQhI/nn2/lLIJR6jt6nbJsCr2yMQPDyOQ1hHwRXYb51w10AUjtZbiWyrAe53rONjnt+Rm6jeaYbAoiHKc/cDxOgmJUsmhKT6ftRVkZjKICniOdgiu+nT2eIC+YsdWx8lPszJ3uFtI0uAh7CPnNZiw/pm5dCbvXFR2m/zi7W/EwsD546tnTJ88ekZ4sz78I5iickwY/piVHA4WWF12xuvxu+omMtITMlZtT17BcvmKTzslu+LwG9fRCJJO/UTem1aYAZSrSht1Cyy7eKIkkuhuFMdgSj5uAAzMr2z4ZHqS35wgdckqkCsdOiIZZzwqf8+A== 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=NyI3qpeaw1sCvgNMoy3SoJLojFxutx56dQKR09Nvy+U=; b=hvpE6VqJYBoqvN4QCAVMYnOFA8QtAcPDf5shP9wuAzorulrw1WQ4Ctc6XZe4yXESlEjb+sotTeA5+jiFvSIbloNfenfUA0V/J2rnAhqmbbbATkqRGXChkFukNg04vbFyyBdWrQ2+BoDboPjqFGOggybbAxhSrxXeEdWaLPufzNE= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB4096.namprd11.prod.outlook.com (20.179.150.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10; Wed, 15 Jan 2020 12:12:22 +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:22 +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:20 +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?SsOpcsO0bWUgUG91?= =?utf-8?q?iller?= Subject: [PATCH 10/65] staging: wfx: use specialized structs for HIF arguments Thread-Topic: [PATCH 10/65] staging: wfx: use specialized structs for HIF arguments Thread-Index: AQHVy50KLWYv+/f8d0mulv7JbySJsA== Date: Wed, 15 Jan 2020 12:12:21 +0000 Message-ID: <20200115121041.10863-11-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: c0716d3a-0150-4afb-4942-08d799b42c97 x-ms-traffictypediagnostic: MN2PR11MB4096: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-forefront-prvs: 02830F0362 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(39860400002)(366004)(376002)(136003)(199004)(189003)(85202003)(66946007)(66446008)(66476007)(2906002)(107886003)(66556008)(1076003)(64756008)(5660300002)(8936002)(6486002)(186003)(26005)(8676002)(316002)(81156014)(36756003)(52116002)(2616005)(7696005)(478600001)(16526019)(956004)(54906003)(110136005)(86362001)(71200400001)(85182001)(4326008)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR11MB4096; 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: /e/KnE7tQYi0c/TulMO0txoiV85ovPTTsGasNSSpBa7Y3BsCXW3Ongga3qAiaUy5t2WCzpjBr/qktzxkvA2Rh/pN/5kfxw/Fi13MJVDCe34jziITBcrikASnOasTX2MdOTU5XjZRy5Y7/HJ+y0QYvfY6ynJxUjYBQcCK9izMMKB8HaNcepN29wAp8BjsfJkSM94VDS6NhUeQFE2DlMrS7EEjMSUDJleFSj6QCe1s207sR74DiNALgZFqmUSbyJpjPx0W8Q3vBR0Y43iB/oR5sWSeiv+mVaz9bpdEfeOpzCyrmY6rQf3uc2o3+WGh+Cg5uw6M0i6+2VZV0BaRLpbgHiounN7ZUyiDAg/FZe6+2KpveMbEVCjznoHqCgp3lsMP3Mf5f66NOsvDvQ7Eni4+4ns2qVYjLiXXoyQNMtcdmE/osYDmQq1fBD8zKsmRhCk7 Content-ID: <153D7851AA9F7A40BC023E6052A3DC3E@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0716d3a-0150-4afb-4942-08d799b42c97 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 12:12:21.9508 (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: ILG0zpONQ+tkYp4QMD1YiYwBnlgob4Bi5oiQPVzrWD81xWoRkpkaqWg9cjuDKvsEuzOPFPoDBvuPsRqQTRjEoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4096 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Most of the commands that are sent to device should take struct in argument. In the current code, when this struct is binary compatible with a __le32, the driver use a __le32. This behavior is error prone. This patch fixes that and uses the specialized structs instead. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_tx.c | 4 ++-- drivers/staging/wfx/hif_tx_mib.h | 27 ++++++++++++++++++--------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index be3138590a4f..2d541601e224 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -432,14 +432,14 @@ int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, return ret; } -int hif_beacon_transmit(struct wfx_vif *wvif, bool enable_beaconing) +int hif_beacon_transmit(struct wfx_vif *wvif, bool enable) { int ret; struct hif_msg *hif; struct hif_req_beacon_transmit *body = wfx_alloc_hif(sizeof(*body), &hif); - body->enable_beaconing = enable_beaconing ? 1 : 0; + body->enable_beaconing = enable ? 1 : 0; wfx_fill_header(hif, wvif->id, HIF_REQ_ID_BEACON_TRANSMIT, sizeof(*body)); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index a325c870b4ea..5b39200bd697 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -278,10 +278,11 @@ static inline int hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, &arg, sizeof(arg)); } -static inline int hif_use_multi_tx_conf(struct wfx_dev *wdev, - bool enabled) +static inline int hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable) { - __le32 arg = enabled ? cpu_to_le32(1) : 0; + struct hif_mib_gl_set_multi_msg arg = { + .enable_multi_tx_conf = enable, + }; return hif_write_mib(wdev, -1, HIF_MIB_ID_GL_SET_MULTI_MSG, &arg, sizeof(arg)); @@ -306,7 +307,9 @@ static inline int hif_set_uapsd_info(struct wfx_vif *wvif, unsigned long val) static inline int hif_erp_use_protection(struct wfx_vif *wvif, bool enable) { - __le32 arg = enable ? cpu_to_le32(1) : 0; + struct hif_mib_non_erp_protection arg = { + .use_cts_to_self = enable, + }; return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_NON_ERP_PROTECTION, &arg, sizeof(arg)); @@ -314,16 +317,18 @@ static inline int hif_erp_use_protection(struct wfx_vif *wvif, bool enable) static inline int hif_slot_time(struct wfx_vif *wvif, int val) { - __le32 arg = cpu_to_le32(val); + struct hif_mib_slot_time arg = { + .slot_time = cpu_to_le32(val), + }; return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SLOT_TIME, &arg, sizeof(arg)); } -static inline int hif_dual_cts_protection(struct wfx_vif *wvif, bool val) +static inline int hif_dual_cts_protection(struct wfx_vif *wvif, bool enable) { struct hif_mib_set_ht_protection arg = { - .dual_cts_prot = val, + .dual_cts_prot = enable, }; return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SET_HT_PROTECTION, @@ -332,7 +337,9 @@ static inline int hif_dual_cts_protection(struct wfx_vif *wvif, bool val) static inline int hif_wep_default_key_id(struct wfx_vif *wvif, int val) { - __le32 arg = cpu_to_le32(val); + struct hif_mib_wep_default_key_id arg = { + .wep_default_key_id = val, + }; return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID, @@ -341,7 +348,9 @@ static inline int hif_wep_default_key_id(struct wfx_vif *wvif, int val) static inline int hif_rts_threshold(struct wfx_vif *wvif, int val) { - __le32 arg = cpu_to_le32(val > 0 ? val : 0xFFFF); + struct hif_mib_dot11_rts_threshold arg = { + .threshold = cpu_to_le32(val > 0 ? val : 0xFFFF), + }; return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_DOT11_RTS_THRESHOLD, &arg, sizeof(arg));