From: Larry Finger <Larry.Finger@lwfinger.net>
Date: Fri, 9 May 2014 13:03:17 +0000 (+0200)
Subject: staging: rtl8723au: Move data byte-swap closer to register access
X-Git-Tag: firefly_0821_release~176^2~3465^2~39^2~1004
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d217e5dd224829a7d2a190c8119f16385f7d275a;p=firefly-linux-kernel-4.4.55.git

staging: rtl8723au: Move data byte-swap closer to register access

This makes sparse happy

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

diff --git a/drivers/staging/rtl8723au/core/rtw_io.c b/drivers/staging/rtl8723au/core/rtw_io.c
index 01022113950a..20680e0ce9e0 100644
--- a/drivers/staging/rtl8723au/core/rtw_io.c
+++ b/drivers/staging/rtl8723au/core/rtw_io.c
@@ -53,22 +53,16 @@ u8 _rtw_read823a(struct rtw_adapter *adapter, u32 addr)
 
 u16 _rtw_read1623a(struct rtw_adapter *adapter, u32 addr)
 {
-	u16 r_val;
 	struct _io_ops *io_ops = &adapter->io_ops;
 
-	r_val = io_ops->_read16(adapter, addr);
-
-	return le16_to_cpu(r_val);
+	return io_ops->_read16(adapter, addr);
 }
 
 u32 _rtw_read3223a(struct rtw_adapter *adapter, u32 addr)
 {
-	u32 r_val;
 	struct _io_ops *io_ops = &adapter->io_ops;
 
-	r_val = io_ops->_read32(adapter, addr);
-
-	return le32_to_cpu(r_val);
+	return io_ops->_read32(adapter, addr);
 }
 
 int _rtw_write823a(struct rtw_adapter *adapter, u32 addr, u8 val)
@@ -86,7 +80,6 @@ int _rtw_write1623a(struct rtw_adapter *adapter, u32 addr, u16 val)
 	struct _io_ops *io_ops = &adapter->io_ops;
 	int ret;
 
-	val = cpu_to_le16(val);
 	ret = io_ops->_write16(adapter, addr, val);
 
 	return RTW_STATUS_CODE23a(ret);
@@ -97,7 +90,6 @@ int _rtw_write3223a(struct rtw_adapter *adapter, u32 addr, u32 val)
 	struct _io_ops *io_ops = &adapter->io_ops;
 	int ret;
 
-	val = cpu_to_le32(val);
 	ret = io_ops->_write32(adapter, addr, val);
 
 	return RTW_STATUS_CODE23a(ret);
diff --git a/drivers/staging/rtl8723au/hal/usb_ops_linux.c b/drivers/staging/rtl8723au/hal/usb_ops_linux.c
index da0ef6b7e2a1..870fe5dabce4 100644
--- a/drivers/staging/rtl8723au/hal/usb_ops_linux.c
+++ b/drivers/staging/rtl8723au/hal/usb_ops_linux.c
@@ -154,7 +154,7 @@ static u16 usb_read16(struct rtw_adapter *padapter, u32 addr)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	u16 data = 0;
+	__le16 data;
 
 	request = 0x05;
 	requesttype = 0x01;/* read_in */
@@ -166,7 +166,7 @@ static u16 usb_read16(struct rtw_adapter *padapter, u32 addr)
 	usbctrl_vendorreq(padapter, request, wvalue, index, &data,
 			  len, requesttype);
 
-	return data;
+	return le16_to_cpu(data);
 }
 
 static u32 usb_read32(struct rtw_adapter *padapter, u32 addr)
@@ -176,7 +176,7 @@ static u32 usb_read32(struct rtw_adapter *padapter, u32 addr)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	u32 data = 0;
+	__le32 data;
 
 	request = 0x05;
 	requesttype = 0x01;/* read_in */
@@ -188,7 +188,7 @@ static u32 usb_read32(struct rtw_adapter *padapter, u32 addr)
 	usbctrl_vendorreq(padapter, request, wvalue, index, &data,
 			  len, requesttype);
 
-	return data;
+	return le32_to_cpu(data);
 }
 
 static int usb_write8(struct rtw_adapter *padapter, u32 addr, u8 val)
@@ -223,7 +223,7 @@ static int usb_write16(struct rtw_adapter *padapter, u32 addr, u16 val)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	u16 data;
+	__le16 data;
 	int ret;
 
 	request = 0x05;
@@ -233,7 +233,7 @@ static int usb_write16(struct rtw_adapter *padapter, u32 addr, u16 val)
 	wvalue = (u16)(addr&0x0000ffff);
 	len = 2;
 
-	data = val;
+	data = cpu_to_le16(val);
 
 	ret = usbctrl_vendorreq(padapter, request, wvalue, index, &data,
 				len, requesttype);
@@ -247,7 +247,7 @@ static int usb_write32(struct rtw_adapter *padapter, u32 addr, u32 val)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	u32 data;
+	__le32 data;
 	int ret;
 
 	request = 0x05;
@@ -256,7 +256,7 @@ static int usb_write32(struct rtw_adapter *padapter, u32 addr, u32 val)
 
 	wvalue = (u16)(addr&0x0000ffff);
 	len = 4;
-	data = val;
+	data = cpu_to_le32(val);
 
 	ret = usbctrl_vendorreq(padapter, request, wvalue, index, &data,
 				len, requesttype);