linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8192u: Improve readability and fix sparse warnings: cast from restricted __le16
@ 2017-04-22 22:55 Tuomo Rinne
  2017-04-28 10:27 ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Tuomo Rinne @ 2017-04-22 22:55 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

This patch fixes following sparse warnings:

drivers/staging/rtl8192u//r8192U_dm.c:2307:49: warning: cast from restricted __le16
drivers/staging/rtl8192u//r8192U_dm.c:2308:44: warning: cast from restricted __le16
drivers/staging/rtl8192u//r8192U_dm.c:2309:44: warning: cast from restricted __le16

In order to avoid the warnings the u4bAcParam variable is constructed
using the cpu's endianness and in case of big endian architectures the
variable is converted back to little endian before passed to write_nic_dword
function.

Also the patch improves readability by getting rid of unnecessary scope
and splitting complex variable construction to multiple lines.

Signed-off-by: Tuomo Rinne <tuomo.rinne@gmail.com>
---
 drivers/staging/rtl8192u/r8192U_dm.c | 77 ++++++++++++++++++++----------------
 1 file changed, 42 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 9209aad..c63974a 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2189,7 +2189,7 @@ static	void dm_cs_ratio(
 	struct net_device *dev)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	static u8				initialized, force_write;
+	static u8			initialized, force_write;
 	static u32			reset_cnt;
 
 	if (dm_digtable.dig_algorithm_switch) {
@@ -2295,43 +2295,50 @@ static void dm_check_edca_turbo(
 		 * Restore original EDCA according to the declaration of AP.
 		 */
 		if (priv->bcurrent_turbo_EDCA) {
+			u8	    u1bAIFS;
+			u32	    u4bAcParam, op_limit, cw_max, cw_min;
+
+			struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
+			u8 mode = priv->ieee80211->mode;
+
+			/*  For Each time updating EDCA parameter, reset EDCA turbo mode status. */
+			dm_init_edca_turbo(dev);
+			u1bAIFS = qos_parameters->aifs[0] * ((mode & (IEEE_G | IEEE_N_24G)) ? 9 : 20) + aSifsTime;
+
+			op_limit = (u32)le16_to_cpu(qos_parameters->tx_op_limit[0]);
+			cw_max   = (u32)le16_to_cpu(qos_parameters->cw_max[0]);
+			cw_min   = (u32)le16_to_cpu(qos_parameters->cw_min[0]);
+
+			op_limit <<= AC_PARAM_TXOP_LIMIT_OFFSET;
+			cw_max   <<= AC_PARAM_ECW_MAX_OFFSET;
+			cw_min   <<= AC_PARAM_ECW_MIN_OFFSET;
+			u1bAIFS  <<= AC_PARAM_AIFS_OFFSET;
+
+			u4bAcParam = op_limit | cw_max | cw_min | u1bAIFS;
+
+			cpu_to_le32s(u4bAcParam);
+			write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);
+
+			/*
+			 * Check ACM bit.
+			 * If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13.
+			 */
 			{
-				u8		u1bAIFS;
-				u32		u4bAcParam;
-				struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
-				u8 mode = priv->ieee80211->mode;
-
-				/*  For Each time updating EDCA parameter, reset EDCA turbo mode status. */
-				dm_init_edca_turbo(dev);
-				u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime;
-				u4bAcParam = (((u32)(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)|
-					(((u32)(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)|
-					(((u32)(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)|
-					((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET);
-				/*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/
-				write_nic_dword(dev, EDCAPARA_BE,  u4bAcParam);
-
-				/*
-				 * Check ACM bit.
-				 * If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13.
-				 */
-				{
-					/*  TODO:  Modified this part and try to set acm control in only 1 IO processing!! */
-
-					PACI_AIFSN	pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]);
-					u8		AcmCtrl;
-
-					read_nic_byte(dev, AcmHwCtrl, &AcmCtrl);
-
-					if (pAciAifsn->f.ACM) { /*  ACM bit is 1. */
-						AcmCtrl |= AcmHw_BeqEn;
-					} else {	/* ACM bit is 0. */
-						AcmCtrl &= (~AcmHw_BeqEn);
-					}
+				/*  TODO:  Modified this part and try to set acm control in only 1 IO processing!! */
 
-					RT_TRACE(COMP_QOS, "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl);
-					write_nic_byte(dev, AcmHwCtrl, AcmCtrl);
+				PACI_AIFSN	pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]);
+				u8		AcmCtrl;
+
+				read_nic_byte(dev, AcmHwCtrl, &AcmCtrl);
+
+				if (pAciAifsn->f.ACM) { /*  ACM bit is 1. */
+					AcmCtrl |= AcmHw_BeqEn;
+				} else {	/* ACM bit is 0. */
+					AcmCtrl &= (~AcmHw_BeqEn);
 				}
+
+				RT_TRACE(COMP_QOS, "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl);
+				write_nic_byte(dev, AcmHwCtrl, AcmCtrl);
 			}
 			priv->bcurrent_turbo_EDCA = false;
 		}
-- 
2.1.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] staging: rtl8192u: Improve readability and fix sparse warnings: cast from restricted __le16
  2017-04-22 22:55 [PATCH] staging: rtl8192u: Improve readability and fix sparse warnings: cast from restricted __le16 Tuomo Rinne
@ 2017-04-28 10:27 ` Greg KH
  2017-04-29 11:35   ` [PATCH 1/3] staging: rtl8192u: Remove unnecessary scope Tuomo Rinne
  0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2017-04-28 10:27 UTC (permalink / raw)
  To: Tuomo Rinne; +Cc: devel, linux-kernel

On Sat, Apr 22, 2017 at 11:55:23PM +0100, Tuomo Rinne wrote:
> This patch fixes following sparse warnings:
> 
> drivers/staging/rtl8192u//r8192U_dm.c:2307:49: warning: cast from restricted __le16
> drivers/staging/rtl8192u//r8192U_dm.c:2308:44: warning: cast from restricted __le16
> drivers/staging/rtl8192u//r8192U_dm.c:2309:44: warning: cast from restricted __le16
> 
> In order to avoid the warnings the u4bAcParam variable is constructed
> using the cpu's endianness and in case of big endian architectures the
> variable is converted back to little endian before passed to write_nic_dword
> function.
> 
> Also the patch improves readability by getting rid of unnecessary scope
> and splitting complex variable construction to multiple lines.

Don't do multiple things in the same patch, please break this up into
different patches, each one doing only one thing.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] staging: rtl8192u: Remove unnecessary scope
  2017-04-28 10:27 ` Greg KH
@ 2017-04-29 11:35   ` Tuomo Rinne
  2017-04-29 11:35     ` [PATCH 2/3] staging: rtl8192u: Improve code readability Tuomo Rinne
  2017-04-29 11:35     ` [PATCH 3/3] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction Tuomo Rinne
  0 siblings, 2 replies; 10+ messages in thread
From: Tuomo Rinne @ 2017-04-29 11:35 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

Remove scope unnecessary scope that is already enforced by the if
statements scope.

Signed-off-by: Tuomo Rinne <tuomo.rinne@gmail.com>
---
 drivers/staging/rtl8192u/r8192U_dm.c | 66 +++++++++++++++++-------------------
 1 file changed, 32 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 623d495..16cafb62 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2300,43 +2300,41 @@ static void dm_check_edca_turbo(
 		 * Restore original EDCA according to the declaration of AP.
 		 */
 		if (priv->bcurrent_turbo_EDCA) {
+			u8		u1bAIFS;
+			u32		u4bAcParam;
+			struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
+			u8 mode = priv->ieee80211->mode;
+
+			/*  For Each time updating EDCA parameter, reset EDCA turbo mode status. */
+			dm_init_edca_turbo(dev);
+			u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime;
+			u4bAcParam = (((le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)|
+				((le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)|
+				((le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)|
+				((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET));
+			/*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/
+			write_nic_dword(dev, EDCAPARA_BE,  u4bAcParam);
+
+			/*
+			 * Check ACM bit.
+			 * If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13.
+			 */
 			{
-				u8		u1bAIFS;
-				u32		u4bAcParam;
-				struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
-				u8 mode = priv->ieee80211->mode;
-
-				/*  For Each time updating EDCA parameter, reset EDCA turbo mode status. */
-				dm_init_edca_turbo(dev);
-				u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime;
-				u4bAcParam = (((le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)|
-					((le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)|
-					((le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)|
-					((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET));
-				/*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/
-				write_nic_dword(dev, EDCAPARA_BE,  u4bAcParam);
-
-				/*
-				 * Check ACM bit.
-				 * If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13.
-				 */
-				{
-					/*  TODO:  Modified this part and try to set acm control in only 1 IO processing!! */
-
-					PACI_AIFSN	pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]);
-					u8		AcmCtrl;
-
-					read_nic_byte(dev, AcmHwCtrl, &AcmCtrl);
-
-					if (pAciAifsn->f.ACM) { /*  ACM bit is 1. */
-						AcmCtrl |= AcmHw_BeqEn;
-					} else {	/* ACM bit is 0. */
-						AcmCtrl &= (~AcmHw_BeqEn);
-					}
+				/*  TODO:  Modified this part and try to set acm control in only 1 IO processing!! */
 
-					RT_TRACE(COMP_QOS, "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl);
-					write_nic_byte(dev, AcmHwCtrl, AcmCtrl);
+				PACI_AIFSN	pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]);
+				u8		AcmCtrl;
+
+				read_nic_byte(dev, AcmHwCtrl, &AcmCtrl);
+
+				if (pAciAifsn->f.ACM) { /*  ACM bit is 1. */
+					AcmCtrl |= AcmHw_BeqEn;
+				} else {	/* ACM bit is 0. */
+					AcmCtrl &= (~AcmHw_BeqEn);
 				}
+
+				RT_TRACE(COMP_QOS, "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl);
+				write_nic_byte(dev, AcmHwCtrl, AcmCtrl);
 			}
 			priv->bcurrent_turbo_EDCA = false;
 		}
-- 
2.1.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/3] staging: rtl8192u: Improve code readability
  2017-04-29 11:35   ` [PATCH 1/3] staging: rtl8192u: Remove unnecessary scope Tuomo Rinne
@ 2017-04-29 11:35     ` Tuomo Rinne
  2017-04-29 11:35     ` [PATCH 3/3] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction Tuomo Rinne
  1 sibling, 0 replies; 10+ messages in thread
From: Tuomo Rinne @ 2017-04-29 11:35 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

Split the u4bAcParam parameter construction to multiple lines for easier
readability.

Signed-off-by: Tuomo Rinne <tuomo.rinne@gmail.com>
---
 drivers/staging/rtl8192u/r8192U_dm.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 16cafb62..5e84ed7 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2300,20 +2300,30 @@ static void dm_check_edca_turbo(
 		 * Restore original EDCA according to the declaration of AP.
 		 */
 		if (priv->bcurrent_turbo_EDCA) {
-			u8		u1bAIFS;
-			u32		u4bAcParam;
+			u8	u1bAIFS;
+			u32	u4bAcParam, op_limit, cw_max, cw_min;
+
 			struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
 			u8 mode = priv->ieee80211->mode;
 
 			/*  For Each time updating EDCA parameter, reset EDCA turbo mode status. */
 			dm_init_edca_turbo(dev);
-			u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime;
-			u4bAcParam = (((le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)|
-				((le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)|
-				((le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)|
-				((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET));
-			/*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/
-			write_nic_dword(dev, EDCAPARA_BE,  u4bAcParam);
+
+			u1bAIFS = qos_parameters->aifs[0] * ((mode & (IEEE_G | IEEE_N_24G)) ? 9 : 20) + aSifsTime;
+
+			op_limit = (u32)le16_to_cpu(qos_parameters->tx_op_limit[0]);
+			cw_max   = (u32)le16_to_cpu(qos_parameters->cw_max[0]);
+			cw_min   = (u32)le16_to_cpu(qos_parameters->cw_min[0]);
+
+			op_limit <<= AC_PARAM_TXOP_LIMIT_OFFSET;
+			cw_max   <<= AC_PARAM_ECW_MAX_OFFSET;
+			cw_min   <<= AC_PARAM_ECW_MIN_OFFSET;
+			u1bAIFS  <<= AC_PARAM_AIFS_OFFSET;
+
+			u4bAcParam = op_limit | cw_max | cw_min | u1bAIFS;
+
+			write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);
+
 
 			/*
 			 * Check ACM bit.
-- 
2.1.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/3] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction
  2017-04-29 11:35   ` [PATCH 1/3] staging: rtl8192u: Remove unnecessary scope Tuomo Rinne
  2017-04-29 11:35     ` [PATCH 2/3] staging: rtl8192u: Improve code readability Tuomo Rinne
@ 2017-04-29 11:35     ` Tuomo Rinne
  2017-04-29 18:07       ` kbuild test robot
  1 sibling, 1 reply; 10+ messages in thread
From: Tuomo Rinne @ 2017-04-29 11:35 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

commit 9304b5b0d4fe8498d3d059db4bb8a7de253355a5 adds casting of le16
values to cpu to get rid of sparse warnings. The u4bAcParam is therefore
constructed using machines endianess. However, the parameter ought to be casted back to little endian to keep the function logic the same as before.

Unfortunately I don't have the hardware to test this change.

Signed-off-by: Tuomo Rinne <tuomo.rinne@gmail.com>
---
 drivers/staging/rtl8192u/r8192U_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 5e84ed7..dceec20 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2321,10 +2321,10 @@ static void dm_check_edca_turbo(
 			u1bAIFS  <<= AC_PARAM_AIFS_OFFSET;
 
 			u4bAcParam = op_limit | cw_max | cw_min | u1bAIFS;
+			cpu_to_le32s(u4bAcParam);
 
 			write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);
 
-
 			/*
 			 * Check ACM bit.
 			 * If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13.
-- 
2.1.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction
  2017-04-29 11:35     ` [PATCH 3/3] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction Tuomo Rinne
@ 2017-04-29 18:07       ` kbuild test robot
  2017-05-01 17:11         ` Fix kbuild warnings Tuomo Rinne
  0 siblings, 1 reply; 10+ messages in thread
From: kbuild test robot @ 2017-04-29 18:07 UTC (permalink / raw)
  To: Tuomo Rinne; +Cc: kbuild-all, gregkh, devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 5854 bytes --]

Hi Tuomo,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on next-20170428]
[cannot apply to v4.11-rc8]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Tuomo-Rinne/staging-rtl8192u-Remove-unnecessary-scope/20170430-012804
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   In file included from include/linux/byteorder/big_endian.h:4:0,
                    from arch/xtensa/include/uapi/asm/byteorder.h:7,
                    from arch/xtensa/include/asm/bitops.h:23,
                    from include/linux/bitops.h:36,
                    from include/linux/kernel.h:10,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from drivers/staging/rtl8192u/r8192U.h:21,
                    from drivers/staging/rtl8192u/r8192U_dm.c:16:
   drivers/staging/rtl8192u/r8192U_dm.c: In function 'dm_check_edca_turbo':
>> include/uapi/linux/byteorder/big_endian.h:93:27: warning: passing argument 1 of '__swab32s' makes pointer from integer without a cast
    #define __cpu_to_le32s(x) __swab32s((x))
                              ^
>> include/linux/byteorder/generic.h:111:22: note: in expansion of macro '__cpu_to_le32s'
    #define cpu_to_le32s __cpu_to_le32s
                         ^
>> drivers/staging/rtl8192u/r8192U_dm.c:2324:4: note: in expansion of macro 'cpu_to_le32s'
       cpu_to_le32s(u4bAcParam);
       ^
   In file included from include/linux/swab.h:4:0,
                    from include/uapi/linux/byteorder/big_endian.h:12,
                    from include/linux/byteorder/big_endian.h:4,
                    from arch/xtensa/include/uapi/asm/byteorder.h:7,
                    from arch/xtensa/include/asm/bitops.h:23,
                    from include/linux/bitops.h:36,
                    from include/linux/kernel.h:10,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from drivers/staging/rtl8192u/r8192U.h:21,
                    from drivers/staging/rtl8192u/r8192U_dm.c:16:
   include/uapi/linux/swab.h:241:29: note: expected '__u32 *' but argument is of type 'u32'
    static __always_inline void __swab32s(__u32 *p)
                                ^
--
   In file included from include/linux/byteorder/big_endian.h:4:0,
                    from arch/xtensa/include/uapi/asm/byteorder.h:7,
                    from arch/xtensa/include/asm/bitops.h:23,
                    from include/linux/bitops.h:36,
                    from include/linux/kernel.h:10,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from drivers/staging//rtl8192u/r8192U.h:21,
                    from drivers/staging//rtl8192u/r8192U_dm.c:16:
   drivers/staging//rtl8192u/r8192U_dm.c: In function 'dm_check_edca_turbo':
>> include/uapi/linux/byteorder/big_endian.h:93:27: warning: passing argument 1 of '__swab32s' makes pointer from integer without a cast
    #define __cpu_to_le32s(x) __swab32s((x))
                              ^
>> include/linux/byteorder/generic.h:111:22: note: in expansion of macro '__cpu_to_le32s'
    #define cpu_to_le32s __cpu_to_le32s
                         ^
   drivers/staging//rtl8192u/r8192U_dm.c:2324:4: note: in expansion of macro 'cpu_to_le32s'
       cpu_to_le32s(u4bAcParam);
       ^
   In file included from include/linux/swab.h:4:0,
                    from include/uapi/linux/byteorder/big_endian.h:12,
                    from include/linux/byteorder/big_endian.h:4,
                    from arch/xtensa/include/uapi/asm/byteorder.h:7,
                    from arch/xtensa/include/asm/bitops.h:23,
                    from include/linux/bitops.h:36,
                    from include/linux/kernel.h:10,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from drivers/staging//rtl8192u/r8192U.h:21,
                    from drivers/staging//rtl8192u/r8192U_dm.c:16:
   include/uapi/linux/swab.h:241:29: note: expected '__u32 *' but argument is of type 'u32'
    static __always_inline void __swab32s(__u32 *p)
                                ^

vim +/cpu_to_le32s +2324 drivers/staging/rtl8192u/r8192U_dm.c

  2308	
  2309				/*  For Each time updating EDCA parameter, reset EDCA turbo mode status. */
  2310				dm_init_edca_turbo(dev);
  2311	
  2312				u1bAIFS = qos_parameters->aifs[0] * ((mode & (IEEE_G | IEEE_N_24G)) ? 9 : 20) + aSifsTime;
  2313	
  2314				op_limit = (u32)le16_to_cpu(qos_parameters->tx_op_limit[0]);
  2315				cw_max   = (u32)le16_to_cpu(qos_parameters->cw_max[0]);
  2316				cw_min   = (u32)le16_to_cpu(qos_parameters->cw_min[0]);
  2317	
  2318				op_limit <<= AC_PARAM_TXOP_LIMIT_OFFSET;
  2319				cw_max   <<= AC_PARAM_ECW_MAX_OFFSET;
  2320				cw_min   <<= AC_PARAM_ECW_MIN_OFFSET;
  2321				u1bAIFS  <<= AC_PARAM_AIFS_OFFSET;
  2322	
  2323				u4bAcParam = op_limit | cw_max | cw_min | u1bAIFS;
> 2324				cpu_to_le32s(u4bAcParam);
  2325	
  2326				write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);
  2327	
  2328				/*
  2329				 * Check ACM bit.
  2330				 * If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13.
  2331				 */
  2332				{

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 49337 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Fix kbuild warnings
  2017-04-29 18:07       ` kbuild test robot
@ 2017-05-01 17:11         ` Tuomo Rinne
  2017-05-01 17:11           ` [PATCH 1/1] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction Tuomo Rinne
  0 siblings, 1 reply; 10+ messages in thread
From: Tuomo Rinne @ 2017-05-01 17:11 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

Fix kbuild warnings by passing in variable using address rather than making a copy.

Tuomo Rinne (1):
  staging: rtl8192u: Convert u4bAcParam back to little-endian after    
    construction

 drivers/staging/rtl8192u/r8192U_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/1] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction
  2017-05-01 17:11         ` Fix kbuild warnings Tuomo Rinne
@ 2017-05-01 17:11           ` Tuomo Rinne
  2017-05-01 21:34             ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Tuomo Rinne @ 2017-05-01 17:11 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel


The commit 9304b5b0d4fe ("staging: rtl8192u: Fix sparse warnings in r8192U_dm.c")
adds casting of le16 from cpu endianness.
This patch converts the u4bAcParam parameter back to little-endian after
it has been constructed.

Signed-off-by: Tuomo Rinne <tuomo.rinne@gmail.com>
---
 drivers/staging/rtl8192u/r8192U_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 283dda4..fd8225c 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2321,10 +2321,10 @@ static void dm_check_edca_turbo(
 			u1bAIFS  <<= AC_PARAM_AIFS_OFFSET;
 
 			u4bAcParam = op_limit | cw_max | cw_min | u1bAIFS;
+			cpu_to_le32s(u4bAcParam);
 
 			write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);
 
-
 			/*
 			 * Check ACM bit.
 			 * If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13.
-- 
2.1.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction
  2017-05-01 17:11           ` [PATCH 1/1] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction Tuomo Rinne
@ 2017-05-01 21:34             ` Greg KH
  2017-05-01 22:53               ` Tuomo
  0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2017-05-01 21:34 UTC (permalink / raw)
  To: Tuomo Rinne; +Cc: devel, linux-kernel

On Mon, May 01, 2017 at 06:11:58PM +0100, Tuomo Rinne wrote:
> 
> The commit 9304b5b0d4fe ("staging: rtl8192u: Fix sparse warnings in r8192U_dm.c")
> adds casting of le16 from cpu endianness.
> This patch converts the u4bAcParam parameter back to little-endian after
> it has been constructed.
> 
> Signed-off-by: Tuomo Rinne <tuomo.rinne@gmail.com>
> ---
>  drivers/staging/rtl8192u/r8192U_dm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
> index 283dda4..fd8225c 100644
> --- a/drivers/staging/rtl8192u/r8192U_dm.c
> +++ b/drivers/staging/rtl8192u/r8192U_dm.c
> @@ -2321,10 +2321,10 @@ static void dm_check_edca_turbo(
>  			u1bAIFS  <<= AC_PARAM_AIFS_OFFSET;
>  
>  			u4bAcParam = op_limit | cw_max | cw_min | u1bAIFS;
> +			cpu_to_le32s(u4bAcParam);
>  
>  			write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);
>  
> -

Why is this line removed?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction
  2017-05-01 21:34             ` Greg KH
@ 2017-05-01 22:53               ` Tuomo
  0 siblings, 0 replies; 10+ messages in thread
From: Tuomo @ 2017-05-01 22:53 UTC (permalink / raw)
  To: Greg KH; +Cc: devel, linux-kernel

On Mon, May 01, 2017 at 02:34:36PM -0700, Greg KH wrote:
> On Mon, May 01, 2017 at 06:11:58PM +0100, Tuomo Rinne wrote:
> > 
> > The commit 9304b5b0d4fe ("staging: rtl8192u: Fix sparse warnings in r8192U_dm.c")
> > adds casting of le16 from cpu endianness.
> > This patch converts the u4bAcParam parameter back to little-endian after
> > it has been constructed.
> > 
> > Signed-off-by: Tuomo Rinne <tuomo.rinne@gmail.com>
> > ---
> >  drivers/staging/rtl8192u/r8192U_dm.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
> > index 283dda4..fd8225c 100644
> > --- a/drivers/staging/rtl8192u/r8192U_dm.c
> > +++ b/drivers/staging/rtl8192u/r8192U_dm.c
> > @@ -2321,10 +2321,10 @@ static void dm_check_edca_turbo(
> >  			u1bAIFS  <<= AC_PARAM_AIFS_OFFSET;
> >  
> >  			u4bAcParam = op_limit | cw_max | cw_min | u1bAIFS;
> > +			cpu_to_le32s(u4bAcParam);
> >  
> >  			write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);
> >  
> > -
> 
> Why is this line removed?
> 
> thanks,
> 
> greg k-h

Hi,

I cleaned up the commit and resubmitted the patchset.

Thanks,
Tuomo

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-05-01 22:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-22 22:55 [PATCH] staging: rtl8192u: Improve readability and fix sparse warnings: cast from restricted __le16 Tuomo Rinne
2017-04-28 10:27 ` Greg KH
2017-04-29 11:35   ` [PATCH 1/3] staging: rtl8192u: Remove unnecessary scope Tuomo Rinne
2017-04-29 11:35     ` [PATCH 2/3] staging: rtl8192u: Improve code readability Tuomo Rinne
2017-04-29 11:35     ` [PATCH 3/3] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction Tuomo Rinne
2017-04-29 18:07       ` kbuild test robot
2017-05-01 17:11         ` Fix kbuild warnings Tuomo Rinne
2017-05-01 17:11           ` [PATCH 1/1] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction Tuomo Rinne
2017-05-01 21:34             ` Greg KH
2017-05-01 22:53               ` Tuomo

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).