From patchwork Tue May 12 15:04:13 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: 215628 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, URIBL_BLOCKED, 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 49361C54E4A for ; Tue, 12 May 2020 15:05:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22B6720673 for ; Tue, 12 May 2020 15:05:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="OXSel2DH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730947AbgELPFs (ORCPT ); Tue, 12 May 2020 11:05:48 -0400 Received: from mail-eopbgr770072.outbound.protection.outlook.com ([40.107.77.72]:30085 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730810AbgELPFr (ORCPT ); Tue, 12 May 2020 11:05:47 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BfPrq+eyU8R3NwI0g9r+qXB1z9ks087Moh7kZJZgoyChlHj4102ofG0s5QQxB6SE0+EkANgmO6BfvwI8yu39GJkHszMWQzYJ/xvlorMf1ZjpU4vq06/KzQXQn92f+Anr7igjTEVidMIraBIRemxoNqnheS4VpRTRvwVjjp8meNUdkAE4h9U4/ooK37zOgHErAWSHtN+3dAd7JZ7ppsxnfUBijvX+qzyn/oKcqD06OG48U4nKd7tjpuKNLxzPWnJHvpSVtDSnG9pG+TcvEkwn004iovQG56cnHUsbPVRTPCgvPr3Jw7JBoJ4MHLlY20Jg32XShQe+o80NnSzURxz4Yg== 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=gvk01yBSZvjjbUeqrdSRgg3+2379A0GJFL5pDAE7ps8=; b=lZ9zgKS/sRUJEb1sUwWonV1NosmUYepX1uU6GQk+qaj12esTI4PqU7CFb+hTgU56FLe7JR2HuCwcWhRZmZ6hsZbFeTVBGd44HdBxqYGIhTlAu7E4YudWCcuE2jYrJL+PGOqFWAGHIItZLmSY6cXl9DMhxpYBcqJPzcM6ZrfZl3SMsJzjGjs47xE51salxygpD9uiXTJqzyiT0vO45v0QhlSG8a5hIpC3PH9loSN/ltLZpJ5Yx4nWq1OU/Q/m0PIGAX8VnQGv2DcTbJjPNeY14a+LTt9Kb66xkZ/Iefk/u3SsVcxiu1xu9W/N7SijByGL+6lRoZmjov622FKvXZaVxA== 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=gvk01yBSZvjjbUeqrdSRgg3+2379A0GJFL5pDAE7ps8=; b=OXSel2DH6OA2MSSwXgLOZWasiFJ3p4b2NcP+K7p9eiQpUten9He6sEE0o0pEArU9FyPtG8oITusrUwDq/UbfYsY3qh5i1wZFfyxbIXFq4FszVvuxyejLSeYky8fIfJtJRnb+2T+xmzwQHNZJ20o90nKmxjYDwr8nqDGkGzn+LvE= 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 MWHPR11MB1741.namprd11.prod.outlook.com (2603:10b6:300:10d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.34; Tue, 12 May 2020 15:05:03 +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; Tue, 12 May 2020 15:05:03 +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 v2 16/17] staging: wfx: fix endianness of the field 'channel_number' Date: Tue, 12 May 2020 17:04:13 +0200 Message-Id: <20200512150414.267198-17-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200512150414.267198-1-Jerome.Pouiller@silabs.com> References: <20200512150414.267198-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: DM5PR1101CA0003.namprd11.prod.outlook.com (2603:10b6:4:4c::13) 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 DM5PR1101CA0003.namprd11.prod.outlook.com (2603:10b6:4:4c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Tue, 12 May 2020 15:05:00 +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: 32b6b1da-8318-4daf-3e06-08d7f685d853 X-MS-TrafficTypeDiagnostic: MWHPR11MB1741: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0401647B7F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nmEXj89pX0n9IlkNThvMbcaEASELwm2qDy6wRpcHclC93Eg0q/7slIt7OrlGidMQ1XZSrcyCKTYxs8BVnQSKlt/WPi9rdiFaATY3MXNhNd+McjtU8dIOwW2WKajQ/+lbOIf0E11zSHcYXOaUmPTCVX0MCbxMYEpm/d4GU2j8h4Mc95EP8a6dhxKZ3cOP8xmYhEOSD3nPGo2IPAxVYhLVgnAqOcUj4ljlxah1qMGxG2LUZnyYxjTnPr9WiXtyPhWUBT4/fGBpQt8XL2M4+Mp9D+FBV0fR0O6n+Nb8Ke00qpYIDOjn1kYfFSQMLnGEhZHNqUo+iRcwNjwMGzoamuuAa/RuxUxCH2eW/AE9Bi2p4NJTQFZo07LSOw0nQOUrrVeT1prDc9y0ISpQxcQBIGiakghpRDbRcQRz9oFGQuzRGiCW+hvljrgNHJFXfnhF4k5Tz2Lbo7pD00eTwOkmS/RLhZkSwUgXbAf5RL4R3ILu98rNg5d20oHboWzDmTaUoIYDyddzT1UHGyGjiSEoo0oq3Q== 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:(396003)(366004)(376002)(39860400002)(346002)(136003)(33430700001)(54906003)(107886003)(478600001)(8676002)(5660300002)(316002)(1076003)(956004)(8936002)(2616005)(186003)(2906002)(7696005)(86362001)(4326008)(52116002)(6666004)(6486002)(66476007)(66574014)(26005)(66946007)(66556008)(33440700001)(16526019)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: h7Q7Q8a1sbzT+RGaIDJpFtl8GFD2KAg9xKDIOlHByWEcktPFuCA+z8+Ab2gXutpcLAAhNCoMHEhw4Gm0HPlgTbOlzvxIywWfwhoOVP8libpy7XE/99ni4Y4mf0ehG1xcSH17eENqEWEGcvb0QlRHhjkE9wRdRg7TYWETLICjNq9pcZM8WkZSLZ4p3qtB8EifxhiDCeAppUvr29NQujn+jLGYkcCh1GYWcUrzNO94utNGHzp+Tvnwy/qW2cr6YlXZNnP0LQs0cyyF5I1gVRKSrb1kTZHeAzW16ujI+JORyT4v6g4Up6LwzOrnRIrjAhPk6CgkfDNr2e0IM8j3dpI3s1C6RWgulbWNyLLlll5bD04AXh5nC2inx0uJZeAg1Iyn6DuESSszSmqfNCiryv6ZOwLYnd5xAMJ6DDdApgjsOMlGWyC/1w/v0tGGpT2h5NY0+NABZIa2trc2WPccV/eCzvvVqQmYOmOUtU+tzb1cke8= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32b6b1da-8318-4daf-3e06-08d7f685d853 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2020 15:05:01.9410 (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: 6B7DrXQSeR1pV7ca6Jl1roBs//5+P2kJQfoQMcPWOoGN7h6Fib7g5JeI48H07U8IRYne5mSkKJ50AEcvw0PCxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1741 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 bb776ee6689c..7f459719e7b4 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));