From patchwork Wed Jan 15 13:54: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: 1223551 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=silabs.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-silabs-onmicrosoft-com header.b=W7iSFbos; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47yTXS11rbz9sSf for ; Thu, 16 Jan 2020 01:02:00 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729127AbgAONyT (ORCPT ); Wed, 15 Jan 2020 08:54:19 -0500 Received: from mail-bn7nam10on2086.outbound.protection.outlook.com ([40.107.92.86]:6092 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729078AbgAONyS (ORCPT ); Wed, 15 Jan 2020 08:54:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kM+ilhkne8YDu8M5arPF0p/d9HAYQdO5z37U5xCPdRe07zw0D/+QKCN5+h7YB5Xrprdu+dqnGRJZNXugs7XE8N/W46t+J2o4RnypHnhDEB5WYmcC+8Av+WdTIv+AsFEA3U6WDvzXYd/IA9YAVWiq/jG8UoH8gsVnveF7BomHItKqMskZTDNGLyspYcG2BKpyKU6yUT84VXk1UMgqrdtHvvRAMQMCMXEIi1IYB8bul1BjPqh1+JqTRJRl9Vzqy3lDcGn1KUKMGf0L+/w7QJLCkNcxoF9r/5JM+5dyskUJc0Fg/oPTB9HDFC5IBXoARQtyOSMWRZ73aMfuOiWmoM7LJA== 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=XuNxSjj/bhLH9W58qvLUm5jIzxCdU9qJ64sx4XnPKPfVWCh2oMHdZnH90vQu0ks8RbYnKpv1XMPS3pa88u93wE8OHOwwmdDwYHKPFNp62CtvP+qDYTqkoNIwVS13Oh8XjC1kB8XaYvfGq5lWQMmXmwvjpQL871+1VMb60w0lUstYoADJA5Qr6Gcd1CDEY5kGuVXf7mwOcXtb5/2Hle93oD04zVIiCBJRAtd7/va7fAEeCvrtcyEKYSfelbRFWUQgQShFUicKt1L85PXkvOUtFFXKNdM996lrdUfpwUTcvPIMZUedrFXgwHvdm6V+yjKPUR7m7llZsFd1dZJZ+l6n5Q== 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=W7iSFbos+Rt7Qc9tDokp/hxJBJ4tuhmUF+u9lE8+BoaqsTz0I1NhT+xDipzrlNWDfP4f7WRSnQyI1/Phhp1wCFhC2CxvCP1u3bvDPXlNT6396/Xf1O5T52UPAOXnqyGV7VLHPBBixxkWPISAorLfzWeeVhImsJp5TGMuBqvSlC0= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB3661.namprd11.prod.outlook.com (20.178.252.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18; Wed, 15 Jan 2020 13:54: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 13:54:16 +0000 Received: from pc-42.home (2a01:e35:8bf5:66a0:3dbe:4cb5:6059:a948) by PR2P264CA0008.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::20) 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 13:54: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?SsOpcsO0bWUgUG91?= =?utf-8?q?iller?= Subject: [PATCH v2 10/65] staging: wfx: use specialized structs for HIF arguments Thread-Topic: [PATCH v2 10/65] staging: wfx: use specialized structs for HIF arguments Thread-Index: AQHVy6tGJtaG1F8RSkywfmX1K6FDlQ== Date: Wed, 15 Jan 2020 13:54:16 +0000 Message-ID: <20200115135338.14374-11-Jerome.Pouiller@silabs.com> References: <20200115135338.14374-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20200115135338.14374-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR2P264CA0008.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::20) 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: [2a01:e35:8bf5:66a0:3dbe:4cb5:6059:a948] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e7f13ec8-cbd3-43a6-ba9e-08d799c2691d x-ms-traffictypediagnostic: MN2PR11MB3661: 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)(39860400002)(376002)(396003)(136003)(346002)(366004)(199004)(189003)(8886007)(6486002)(316002)(54906003)(71200400001)(36756003)(6506007)(66476007)(66446008)(66946007)(110136005)(8676002)(81166006)(81156014)(478600001)(86362001)(2616005)(4326008)(2906002)(107886003)(1076003)(16526019)(186003)(85202003)(5660300002)(6512007)(52116002)(64756008)(66556008)(85182001)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR11MB3661; 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: RNaGXFzX+lbVdCV92jL/+8RIC+KZWv5sym1GEntl3CPU5RM+I2U62Wr4wn/BcXhKuXc2UOhGyyOID/dsW/Crt+bmLEsHJXH5iWEaSnD7pvYMTYZl/O2SlSNEBC9Lsh7I4kY310/urUnVN1IA8+XE+lapxlcfNyfl8DYYC19CWUBbITLfE4hDjfywolXtM2rEfJ41glPez2VRD0VTjmtHBXSkqrD7dohWDVzjRWsyavwzK6ZQ4okZZmo0BNKnETAa4YLKYTYx9eoEHI7yJOIKkftrvgk3AcN95WxscATrTKdywt4Q/yd/kWllZ0cObD76ZGxlrlWFBcYCLiXh+Ry4ktdE30Zph7Qri5BL6PRKiRUHjwYH5ezD3/Bu9Xk5rX2p1FtfCs2bLWup78pGC4tXgumezmVaARFo53J7F8KtGseB+GJ7bW1psy9BY3TBacDO Content-ID: <1D4D8BADE8AE6F47B821D5D9B00F0F4C@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7f13ec8-cbd3-43a6-ba9e-08d799c2691d X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 13:54:16.4454 (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: w7Cl+c9aJuwwCGmNeNpB/e9ZjFAUT2wrm52KCW1y3VVM2d4lFK3D2dtmbHJJZGy5EPYXtYZ7l330GWFa4H97vA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3661 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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));