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

Commit d9d1ffd4 authored by Cezary Gapinski's avatar Cezary Gapinski Committed by Greg Kroah-Hartman
Browse files

staging/ks7010: Fix type assignment for struct hostif_hdr



Sparse spits out a warnings about __le16 and unsigned short assignment.
Change the type of size and event members of struct hostif_hdr
to __le16 and correct conversion to the proper cpu type.

Signed-off-by: default avatarCezary Gapinski <gapalinux@gmail.com>
Reviewed-by: default avatarTobin C. Harding <me@tobin.cc>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c1260357
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -269,7 +269,8 @@ static int write_to_device(struct ks_wlan_private *priv, unsigned char *buffer,
	hdr = (struct hostif_hdr *)buffer;
	hdr = (struct hostif_hdr *)buffer;


	DPRINTK(4, "size=%d\n", hdr->size);
	DPRINTK(4, "size=%d\n", hdr->size);
	if (hdr->event < HIF_DATA_REQ || HIF_REQ_MAX < hdr->event) {
	if (le16_to_cpu(hdr->event) < HIF_DATA_REQ ||
	    le16_to_cpu(hdr->event) > HIF_REQ_MAX) {
		DPRINTK(1, "unknown event=%04X\n", hdr->event);
		DPRINTK(1, "unknown event=%04X\n", hdr->event);
		return 0;
		return 0;
	}
	}
@@ -327,13 +328,14 @@ int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size,


	hdr = (struct hostif_hdr *)p;
	hdr = (struct hostif_hdr *)p;


	if (hdr->event < HIF_DATA_REQ || HIF_REQ_MAX < hdr->event) {
	if (le16_to_cpu(hdr->event) < HIF_DATA_REQ ||
	    le16_to_cpu(hdr->event) > HIF_REQ_MAX) {
		DPRINTK(1, "unknown event=%04X\n", hdr->event);
		DPRINTK(1, "unknown event=%04X\n", hdr->event);
		return 0;
		return 0;
	}
	}


	/* add event to hostt buffer */
	/* add event to hostt buffer */
	priv->hostt.buff[priv->hostt.qtail] = hdr->event;
	priv->hostt.buff[priv->hostt.qtail] = le16_to_cpu(hdr->event);
	priv->hostt.qtail = (priv->hostt.qtail + 1) % SME_EVENT_BUFF_SIZE;
	priv->hostt.qtail = (priv->hostt.qtail + 1) % SME_EVENT_BUFF_SIZE;


	DPRINTK(4, "event=%04X\n", hdr->event);
	DPRINTK(4, "event=%04X\n", hdr->event);
@@ -403,7 +405,7 @@ static void ks_wlan_hw_rx(struct ks_wlan_private *priv, uint16_t size)


	hdr = (struct hostif_hdr *)&rx_buffer->data[0];
	hdr = (struct hostif_hdr *)&rx_buffer->data[0];
	rx_buffer->size = le16_to_cpu(hdr->size) + sizeof(hdr->size);
	rx_buffer->size = le16_to_cpu(hdr->size) + sizeof(hdr->size);
	event = hdr->event;
	event = le16_to_cpu(hdr->event);
	inc_rxqtail(priv);
	inc_rxqtail(priv);


	ret = ks7010_sdio_writeb(priv, READ_STATUS, REG_STATUS_IDLE);
	ret = ks7010_sdio_writeb(priv, READ_STATUS, REG_STATUS_IDLE);
+2 −2
Original line number Original line Diff line number Diff line
@@ -62,8 +62,8 @@
 */
 */


struct hostif_hdr {
struct hostif_hdr {
	u16 size;
	__le16 size;
	u16 event;
	__le16 event;
} __packed;
} __packed;


struct hostif_data_request_t {
struct hostif_data_request_t {