linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Pouiller <Jerome.Pouiller@silabs.com>
To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Kalle Valo" <kvalo@codeaurora.org>,
	"David S . Miller" <davem@davemloft.net>,
	"Jérôme Pouiller" <jerome.pouiller@silabs.com>
Subject: [PATCH 06/17] staging: wfx: fix endianness of fields media_delay and tx_queue_delay
Date: Mon, 11 May 2020 17:49:19 +0200	[thread overview]
Message-ID: <20200511154930.190212-7-Jerome.Pouiller@silabs.com> (raw)
In-Reply-To: <20200511154930.190212-1-Jerome.Pouiller@silabs.com>

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

The struct hif_cnf_tx contains only little endian values. Thus, it is
necessary to fix byte ordering before to use them. Especially, sparse
detected wrong access to fields media_delay and tx_queue_delay.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/data_tx.c | 3 ++-
 drivers/staging/wfx/traces.h  | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
index f64149ab0484..014fa36c8f78 100644
--- a/drivers/staging/wfx/data_tx.c
+++ b/drivers/staging/wfx/data_tx.c
@@ -562,7 +562,8 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg)
 
 	if (!arg->status) {
 		tx_info->status.tx_time =
-		arg->media_delay - arg->tx_queue_delay;
+			le32_to_cpu(arg->media_delay) -
+			le32_to_cpu(arg->tx_queue_delay);
 		if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
 			tx_info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
 		else
diff --git a/drivers/staging/wfx/traces.h b/drivers/staging/wfx/traces.h
index c78c46b1c990..959a0d31bf4e 100644
--- a/drivers/staging/wfx/traces.h
+++ b/drivers/staging/wfx/traces.h
@@ -387,8 +387,8 @@ TRACE_EVENT(tx_stats,
 		int i;
 
 		__entry->pkt_id = tx_cnf->packet_id;
-		__entry->delay_media = tx_cnf->media_delay;
-		__entry->delay_queue = tx_cnf->tx_queue_delay;
+		__entry->delay_media = le32_to_cpu(tx_cnf->media_delay);
+		__entry->delay_queue = le32_to_cpu(tx_cnf->tx_queue_delay);
 		__entry->delay_fw = delay;
 		__entry->ack_failures = tx_cnf->ack_failures;
 		if (!tx_cnf->status || __entry->ack_failures)
-- 
2.26.2


  parent reply	other threads:[~2020-05-11 15:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 15:49 [PATCH 00/17] staging: wfx: fix support for big-endian hosts Jerome Pouiller
2020-05-11 15:49 ` [PATCH 01/17] staging: wfx: fix use of cpu_to_le32 instead of le32_to_cpu Jerome Pouiller
2020-05-11 15:49 ` [PATCH 02/17] staging: wfx: take advantage of le32_to_cpup() Jerome Pouiller
2020-05-11 15:49 ` [PATCH 03/17] staging: wfx: fix cast operator Jerome Pouiller
2020-05-11 15:49 ` [PATCH 04/17] staging: wfx: fix wrong bytes order Jerome Pouiller
2020-05-11 15:49 ` [PATCH 05/17] staging: wfx: fix output of rx_stats on big endian hosts Jerome Pouiller
2020-05-11 15:49 ` Jerome Pouiller [this message]
2020-05-11 15:49 ` [PATCH 07/17] staging: wfx: fix endianness of hif_req_read_mib fields Jerome Pouiller
2020-05-11 15:49 ` [PATCH 08/17] staging: wfx: fix access to le32 attribute 'ps_mode_error' Jerome Pouiller
2020-05-11 15:49 ` [PATCH 09/17] staging: wfx: fix access to le32 attribute 'event_id' Jerome Pouiller
2020-05-11 15:49 ` [PATCH 10/17] staging: wfx: fix access to le32 attribute 'indication_type' Jerome Pouiller
2020-05-11 15:49 ` [PATCH 11/17] staging: wfx: declare the field 'packet_id' with native byte order Jerome Pouiller
2020-05-11 15:49 ` [PATCH 12/17] staging: wfx: fix endianness of the struct hif_ind_startup Jerome Pouiller
2020-05-11 15:49 ` [PATCH 13/17] staging: wfx: fix endianness of the field 'len' Jerome Pouiller
2020-05-11 21:59   ` kbuild test robot
2020-05-12  7:43   ` Geert Uytterhoeven
2020-05-12  9:25     ` Jérôme Pouiller
2020-05-11 15:49 ` [PATCH 14/17] staging: wfx: fix endianness of the field 'status' Jerome Pouiller
2020-05-11 15:49 ` [PATCH 15/17] staging: wfx: fix endianness of the field 'num_tx_confs' Jerome Pouiller
2020-05-11 15:49 ` [PATCH 16/17] staging: wfx: fix endianness of the field 'channel_number' Jerome Pouiller
2020-05-11 15:49 ` [PATCH 17/17] staging: wfx: update TODO Jerome Pouiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200511154930.190212-7-Jerome.Pouiller@silabs.com \
    --to=jerome.pouiller@silabs.com \
    --cc=davem@davemloft.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).