Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f1f5a00 authored by Sujith's avatar Sujith Committed by John W. Linville
Browse files

ath9k_htc: Fix sparse endian warnings



This patch fixes a bunch of endian issues that
were exposed by sparse. It's a miracle that the driver
worked at all till now.

The Lord be praised.

Signed-off-by: default avatarSujith <Sujith.Manoharan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6ce34ec1
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -124,13 +124,13 @@ struct ath9k_htc_cap_target {
struct ath9k_htc_target_vif {
	u8 index;
	u8 des_bssid[ETH_ALEN];
	enum htc_opmode opmode;
	__be32 opmode;
	u8 myaddr[ETH_ALEN];
	u8 bssid[ETH_ALEN];
	u32 flags;
	u32 flags_ext;
	u16 ps_sta;
	u16 rtsthreshold;
	__be16 rtsthreshold;
	u8 ath_cap;
	u8 node;
	s8 mcast_rate;
@@ -151,7 +151,7 @@ struct ath9k_htc_target_sta {
	u8 sta_index;
	u8 vif_index;
	u8 vif_sta;
	u16 flags; /* ATH_HTC_STA_* */
	__be16 flags; /* ATH_HTC_STA_* */
	u16 htcap;
	u8 valid;
	u16 capinfo;
@@ -191,16 +191,16 @@ struct ath9k_htc_rate {
struct ath9k_htc_target_rate {
	u8 sta_index;
	u8 isnew;
	u32 capflags;
	__be32 capflags;
	struct ath9k_htc_rate rates;
};

struct ath9k_htc_target_stats {
	u32 tx_shortretry;
	u32 tx_longretry;
	u32 tx_xretries;
	u32 ht_txunaggr_xretry;
	u32 ht_tx_xretries;
	__be32 tx_shortretry;
	__be32 tx_longretry;
	__be32 tx_xretries;
	__be32 ht_txunaggr_xretry;
	__be32 ht_tx_xretries;
} __packed;

struct ath9k_htc_vif {
+4 −2
Original line number Diff line number Diff line
@@ -26,7 +26,8 @@ static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv,
	enum ath9k_int imask = 0;
	int dtimperiod, dtimcount, sleepduration;
	int cfpperiod, cfpcount, bmiss_timeout;
	u32 nexttbtt = 0, intval, tsftu, htc_imask = 0;
	u32 nexttbtt = 0, intval, tsftu;
	__be32 htc_imask = 0;
	u64 tsf;
	int num_beacons, offset, dtim_dec_count, cfp_dec_count;
	int ret;
@@ -142,7 +143,8 @@ static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
{
	struct ath_common *common = ath9k_hw_common(priv->ah);
	enum ath9k_int imask = 0;
	u32 nexttbtt, intval, htc_imask = 0;
	u32 nexttbtt, intval;
	__be32 htc_imask = 0;
	int ret;
	u8 cmd_rsp;

+8 −6
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
	bool fastcc = true;
	struct ieee80211_channel *channel = hw->conf.channel;
	enum htc_phymode mode;
	u16 htc_mode;
	__be16 htc_mode;
	u8 cmd_rsp;
	int ret;

@@ -378,7 +378,7 @@ static int ath9k_htc_init_rate(struct ath9k_htc_priv *priv,
	priv->tgt_rate.sta_index = ista->index;
	priv->tgt_rate.isnew = 1;
	trate = priv->tgt_rate;
	priv->tgt_rate.capflags = caps;
	priv->tgt_rate.capflags = cpu_to_be32(caps);
	trate.capflags = cpu_to_be32(caps);

	WMI_CMD_BUF(WMI_RC_RATE_UPDATE_CMDID, &trate);
@@ -426,6 +426,7 @@ static void ath9k_htc_rc_update(struct ath9k_htc_priv *priv, bool is_cw40)
	struct ath9k_htc_target_rate trate;
	struct ath_common *common = ath9k_hw_common(priv->ah);
	int ret;
	u32 caps = be32_to_cpu(priv->tgt_rate.capflags);
	u8 cmd_rsp;

	memset(&trate, 0, sizeof(trate));
@@ -433,11 +434,12 @@ static void ath9k_htc_rc_update(struct ath9k_htc_priv *priv, bool is_cw40)
	trate = priv->tgt_rate;

	if (is_cw40)
		priv->tgt_rate.capflags |= WLAN_RC_40_FLAG;
		caps |= WLAN_RC_40_FLAG;
	else
		priv->tgt_rate.capflags &= ~WLAN_RC_40_FLAG;
		caps &= ~WLAN_RC_40_FLAG;

	trate.capflags = cpu_to_be32(priv->tgt_rate.capflags);
	priv->tgt_rate.capflags = cpu_to_be32(caps);
	trate.capflags = cpu_to_be32(caps);

	WMI_CMD_BUF(WMI_RC_RATE_UPDATE_CMDID, &trate);
	if (ret) {
@@ -1104,7 +1106,7 @@ static int ath9k_htc_start(struct ieee80211_hw *hw)
	struct ath9k_channel *init_channel;
	int ret = 0;
	enum htc_phymode mode;
	u16 htc_mode;
	__be16 htc_mode;
	u8 cmd_rsp;

	ath_print(common, ATH_DBG_CONFIG,
+3 −8
Original line number Diff line number Diff line
@@ -530,7 +530,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
			priv->ah->stats.avgbrssi = rxbuf->rxstatus.rs_rssi;
	}

	rx_status->mactime = rxbuf->rxstatus.rs_tstamp;
	rx_status->mactime = be64_to_cpu(rxbuf->rxstatus.rs_tstamp);
	rx_status->band = hw->conf.channel->band;
	rx_status->freq = hw->conf.channel->center_freq;
	rx_status->signal =  rxbuf->rxstatus.rs_rssi + ATH_DEFAULT_NOISE_FLOOR;
@@ -634,13 +634,8 @@ void ath9k_htc_rxep(void *drv_priv, struct sk_buff *skb,

	rxstatus = (struct ath_htc_rx_status *)skb->data;

	rxstatus->rs_tstamp = be64_to_cpu(rxstatus->rs_tstamp);
	rxstatus->rs_datalen = be16_to_cpu(rxstatus->rs_datalen);
	rxstatus->evm0 = be32_to_cpu(rxstatus->evm0);
	rxstatus->evm1 = be32_to_cpu(rxstatus->evm1);
	rxstatus->evm2 = be32_to_cpu(rxstatus->evm2);

	if (rxstatus->rs_datalen - (len - HTC_RX_FRAME_HEADER_SIZE) != 0) {
	if (be16_to_cpu(rxstatus->rs_datalen) -
	    (len - HTC_RX_FRAME_HEADER_SIZE) != 0) {
		ath_print(common, ATH_DBG_FATAL,
			  "Corrupted RX data len, dropping "
			  "(epid: %d, dlen: %d, skblen: %d)\n",
+4 −4
Original line number Diff line number Diff line
@@ -368,7 +368,7 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,
	struct htc_frame_hdr *htc_hdr;
	enum htc_endpoint_id epid;
	struct htc_endpoint *endpoint;
	u16 *msg_id;
	__be16 *msg_id;

	if (!htc_handle || !skb)
		return;
@@ -388,13 +388,13 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,

		/* Handle trailer */
		if (htc_hdr->flags & HTC_FLAGS_RECV_TRAILER) {
			if (be32_to_cpu(*(u32 *) skb->data) == 0x00C60000)
			if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000)
				/* Move past the Watchdog pattern */
				htc_hdr = (struct htc_frame_hdr *)(skb->data + 4);
		}

		/* Get the message ID */
		msg_id = (u16 *) ((void *) htc_hdr +
		msg_id = (__be16 *) ((void *) htc_hdr +
				     sizeof(struct htc_frame_hdr));

		/* Now process HTC messages */
Loading