From patchwork Mon May 11 15:49:29 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: 215655 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.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, 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 48C65C54E8E for ; Mon, 11 May 2020 15:50:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20742206DB for ; Mon, 11 May 2020 15:50:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="cpHnlbFh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730738AbgEKPuj (ORCPT ); Mon, 11 May 2020 11:50:39 -0400 Received: from mail-mw2nam12on2062.outbound.protection.outlook.com ([40.107.244.62]:17760 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730718AbgEKPuf (ORCPT ); Mon, 11 May 2020 11:50:35 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ljSRE0UWQ/I2aLx7FPewcUiT3Fpb4dTD4VyKJCVMZIhEDtpjIdWEeVO0vNsr/Du7k/No/+KW63IMqdMO0R3CAQqMXkemubxVqF6GPaVuw2mxdvt/pvU1GCY4RXKNjrzLbzT575SUYharaU19FbW1yn6VApDIzx6530tQB6D5SObO7X34L6P5Yaveq9ke+a2NQgzVIvSPWIAWMc2eeKDIcqopTh446VRqyjlpPQizPJjjnJkE53XYly93qVgA5FyQGwGkC+nBxm8Bmg0DGMNSBRImwWQ3/h6jCWejR/bYF91/BG7fWuTuiNOseSoVWjxXhW8q4cdbvCwZoibhzVS0zA== 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=Y5DYbo8vfnRWOM1AWqeRAX5SzRDmtdoARdW+TIHTLK0=; b=cAX074RzNpktt0bm3uDGP+0jPRgo6Bgx/9o/XaK7nnFw8OqrxnNSBQS9EsXTSan+Js4H87XcuQL2c6RGNMAtMha34zqJUyWi5Mbzeko1ZbNFvDZl2+QakyQ+LfQRPUSz2HCQpgttL9eDaxhMI2ozCTxvbTqc1UzA8yu2KBIKWpa09XPZqh5HsEqkX7HiAN1jAELyX3c13M/zzvcEekX+6Ngay7dDTRi9GfRkgAZ79OTU1YlCeF+dN4zu6MjmsvOxQF0ea2JO/sCQ98BTOVZbvVV//wi5vH7cJFtRltA0fMNQns0ReQwxi6kWnrOpqSoGhvNkJRjBv6kTVEutuWJzEA== 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=Y5DYbo8vfnRWOM1AWqeRAX5SzRDmtdoARdW+TIHTLK0=; b=cpHnlbFhNLVTb4oZSxi6+Ix3DS21VtnOY4SsqmI6r2L8lA61o9J+d7pNklwcJce7xGzFl5ZN6h38rTcitfc37KjgQdTwbb6BSukuDYSZp/ChmUGujBPRLNHQcYlAcEqJ26Ak2MGdh4IJaHXn48RH52+BWuigsgbPrrN/08m6/SQ= Authentication-Results: driverdev.osuosl.org; dkim=none (message not signed) header.d=none; driverdev.osuosl.org; dmarc=none action=none header.from=silabs.com; Received: from MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) by MWHPR11MB1968.namprd11.prod.outlook.com (2603:10b6:300:113::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Mon, 11 May 2020 15:50:18 +0000 Received: from MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::e055:3e6d:ff4:56da]) by MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::e055:3e6d:ff4:56da%5]) with mapi id 15.20.2979.033; Mon, 11 May 2020 15:50:18 +0000 From: Jerome Pouiller 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 16/17] staging: wfx: fix endianness of the field 'channel_number' Date: Mon, 11 May 2020 17:49:29 +0200 Message-Id: <20200511154930.190212-17-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200511154930.190212-1-Jerome.Pouiller@silabs.com> References: <20200511154930.190212-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: SN6PR2101CA0026.namprd21.prod.outlook.com (2603:10b6:805:106::36) To MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.silabs.com (82.67.86.106) by SN6PR2101CA0026.namprd21.prod.outlook.com (2603:10b6:805:106::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.2 via Frontend Transport; Mon, 11 May 2020 15:50:16 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [82.67.86.106] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ef4b35b3-206e-4781-1407-08d7f5c3013c X-MS-TrafficTypeDiagnostic: MWHPR11MB1968: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 04004D94E2 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B2II7x0R2PKwBuH9YIRALnI4MzEivi9KQ4UXbVDb8f0FQPp1Po5GEK6aZq3B+r6edUJZtsdlC6+5FyWaQW3DzFbBmHDBzYbXPHs7d4JXNO1BFjYot+SclPqZ3CY2sh+Ugij2e/TYCEKxCnLap1rWUjXBijJbOHKpfROsWE7w3Dr3tCpFrn3vABY3c9MVYThKqhxVPuOf5Ro2jxwBUZs9c+c0G2HDynhsRCatB2f0ofCsyjMvpPt8ONn0FGyJVNdys2zr8vxj17O+hOWgEq44bz15g3Y+QIImTrNcTfigwISk/8p3VaaERZAruWRhAepy6ig2Xfc/WdpGVDJQdzdtJzMG6hyqvYPYzyAvQMqS5a0yvgJ78ZAp8MbewIJSqouszGTIllJhC2HhD7x5sx9tlHLQAisiBG+6XlCITZInJIQkDXmssVDvszi4MFTnOWvIh48JT5mWqNMrlPl54XG+tJv+9uzS3bpo3WgiKTENTQnwt321TIodzYGwifzozUEK7YmIUXEr0eXxT1GMr+sYnQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1775.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(39850400004)(346002)(136003)(396003)(376002)(366004)(33430700001)(186003)(52116002)(86362001)(316002)(5660300002)(7696005)(6486002)(33440700001)(478600001)(54906003)(6666004)(4326008)(107886003)(66574014)(36756003)(16526019)(26005)(8936002)(956004)(2616005)(8676002)(1076003)(66476007)(66946007)(66556008)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: p3GLcGYYzp+Ku2CgIDJKjnX7jTvhJfCTBvfYNRmmTP15o6Uv6miZkAqyesb/4WYpT2FhF9bj+0b0D50jRaWglG4zJ9KBYUqLB1VnFyaYAD0qfzXFj0H8rgb2papgVCw4LX61MHFR24Jk6F3JqcqnI2BWSinGaKHu2HNQGEiuaQ+6RWui7KOiVPSdxFeAyx3j50Ktfl/JT3LcGmYC8i9QSPa7P+1R9UE/FcGrg8bwGZ0JHrLz5V1B5T4uxbj5nFHbl+Bjg1+TftvpknwdKaibwCTKfyIjQP5/sh6J0gaiCv57NXFG8rhDjJ8ZvBvKJQC0tTgUa3hTnpUQh6XQlUnp8MD0lPJb6uogehm08LKt99fVAlzLXN14JPQj1gcZPMjUjGhrb5OAxBUrssR6O1l17L7SDhdiOYvD3iGaiO7U2duHwoaKIeuPG6Y6ID6Ld+pdzQoeXXY/Rb4vSF3QK6Cdvlch9fYeIXZ3U+hXBVZPfzE= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef4b35b3-206e-4781-1407-08d7f5c3013c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2020 15:50:18.7295 (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: uXXT8mSljjQYIJPt4P+4FNHHMTvgBVx3IefUIxP8vI3o6/zrHlISJ42w0sJvAs4kaqiyXuw09Kq6ZbYjBtWQjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1968 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller The field 'channel_number' from the structs hif_ind_rx and hif_req_start is a __le32. Sparse complains this field is not always correctly accessed: drivers/staging/wfx/data_rx.c:95:55: warning: incorrect type in argument 1 (different base types) drivers/staging/wfx/data_rx.c:95:55: expected int chan drivers/staging/wfx/data_rx.c:95:55: got restricted __le16 const [usertype] channel_number However, the value of channel_number cannot be greater than 14 (this device only support 2.4Ghz band). So, we only have to access to the least significant byte. It is finally easier to declare it as an array of bytes and only access to the first one. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_api_cmd.h | 15 +++++++++------ drivers/staging/wfx/hif_tx.c | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h index 8c48477e8797..21cde19cff75 100644 --- a/drivers/staging/wfx/hif_api_cmd.h +++ b/drivers/staging/wfx/hif_api_cmd.h @@ -321,7 +321,8 @@ struct hif_rx_flags { struct hif_ind_rx { __le32 status; - __le16 channel_number; + u8 channel_number; + u8 reserved; u8 rxed_rate; u8 rcpi_rssi; struct hif_rx_flags rx_flags; @@ -356,7 +357,8 @@ struct hif_req_join { u8 infrastructure_bss_mode:1; u8 reserved1:7; u8 band; - __le16 channel_number; + u8 channel_number; + u8 reserved; u8 bssid[ETH_ALEN]; __le16 atim_window; u8 short_preamble:1; @@ -421,13 +423,14 @@ struct hif_ind_set_pm_mode_cmpl { struct hif_req_start { u8 mode; u8 band; - __le16 channel_number; - __le32 reserved1; + u8 channel_number; + u8 reserved1; + __le32 reserved2; __le32 beacon_interval; u8 dtim_period; u8 short_preamble:1; - u8 reserved2:7; - u8 reserved3; + u8 reserved3:7; + u8 reserved4; u8 ssid_length; u8 ssid[HIF_API_SSID_SIZE]; __le32 basic_rate_set; diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index e653ebbe5067..ecc99b765335 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -309,7 +309,7 @@ int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, body->probe_for_join = 0; else body->probe_for_join = 1; - body->channel_number = cpu_to_le16(channel->hw_value); + body->channel_number = channel->hw_value; body->beacon_interval = cpu_to_le32(conf->beacon_int); body->basic_rate_set = cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates)); @@ -435,7 +435,7 @@ int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, WARN_ON(!conf->beacon_int); body->dtim_period = conf->dtim_period; body->short_preamble = conf->use_short_preamble; - body->channel_number = cpu_to_le16(channel->hw_value); + body->channel_number = channel->hw_value; body->beacon_interval = cpu_to_le32(conf->beacon_int); body->basic_rate_set = cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates));