All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] staging: vt6655: Fix CamelCase in upc.h and started in mac.h
@ 2022-04-11 20:49 Philipp Hortmann
  2022-04-11 20:49 ` [PATCH v3 1/7] staging: vt6655: Replace VNSvInPortB with ioread8 Philipp Hortmann
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Philipp Hortmann @ 2022-04-11 20:49 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Start fix CamelCase or do-while{0} issues in macros by
- replacing macros with command used in macros
as CamelCase or do-while{0} are not accepted by checkpatch.pl

---
V1 -> V2: Merged first two patches into one.
          Patch 6/6: changed from (macro to function) to delete macro
          Updated cover-letter description
V2 -> V3: Removed first two patches as they were accepted.
          Replaced macros with command used in macros.
          Replaced only one macro per patch
          Updated cover-letter description        

Tested with vt6655 on mini PCI Module
Transferred this patch over vt6655

Philipp Hortmann (7):
  staging: vt6655: Replace VNSvInPortB with ioread8
  staging: vt6655: Replace VNSvInPortW with ioread16
  staging: vt6655: Replace VNSvInPortD with ioread32
  staging: vt6655: Replace VNSvOutPortB with iowrite8
  staging: vt6655: Replace VNSvOutPortW with iowrite16
  staging: vt6655: Replace VNSvOutPortD with iowrite32
  staging: vt6655: Remove macro PCAvDelayByIO

 drivers/staging/vt6655/baseband.c    |  16 +--
 drivers/staging/vt6655/card.c        |  73 ++++++--------
 drivers/staging/vt6655/channel.c     |   6 +-
 drivers/staging/vt6655/device_main.c |  40 +++-----
 drivers/staging/vt6655/mac.h         | 139 ++++++++++++---------------
 drivers/staging/vt6655/power.c       |   4 +-
 drivers/staging/vt6655/rf.c          |  14 +--
 drivers/staging/vt6655/rxtx.c        |   4 +-
 drivers/staging/vt6655/srom.c        |  18 ++--
 drivers/staging/vt6655/upc.h         |  31 ------
 10 files changed, 138 insertions(+), 207 deletions(-)

-- 
2.25.1


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

* [PATCH v3 1/7] staging: vt6655: Replace VNSvInPortB with ioread8
  2022-04-11 20:49 [PATCH v3 0/7] staging: vt6655: Fix CamelCase in upc.h and started in mac.h Philipp Hortmann
@ 2022-04-11 20:49 ` Philipp Hortmann
  2022-04-12 13:44   ` Greg Kroah-Hartman
  2022-04-11 20:49 ` [PATCH v3 2/7] staging: vt6655: Replace VNSvInPortW with ioread16 Philipp Hortmann
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Philipp Hortmann @ 2022-04-11 20:49 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Replace macro VNSvInPortB with ioread8.
The name of macro and the arguments use CamelCase which
is not accepted by checkpatch.pl

Since there are more than one checkpatch issue per line,
more steps are rquired to fix.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: This patch was 4/7 and is now 3/6
V2 -> V3: Changed from rename macro arguments to replace
          macro VNSvInPortB with ioread8
          This patch was 3/6 and is now 1/7
---
 drivers/staging/vt6655/baseband.c    |  6 +++---
 drivers/staging/vt6655/card.c        |  2 +-
 drivers/staging/vt6655/device_main.c |  4 ++--
 drivers/staging/vt6655/mac.h         | 26 ++++++++++----------------
 drivers/staging/vt6655/srom.c        |  6 +++---
 drivers/staging/vt6655/upc.h         |  3 ---
 6 files changed, 19 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
index dfdb0ebf43b5..decb55e96f02 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -1916,13 +1916,13 @@ bool bb_read_embedded(struct vnt_private *priv, unsigned char by_bb_addr,
 	MACvRegBitsOn(iobase, MAC_REG_BBREGCTL, BBREGCTL_REGR);
 	/* W_MAX_TIMEOUT is the timeout period */
 	for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
-		VNSvInPortB(iobase + MAC_REG_BBREGCTL, &by_value);
+		by_value = ioread8(iobase + MAC_REG_BBREGCTL);
 		if (by_value & BBREGCTL_DONE)
 			break;
 	}
 
 	/* get BB data */
-	VNSvInPortB(iobase + MAC_REG_BBREGDATA, pby_data);
+	*pby_data = ioread8(iobase + MAC_REG_BBREGDATA);
 
 	if (ww == W_MAX_TIMEOUT) {
 		pr_debug(" DBG_PORT80(0x30)\n");
@@ -1961,7 +1961,7 @@ bool bb_write_embedded(struct vnt_private *priv, unsigned char by_bb_addr,
 	MACvRegBitsOn(iobase, MAC_REG_BBREGCTL, BBREGCTL_REGW);
 	/* W_MAX_TIMEOUT is the timeout period */
 	for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
-		VNSvInPortB(iobase + MAC_REG_BBREGCTL, &by_value);
+		by_value = ioread8(iobase + MAC_REG_BBREGCTL);
 		if (by_value & BBREGCTL_DONE)
 			break;
 	}
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 1110366fc415..1ccf08b1fd5c 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -748,7 +748,7 @@ bool CARDbGetCurrentTSF(struct vnt_private *priv, u64 *pqwCurrTSF)
 
 	MACvRegBitsOn(iobase, MAC_REG_TFTCTL, TFTCTL_TSFCNTRRD);
 	for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
-		VNSvInPortB(iobase + MAC_REG_TFTCTL, &data);
+		data = ioread8(iobase + MAC_REG_TFTCTL);
 		if (!(data & TFTCTL_TSFCNTRRD))
 			break;
 	}
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 897d70cf32b8..16b031c31925 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -219,7 +219,7 @@ static void device_init_registers(struct vnt_private *priv)
 	MACvInitialize(priv);
 
 	/* Get Local ID */
-	VNSvInPortB(priv->port_offset + MAC_REG_LOCALID, &priv->local_id);
+	priv->local_id = ioread8(priv->port_offset + MAC_REG_LOCALID);
 
 	spin_lock_irqsave(&priv->lock, flags);
 
@@ -1513,7 +1513,7 @@ static void vnt_configure(struct ieee80211_hw *hw,
 
 	*total_flags &= FIF_ALLMULTI | FIF_OTHER_BSS | FIF_BCN_PRBRESP_PROMISC;
 
-	VNSvInPortB(priv->port_offset + MAC_REG_RCR, &rx_mode);
+	rx_mode = ioread8(priv->port_offset + MAC_REG_RCR);
 
 	dev_dbg(&priv->pcid->dev, "rx mode in = %x\n", rx_mode);
 
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 6221351c6400..88bf5dba9b43 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -541,7 +541,7 @@
 #define MACvRegBitsOn(iobase, byRegOfs, byBits)			\
 do {									\
 	unsigned char byData;						\
-	VNSvInPortB(iobase + byRegOfs, &byData);			\
+	byData = ioread8(iobase + byRegOfs);			\
 	VNSvOutPortB(iobase + byRegOfs, byData | (byBits));		\
 } while (0)
 
@@ -555,7 +555,7 @@ do {									\
 #define MACvRegBitsOff(iobase, byRegOfs, byBits)			\
 do {									\
 	unsigned char byData;						\
-	VNSvInPortB(iobase + byRegOfs, &byData);			\
+	byData = ioread8(iobase + byRegOfs);			\
 	VNSvOutPortB(iobase + byRegOfs, byData & ~(byBits));		\
 } while (0)
 
@@ -597,18 +597,12 @@ do {								\
 #define MACvReadEtherAddress(iobase, pbyEtherAddr)		\
 do {								\
 	VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1);		\
-	VNSvInPortB(iobase + MAC_REG_PAR0,			\
-		    (unsigned char *)pbyEtherAddr);		\
-	VNSvInPortB(iobase + MAC_REG_PAR0 + 1,		\
-		    pbyEtherAddr + 1);				\
-	VNSvInPortB(iobase + MAC_REG_PAR0 + 2,		\
-		    pbyEtherAddr + 2);				\
-	VNSvInPortB(iobase + MAC_REG_PAR0 + 3,		\
-		    pbyEtherAddr + 3);				\
-	VNSvInPortB(iobase + MAC_REG_PAR0 + 4,		\
-		    pbyEtherAddr + 4);				\
-	VNSvInPortB(iobase + MAC_REG_PAR0 + 5,		\
-		    pbyEtherAddr + 5);				\
+	(*((unsigned char *)pbyEtherAddr) = ioread8(iobase + MAC_REG_PAR0));		\
+	(*(pbyEtherAddr + 1) = ioread8(iobase + MAC_REG_PAR0 + 1));	\
+	(*(pbyEtherAddr + 2) = ioread8(iobase + MAC_REG_PAR0 + 2));	\
+	(*(pbyEtherAddr + 3) = ioread8(iobase + MAC_REG_PAR0 + 3));	\
+	(*(pbyEtherAddr + 4) = ioread8(iobase + MAC_REG_PAR0 + 4));	\
+	(*(pbyEtherAddr + 5) = ioread8(iobase + MAC_REG_PAR0 + 5));	\
 	VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 0);		\
 } while (0)
 
@@ -668,7 +662,7 @@ do {									\
 #define MACvClearStckDS(iobase)					\
 do {									\
 	unsigned char byOrgValue;					\
-	VNSvInPortB(iobase + MAC_REG_STICKHW, &byOrgValue);		\
+	byOrgValue = ioread8(iobase + MAC_REG_STICKHW);		\
 	byOrgValue = byOrgValue & 0xFC;					\
 	VNSvOutPortB(iobase + MAC_REG_STICKHW, byOrgValue);		\
 } while (0)
@@ -736,7 +730,7 @@ do {									\
 } while (0)
 
 #define MACvGPIOIn(iobase, pbyValue)					\
-	VNSvInPortB(iobase + MAC_REG_GPIOCTL1, pbyValue)
+	*(pbyValue) = ioread8(iobase + MAC_REG_GPIOCTL1)
 
 #define MACvSetRFLE_LatchBase(iobase)                                 \
 	MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_RFLEOPT)
diff --git a/drivers/staging/vt6655/srom.c b/drivers/staging/vt6655/srom.c
index 5cdbc24e8c45..a0432bacb6a0 100644
--- a/drivers/staging/vt6655/srom.c
+++ b/drivers/staging/vt6655/srom.c
@@ -66,7 +66,7 @@ unsigned char SROMbyReadEmbedded(void __iomem *iobase,
 	unsigned char byOrg;
 
 	byData = 0xFF;
-	VNSvInPortB(iobase + MAC_REG_I2MCFG, &byOrg);
+	byOrg = ioread8(iobase + MAC_REG_I2MCFG);
 	/* turn off hardware retry for getting NACK */
 	VNSvOutPortB(iobase + MAC_REG_I2MCFG, (byOrg & (~I2MCFG_NORETRY)));
 	for (wNoACK = 0; wNoACK < W_MAX_I2CRETRY; wNoACK++) {
@@ -77,7 +77,7 @@ unsigned char SROMbyReadEmbedded(void __iomem *iobase,
 		VNSvOutPortB(iobase + MAC_REG_I2MCSR, I2MCSR_EEMR);
 		/* wait DONE be set */
 		for (wDelay = 0; wDelay < W_MAX_TIMEOUT; wDelay++) {
-			VNSvInPortB(iobase + MAC_REG_I2MCSR, &byWait);
+			byWait = ioread8(iobase + MAC_REG_I2MCSR);
 			if (byWait & (I2MCSR_DONE | I2MCSR_NACK))
 				break;
 			PCAvDelayByIO(CB_DELAY_LOOP_WAIT);
@@ -87,7 +87,7 @@ unsigned char SROMbyReadEmbedded(void __iomem *iobase,
 			break;
 		}
 	}
-	VNSvInPortB(iobase + MAC_REG_I2MDIPT, &byData);
+	byData = ioread8(iobase + MAC_REG_I2MDIPT);
 	VNSvOutPortB(iobase + MAC_REG_I2MCFG, byOrg);
 	return byData;
 }
diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h
index b374db5fca81..44d746de6344 100644
--- a/drivers/staging/vt6655/upc.h
+++ b/drivers/staging/vt6655/upc.h
@@ -20,9 +20,6 @@
 
 /* For memory mapped IO */
 
-#define VNSvInPortB(dwIOAddress, pbyData) \
-	(*(pbyData) = ioread8(dwIOAddress))
-
 #define VNSvInPortW(dwIOAddress, pwData) \
 	(*(pwData) = ioread16(dwIOAddress))
 
-- 
2.25.1


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

* [PATCH v3 2/7] staging: vt6655: Replace VNSvInPortW with ioread16
  2022-04-11 20:49 [PATCH v3 0/7] staging: vt6655: Fix CamelCase in upc.h and started in mac.h Philipp Hortmann
  2022-04-11 20:49 ` [PATCH v3 1/7] staging: vt6655: Replace VNSvInPortB with ioread8 Philipp Hortmann
@ 2022-04-11 20:49 ` Philipp Hortmann
  2022-04-11 20:49 ` [PATCH v3 3/7] staging: vt6655: Replace VNSvInPortD with ioread32 Philipp Hortmann
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Philipp Hortmann @ 2022-04-11 20:49 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Replace macro VNSvInPortW with ioread16.
The name of macro and the arguments use CamelCase which
is not accepted by checkpatch.pl

Since there are more than one checkpatch issue per line,
more steps are rquired to fix.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: This patch was 5/7 and is now 4/6
V2 -> V3: Changed from
          "Rename macros VNSvInPortB,W,D with CamelCase ..." to
          Replace VNSvInPortW with ioread16
          This patch was 4/6 and is now 2/7
---
 drivers/staging/vt6655/mac.h | 4 ++--
 drivers/staging/vt6655/upc.h | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 88bf5dba9b43..4e7875ff9ff3 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -548,7 +548,7 @@ do {									\
 #define MACvWordRegBitsOn(iobase, byRegOfs, wBits)			\
 do {									\
 	unsigned short wData;						\
-	VNSvInPortW(iobase + byRegOfs, &wData);			\
+	wData = ioread16(iobase + byRegOfs);			\
 	VNSvOutPortW(iobase + byRegOfs, wData | (wBits));		\
 } while (0)
 
@@ -562,7 +562,7 @@ do {									\
 #define MACvWordRegBitsOff(iobase, byRegOfs, wBits)			\
 do {									\
 	unsigned short wData;						\
-	VNSvInPortW(iobase + byRegOfs, &wData);			\
+	wData = ioread16(iobase + byRegOfs);			\
 	VNSvOutPortW(iobase + byRegOfs, wData & ~(wBits));		\
 } while (0)
 
diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h
index 44d746de6344..99bf7aeb56f7 100644
--- a/drivers/staging/vt6655/upc.h
+++ b/drivers/staging/vt6655/upc.h
@@ -20,9 +20,6 @@
 
 /* For memory mapped IO */
 
-#define VNSvInPortW(dwIOAddress, pwData) \
-	(*(pwData) = ioread16(dwIOAddress))
-
 #define VNSvInPortD(dwIOAddress, pdwData) \
 	(*(pdwData) = ioread32(dwIOAddress))
 
-- 
2.25.1


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

* [PATCH v3 3/7] staging: vt6655: Replace VNSvInPortD with ioread32
  2022-04-11 20:49 [PATCH v3 0/7] staging: vt6655: Fix CamelCase in upc.h and started in mac.h Philipp Hortmann
  2022-04-11 20:49 ` [PATCH v3 1/7] staging: vt6655: Replace VNSvInPortB with ioread8 Philipp Hortmann
  2022-04-11 20:49 ` [PATCH v3 2/7] staging: vt6655: Replace VNSvInPortW with ioread16 Philipp Hortmann
@ 2022-04-11 20:49 ` Philipp Hortmann
  2022-04-11 20:49 ` [PATCH v3 4/7] staging: vt6655: Replace VNSvOutPortB with iowrite8 Philipp Hortmann
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Philipp Hortmann @ 2022-04-11 20:49 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Replace macro VNSvInPortD with ioread32.
The name of macro and the arguments use CamelCase which
is not accepted by checkpatch.pl

Since there are more than one checkpatch issue per line,
more steps are rquired to fix.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: This patch was 5/7 and is now 4/6
V2 -> V3: Inserted patch that was before in a different way in
          "Rename macros VNSvInPortB,W,D with CamelCase ..."
          This patch was part of 4/6 and is now 3/7
---
 drivers/staging/vt6655/card.c |  4 ++--
 drivers/staging/vt6655/mac.h  | 22 +++++++++++-----------
 drivers/staging/vt6655/rf.c   |  2 +-
 drivers/staging/vt6655/upc.h  |  3 ---
 4 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 1ccf08b1fd5c..f6d2a7fadc18 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -754,8 +754,8 @@ bool CARDbGetCurrentTSF(struct vnt_private *priv, u64 *pqwCurrTSF)
 	}
 	if (ww == W_MAX_TIMEOUT)
 		return false;
-	VNSvInPortD(iobase + MAC_REG_TSFCNTR, (u32 *)pqwCurrTSF);
-	VNSvInPortD(iobase + MAC_REG_TSFCNTR + 4, (u32 *)pqwCurrTSF + 1);
+	*((u32 *)pqwCurrTSF) = ioread32(iobase + MAC_REG_TSFCNTR);
+	*((u32 *)pqwCurrTSF + 1) = ioread32(iobase + MAC_REG_TSFCNTR + 4);
 
 	return true;
 }
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 4e7875ff9ff3..114d1f9c2a1a 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -619,7 +619,7 @@ do {								\
 #define MACvReceive0(iobase)						\
 do {									\
 	unsigned long dwData;						\
-	VNSvInPortD(iobase + MAC_REG_RXDMACTL0, &dwData);		\
+	dwData = ioread32(iobase + MAC_REG_RXDMACTL0);		\
 	if (dwData & DMACTL_RUN)					\
 		VNSvOutPortD(iobase + MAC_REG_RXDMACTL0, DMACTL_WAKE); \
 	else								\
@@ -629,7 +629,7 @@ do {									\
 #define MACvReceive1(iobase)						\
 do {									\
 	unsigned long dwData;						\
-	VNSvInPortD(iobase + MAC_REG_RXDMACTL1, &dwData);		\
+	dwData = ioread32(iobase + MAC_REG_RXDMACTL1);		\
 	if (dwData & DMACTL_RUN)					\
 		VNSvOutPortD(iobase + MAC_REG_RXDMACTL1, DMACTL_WAKE); \
 	else								\
@@ -639,7 +639,7 @@ do {									\
 #define MACvTransmit0(iobase)						\
 do {									\
 	unsigned long dwData;						\
-	VNSvInPortD(iobase + MAC_REG_TXDMACTL0, &dwData);		\
+	dwData = ioread32(iobase + MAC_REG_TXDMACTL0);		\
 	if (dwData & DMACTL_RUN)					\
 		VNSvOutPortD(iobase + MAC_REG_TXDMACTL0, DMACTL_WAKE); \
 	else								\
@@ -649,7 +649,7 @@ do {									\
 #define MACvTransmitAC0(iobase)					\
 do {									\
 	unsigned long dwData;						\
-	VNSvInPortD(iobase + MAC_REG_AC0DMACTL, &dwData);		\
+	dwData = ioread32(iobase + MAC_REG_AC0DMACTL);		\
 	if (dwData & DMACTL_RUN)					\
 		VNSvOutPortD(iobase + MAC_REG_AC0DMACTL, DMACTL_WAKE); \
 	else								\
@@ -668,7 +668,7 @@ do {									\
 } while (0)
 
 #define MACvReadISR(iobase, pdwValue)				\
-	VNSvInPortD(iobase + MAC_REG_ISR, pdwValue)
+	*(pdwValue) = ioread32(iobase + MAC_REG_ISR)
 
 #define MACvWriteISR(iobase, dwValue)				\
 	VNSvOutPortD(iobase + MAC_REG_ISR, dwValue)
@@ -686,12 +686,12 @@ do {									\
 	VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1)
 
 #define MACvReadMIBCounter(iobase, pdwCounter)			\
-	VNSvInPortD(iobase + MAC_REG_MIBCNTR, pdwCounter)
+	*(pdwCounter) = ioread32(iobase + MAC_REG_MIBCNTR)
 
 #define MACvEnableProtectMD(iobase)					\
 do {									\
 	unsigned long dwOrgValue;					\
-	VNSvInPortD(iobase + MAC_REG_ENCFG, &dwOrgValue);		\
+	dwOrgValue = ioread32(iobase + MAC_REG_ENCFG);		\
 	dwOrgValue = dwOrgValue | ENCFG_PROTECTMD;			\
 	VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue);		\
 } while (0)
@@ -699,7 +699,7 @@ do {									\
 #define MACvDisableProtectMD(iobase)					\
 do {									\
 	unsigned long dwOrgValue;					\
-	VNSvInPortD(iobase + MAC_REG_ENCFG, &dwOrgValue);		\
+	dwOrgValue = ioread32(iobase + MAC_REG_ENCFG);		\
 	dwOrgValue = dwOrgValue & ~ENCFG_PROTECTMD;			\
 	VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue);		\
 } while (0)
@@ -707,7 +707,7 @@ do {									\
 #define MACvEnableBarkerPreambleMd(iobase)				\
 do {									\
 	unsigned long dwOrgValue;					\
-	VNSvInPortD(iobase + MAC_REG_ENCFG, &dwOrgValue);		\
+	dwOrgValue = ioread32(iobase + MAC_REG_ENCFG);		\
 	dwOrgValue = dwOrgValue | ENCFG_BARKERPREAM;			\
 	VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue);		\
 } while (0)
@@ -715,7 +715,7 @@ do {									\
 #define MACvDisableBarkerPreambleMd(iobase)				\
 do {									\
 	unsigned long dwOrgValue;					\
-	VNSvInPortD(iobase + MAC_REG_ENCFG, &dwOrgValue);		\
+	dwOrgValue = ioread32(iobase + MAC_REG_ENCFG);		\
 	dwOrgValue = dwOrgValue & ~ENCFG_BARKERPREAM;			\
 	VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue);		\
 } while (0)
@@ -723,7 +723,7 @@ do {									\
 #define MACvSetBBType(iobase, byTyp)					\
 do {									\
 	unsigned long dwOrgValue;					\
-	VNSvInPortD(iobase + MAC_REG_ENCFG, &dwOrgValue);		\
+	dwOrgValue = ioread32(iobase + MAC_REG_ENCFG);		\
 	dwOrgValue = dwOrgValue & ~ENCFG_BBTYPE_MASK;			\
 	dwOrgValue = dwOrgValue | (unsigned long)byTyp;			\
 	VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue);		\
diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c
index 4498c9d400f2..036f48572334 100644
--- a/drivers/staging/vt6655/rf.c
+++ b/drivers/staging/vt6655/rf.c
@@ -175,7 +175,7 @@ bool IFRFbWriteEmbedded(struct vnt_private *priv, unsigned long dwData)
 
 	/* W_MAX_TIMEOUT is the timeout period */
 	for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
-		VNSvInPortD(iobase + MAC_REG_IFREGCTL, &dwValue);
+		dwValue = ioread32(iobase + MAC_REG_IFREGCTL);
 		if (dwValue & IFREGCTL_DONE)
 			break;
 	}
diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h
index 99bf7aeb56f7..9617667f1a69 100644
--- a/drivers/staging/vt6655/upc.h
+++ b/drivers/staging/vt6655/upc.h
@@ -20,9 +20,6 @@
 
 /* For memory mapped IO */
 
-#define VNSvInPortD(dwIOAddress, pdwData) \
-	(*(pdwData) = ioread32(dwIOAddress))
-
 #define VNSvOutPortB(dwIOAddress, byData) \
 	iowrite8((u8)(byData), dwIOAddress)
 
-- 
2.25.1


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

* [PATCH v3 4/7] staging: vt6655: Replace VNSvOutPortB with iowrite8
  2022-04-11 20:49 [PATCH v3 0/7] staging: vt6655: Fix CamelCase in upc.h and started in mac.h Philipp Hortmann
                   ` (2 preceding siblings ...)
  2022-04-11 20:49 ` [PATCH v3 3/7] staging: vt6655: Replace VNSvInPortD with ioread32 Philipp Hortmann
@ 2022-04-11 20:49 ` Philipp Hortmann
  2022-04-12  6:37   ` Dan Carpenter
  2022-04-11 20:49 ` [PATCH v3 5/7] staging: vt6655: Replace VNSvOutPortW with iowrite16 Philipp Hortmann
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Philipp Hortmann @ 2022-04-11 20:49 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Replace macro VNSvOutPortB with iowrite8.
The name of macro and the arguments use CamelCase which
is not accepted by checkpatch.pl

For constants from 0 to below 0x80 the u8 cast was omitted.
For variables which are defined as unsigned char the u8 is omitted.

Since there are more than one checkpatch issue per line,
more steps are rquired to fix.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: This patch was 6/7 and is now 5/6
V2 -> V3: Changed from
          "Rename macros VNSvOutPortB,W,D" to
          Replace VNSvOutPortB with iowrite8
          This patch was part of 5/6 and is now 4/7
---
 drivers/staging/vt6655/baseband.c    |  8 +++---
 drivers/staging/vt6655/card.c        | 11 ++++----
 drivers/staging/vt6655/channel.c     |  6 ++--
 drivers/staging/vt6655/device_main.c | 19 ++++++-------
 drivers/staging/vt6655/mac.h         | 41 ++++++++++++----------------
 drivers/staging/vt6655/rf.c          |  8 +++---
 drivers/staging/vt6655/rxtx.c        |  4 +--
 drivers/staging/vt6655/srom.c        | 10 +++----
 drivers/staging/vt6655/upc.h         |  3 --
 9 files changed, 47 insertions(+), 63 deletions(-)

diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
index decb55e96f02..4f1c44127e03 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -1910,7 +1910,7 @@ bool bb_read_embedded(struct vnt_private *priv, unsigned char by_bb_addr,
 	unsigned char by_value;
 
 	/* BB reg offset */
-	VNSvOutPortB(iobase + MAC_REG_BBREGADR, by_bb_addr);
+	iowrite8(by_bb_addr, iobase + MAC_REG_BBREGADR);
 
 	/* turn on REGR */
 	MACvRegBitsOn(iobase, MAC_REG_BBREGCTL, BBREGCTL_REGR);
@@ -1953,9 +1953,9 @@ bool bb_write_embedded(struct vnt_private *priv, unsigned char by_bb_addr,
 	unsigned char by_value;
 
 	/* BB reg offset */
-	VNSvOutPortB(iobase + MAC_REG_BBREGADR, by_bb_addr);
+	iowrite8(by_bb_addr, iobase + MAC_REG_BBREGADR);
 	/* set BB data */
-	VNSvOutPortB(iobase + MAC_REG_BBREGDATA, by_data);
+	iowrite8(by_data, iobase + MAC_REG_BBREGDATA);
 
 	/* turn on BBREGCTL_REGW */
 	MACvRegBitsOn(iobase, MAC_REG_BBREGCTL, BBREGCTL_REGW);
@@ -2054,7 +2054,7 @@ bool bb_vt3253_init(struct vnt_private *priv)
 				byVT3253B0_AGC[ii][0],
 				byVT3253B0_AGC[ii][1]);
 
-		VNSvOutPortB(iobase + MAC_REG_ITRTMSET, 0x23);
+		iowrite8(0x23, iobase + MAC_REG_ITRTMSET);
 		MACvRegBitsOn(iobase, MAC_REG_PAPEDELAY, BIT(0));
 
 		priv->abyBBVGA[0] = 0x14;
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index f6d2a7fadc18..62fda818022e 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -239,26 +239,25 @@ bool CARDbSetPhyParameter(struct vnt_private *priv, u8 bb_type)
 
 	if (priv->bySIFS != bySIFS) {
 		priv->bySIFS = bySIFS;
-		VNSvOutPortB(priv->port_offset + MAC_REG_SIFS, priv->bySIFS);
+		iowrite8(priv->bySIFS, priv->port_offset + MAC_REG_SIFS);
 	}
 	if (priv->byDIFS != byDIFS) {
 		priv->byDIFS = byDIFS;
-		VNSvOutPortB(priv->port_offset + MAC_REG_DIFS, priv->byDIFS);
+		iowrite8(priv->byDIFS, priv->port_offset + MAC_REG_DIFS);
 	}
 	if (priv->byEIFS != C_EIFS) {
 		priv->byEIFS = C_EIFS;
-		VNSvOutPortB(priv->port_offset + MAC_REG_EIFS, priv->byEIFS);
+		iowrite8(priv->byEIFS, priv->port_offset + MAC_REG_EIFS);
 	}
 	if (priv->bySlot != bySlot) {
 		priv->bySlot = bySlot;
-		VNSvOutPortB(priv->port_offset + MAC_REG_SLOT, priv->bySlot);
+		iowrite8(priv->bySlot, priv->port_offset + MAC_REG_SLOT);
 
 		bb_set_short_slot_time(priv);
 	}
 	if (priv->byCWMaxMin != byCWMaxMin) {
 		priv->byCWMaxMin = byCWMaxMin;
-		VNSvOutPortB(priv->port_offset + MAC_REG_CWMAXMIN0,
-			     priv->byCWMaxMin);
+		iowrite8(priv->byCWMaxMin, priv->port_offset + MAC_REG_CWMAXMIN0);
 	}
 
 	priv->byPacketType = CARDbyGetPktType(priv);
diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c
index abe867814dc8..652dcaf61169 100644
--- a/drivers/staging/vt6655/channel.c
+++ b/drivers/staging/vt6655/channel.c
@@ -118,11 +118,9 @@ bool set_channel(struct vnt_private *priv, struct ieee80211_channel *ch)
 		/* set HW default power register */
 		MACvSelectPage1(priv->port_offset);
 		RFbSetPower(priv, RATE_1M, priv->byCurrentCh);
-		VNSvOutPortB(priv->port_offset + MAC_REG_PWRCCK,
-			     priv->byCurPwr);
+		iowrite8(priv->byCurPwr, priv->port_offset + MAC_REG_PWRCCK);
 		RFbSetPower(priv, RATE_6M, priv->byCurrentCh);
-		VNSvOutPortB(priv->port_offset + MAC_REG_PWROFDM,
-			     priv->byCurPwr);
+		iowrite8(priv->byCurPwr, priv->port_offset + MAC_REG_PWROFDM);
 		MACvSelectPage0(priv->port_offset);
 
 		spin_unlock_irqrestore(&priv->lock, flags);
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 16b031c31925..1bfccaa08c45 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -334,8 +334,7 @@ static void device_init_registers(struct vnt_private *priv)
 	if (priv->local_id > REV_ID_VT3253_B1) {
 		MACvSelectPage1(priv->port_offset);
 
-		VNSvOutPortB(priv->port_offset + MAC_REG_MSRCTL + 1,
-			     (MSRCTL1_TXPWR | MSRCTL1_CSAPAREN));
+		iowrite8(MSRCTL1_TXPWR | MSRCTL1_CSAPAREN, priv->port_offset + MAC_REG_MSRCTL + 1);
 
 		MACvSelectPage0(priv->port_offset);
 	}
@@ -349,9 +348,9 @@ static void device_init_registers(struct vnt_private *priv)
 	MACvSetLongRetryLimit(priv, priv->byLongRetryLimit);
 
 	/* reset TSF counter */
-	VNSvOutPortB(priv->port_offset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
+	iowrite8(TFTCTL_TSFCNTRST, priv->port_offset + MAC_REG_TFTCTL);
 	/* enable TSF counter */
-	VNSvOutPortB(priv->port_offset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
+	iowrite8(TFTCTL_TSFCNTREN, priv->port_offset + MAC_REG_TFTCTL);
 
 	/* initialize BBP registers */
 	bb_vt3253_init(priv);
@@ -1060,7 +1059,7 @@ static void vnt_interrupt_process(struct vnt_private *priv)
 
 		if (isr & ISR_FETALERR) {
 			pr_debug(" ISR_FETALERR\n");
-			VNSvOutPortB(priv->port_offset + MAC_REG_SOFTPWRCTL, 0);
+			iowrite8(0, priv->port_offset + MAC_REG_SOFTPWRCTL);
 			VNSvOutPortW(priv->port_offset +
 				     MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPECTI);
 			device_error(priv, isr);
@@ -1477,10 +1476,8 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
 
 			CARDvSetFirstNextTBTT(priv, conf->beacon_int);
 		} else {
-			VNSvOutPortB(priv->port_offset + MAC_REG_TFTCTL,
-				     TFTCTL_TSFCNTRST);
-			VNSvOutPortB(priv->port_offset + MAC_REG_TFTCTL,
-				     TFTCTL_TSFCNTREN);
+			iowrite8(TFTCTL_TSFCNTRST, priv->port_offset + MAC_REG_TFTCTL);
+			iowrite8(TFTCTL_TSFCNTREN, priv->port_offset + MAC_REG_TFTCTL);
 		}
 	}
 }
@@ -1561,7 +1558,7 @@ static void vnt_configure(struct ieee80211_hw *hw,
 			rx_mode |= RCR_BSSID;
 	}
 
-	VNSvOutPortB(priv->port_offset + MAC_REG_RCR, rx_mode);
+	iowrite8(rx_mode, priv->port_offset + MAC_REG_RCR);
 
 	dev_dbg(&priv->pcid->dev, "rx mode out= %x\n", rx_mode);
 }
@@ -1621,7 +1618,7 @@ static void vnt_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 	struct vnt_private *priv = hw->priv;
 
 	/* reset TSF counter */
-	VNSvOutPortB(priv->port_offset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
+	iowrite8(TFTCTL_TSFCNTRST, priv->port_offset + MAC_REG_TFTCTL);
 }
 
 static const struct ieee80211_ops vnt_mac_ops = {
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 114d1f9c2a1a..1017236e3117 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -542,7 +542,7 @@
 do {									\
 	unsigned char byData;						\
 	byData = ioread8(iobase + byRegOfs);			\
-	VNSvOutPortB(iobase + byRegOfs, byData | (byBits));		\
+	iowrite8((u8)(byData | (byBits)), iobase + byRegOfs);		\
 } while (0)
 
 #define MACvWordRegBitsOn(iobase, byRegOfs, wBits)			\
@@ -556,7 +556,7 @@ do {									\
 do {									\
 	unsigned char byData;						\
 	byData = ioread8(iobase + byRegOfs);			\
-	VNSvOutPortB(iobase + byRegOfs, byData & ~(byBits));		\
+	iowrite8((u8)(byData & ~(byBits)), iobase + byRegOfs);		\
 } while (0)
 
 #define MACvWordRegBitsOff(iobase, byRegOfs, wBits)			\
@@ -578,37 +578,30 @@ do {									\
 
 #define MACvWriteBSSIDAddress(iobase, pbyEtherAddr)		\
 do {								\
-	VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1);		\
-	VNSvOutPortB(iobase + MAC_REG_BSSID0,			\
-		     *(pbyEtherAddr));				\
-	VNSvOutPortB(iobase + MAC_REG_BSSID0 + 1,		\
-		     *(pbyEtherAddr + 1));			\
-	VNSvOutPortB(iobase + MAC_REG_BSSID0 + 2,		\
-		     *(pbyEtherAddr + 2));			\
-	VNSvOutPortB(iobase + MAC_REG_BSSID0 + 3,		\
-		     *(pbyEtherAddr + 3));			\
-	VNSvOutPortB(iobase + MAC_REG_BSSID0 + 4,		\
-		     *(pbyEtherAddr + 4));			\
-	VNSvOutPortB(iobase + MAC_REG_BSSID0 + 5,		\
-		     *(pbyEtherAddr + 5));			\
-	VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 0);		\
+	iowrite8(1, iobase + MAC_REG_PAGE1SEL);		\
+	iowrite8((u8)*(pbyEtherAddr), iobase + MAC_REG_BSSID0);				\
+	iowrite8((u8)*(pbyEtherAddr + 1), iobase + MAC_REG_BSSID0 + 1);			\
+	iowrite8((u8)*(pbyEtherAddr + 2), iobase + MAC_REG_BSSID0 + 2);			\
+	iowrite8((u8)*(pbyEtherAddr + 3), iobase + MAC_REG_BSSID0 + 3);			\
+	iowrite8((u8)*(pbyEtherAddr + 4), iobase + MAC_REG_BSSID0 + 4);			\
+	iowrite8((u8)*(pbyEtherAddr + 5), iobase + MAC_REG_BSSID0 + 5);			\
+	iowrite8(0, iobase + MAC_REG_PAGE1SEL);		\
 } while (0)
 
 #define MACvReadEtherAddress(iobase, pbyEtherAddr)		\
 do {								\
-	VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1);		\
+	iowrite8(1, iobase + MAC_REG_PAGE1SEL);		\
 	(*((unsigned char *)pbyEtherAddr) = ioread8(iobase + MAC_REG_PAR0));		\
 	(*(pbyEtherAddr + 1) = ioread8(iobase + MAC_REG_PAR0 + 1));	\
 	(*(pbyEtherAddr + 2) = ioread8(iobase + MAC_REG_PAR0 + 2));	\
 	(*(pbyEtherAddr + 3) = ioread8(iobase + MAC_REG_PAR0 + 3));	\
 	(*(pbyEtherAddr + 4) = ioread8(iobase + MAC_REG_PAR0 + 4));	\
 	(*(pbyEtherAddr + 5) = ioread8(iobase + MAC_REG_PAR0 + 5));	\
-	VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 0);		\
+	iowrite8(0, iobase + MAC_REG_PAGE1SEL);		\
 } while (0)
 
 #define MACvStart(iobase)						\
-	VNSvOutPortB(iobase + MAC_REG_HOSTCR,				\
-		     (HOSTCR_MACEN | HOSTCR_RXON | HOSTCR_TXON))
+	iowrite8(HOSTCR_MACEN | HOSTCR_RXON | HOSTCR_TXON, iobase + MAC_REG_HOSTCR)
 
 #define MACvRx0PerPktMode(iobase)					\
 	VNSvOutPortD(iobase + MAC_REG_RXDMACTL0, RX_PERPKT)
@@ -657,14 +650,14 @@ do {									\
 } while (0)
 
 #define MACvTransmitBCN(iobase)					\
-	VNSvOutPortB(iobase + MAC_REG_BCNDMACTL, BEACON_READY)
+	iowrite8(BEACON_READY, iobase + MAC_REG_BCNDMACTL)
 
 #define MACvClearStckDS(iobase)					\
 do {									\
 	unsigned char byOrgValue;					\
 	byOrgValue = ioread8(iobase + MAC_REG_STICKHW);		\
 	byOrgValue = byOrgValue & 0xFC;					\
-	VNSvOutPortB(iobase + MAC_REG_STICKHW, byOrgValue);		\
+	iowrite8((u8)byOrgValue, iobase + MAC_REG_STICKHW);		\
 } while (0)
 
 #define MACvReadISR(iobase, pdwValue)				\
@@ -680,10 +673,10 @@ do {									\
 	VNSvOutPortD(iobase + MAC_REG_IMR, 0)
 
 #define MACvSelectPage0(iobase)				\
-		VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 0)
+		iowrite8(0, iobase + MAC_REG_PAGE1SEL)
 
 #define MACvSelectPage1(iobase)				\
-	VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1)
+	iowrite8(1, iobase + MAC_REG_PAGE1SEL)
 
 #define MACvReadMIBCounter(iobase, pdwCounter)			\
 	*(pdwCounter) = ioread32(iobase + MAC_REG_MIBCNTR)
diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c
index 036f48572334..d4db0a0b702c 100644
--- a/drivers/staging/vt6655/rf.c
+++ b/drivers/staging/vt6655/rf.c
@@ -207,7 +207,7 @@ static bool RFbAL2230Init(struct vnt_private *priv)
 	ret = true;
 
 	/* 3-wire control for normal mode */
-	VNSvOutPortB(iobase + MAC_REG_SOFTPWRCTL, 0);
+	iowrite8(0, iobase + MAC_REG_SOFTPWRCTL);
 
 	MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPECTI  |
 							 SOFTPWRCTL_TXPEINV));
@@ -238,7 +238,7 @@ static bool RFbAL2230Init(struct vnt_private *priv)
 							 SOFTPWRCTL_TXPEINV));
 
 	/* 3-wire control for power saving mode */
-	VNSvOutPortB(iobase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); /* 1100 0000 */
+	iowrite8((u8)(PSSIG_WPE3 | PSSIG_WPE2), iobase + MAC_REG_PSPWRSIG); /* 1100 0000 */
 
 	return ret;
 }
@@ -254,10 +254,10 @@ static bool RFbAL2230SelectChannel(struct vnt_private *priv, unsigned char byCha
 	ret &= IFRFbWriteEmbedded(priv, al2230_channel_table1[byChannel - 1]);
 
 	/* Set Channel[7] = 0 to tell H/W channel is changing now. */
-	VNSvOutPortB(iobase + MAC_REG_CHANNEL, (byChannel & 0x7F));
+	iowrite8((u8)(byChannel & 0x7F), iobase + MAC_REG_CHANNEL);
 	MACvTimer0MicroSDelay(priv, SWITCH_CHANNEL_DELAY_AL2230);
 	/* Set Channel[7] = 1 to tell H/W channel change is done. */
-	VNSvOutPortB(iobase + MAC_REG_CHANNEL, (byChannel | 0x80));
+	iowrite8((u8)(byChannel | 0x80), iobase + MAC_REG_CHANNEL);
 
 	return ret;
 }
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 53506e242a96..146ad261696d 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1450,9 +1450,9 @@ int vnt_beacon_make(struct vnt_private *priv, struct ieee80211_vif *vif)
 int vnt_beacon_enable(struct vnt_private *priv, struct ieee80211_vif *vif,
 		      struct ieee80211_bss_conf *conf)
 {
-	VNSvOutPortB(priv->port_offset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
+	iowrite8(TFTCTL_TSFCNTRST, priv->port_offset + MAC_REG_TFTCTL);
 
-	VNSvOutPortB(priv->port_offset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
+	iowrite8(TFTCTL_TSFCNTREN, priv->port_offset + MAC_REG_TFTCTL);
 
 	CARDvSetFirstNextTBTT(priv, conf->beacon_int);
 
diff --git a/drivers/staging/vt6655/srom.c b/drivers/staging/vt6655/srom.c
index a0432bacb6a0..7feaa5138de0 100644
--- a/drivers/staging/vt6655/srom.c
+++ b/drivers/staging/vt6655/srom.c
@@ -68,13 +68,13 @@ unsigned char SROMbyReadEmbedded(void __iomem *iobase,
 	byData = 0xFF;
 	byOrg = ioread8(iobase + MAC_REG_I2MCFG);
 	/* turn off hardware retry for getting NACK */
-	VNSvOutPortB(iobase + MAC_REG_I2MCFG, (byOrg & (~I2MCFG_NORETRY)));
+	iowrite8((u8)(byOrg & (~I2MCFG_NORETRY)), iobase + MAC_REG_I2MCFG);
 	for (wNoACK = 0; wNoACK < W_MAX_I2CRETRY; wNoACK++) {
-		VNSvOutPortB(iobase + MAC_REG_I2MTGID, EEP_I2C_DEV_ID);
-		VNSvOutPortB(iobase + MAC_REG_I2MTGAD, byContntOffset);
+		iowrite8(EEP_I2C_DEV_ID, iobase + MAC_REG_I2MTGID);
+		iowrite8(byContntOffset, iobase + MAC_REG_I2MTGAD);
 
 		/* issue read command */
-		VNSvOutPortB(iobase + MAC_REG_I2MCSR, I2MCSR_EEMR);
+		iowrite8(I2MCSR_EEMR, iobase + MAC_REG_I2MCSR);
 		/* wait DONE be set */
 		for (wDelay = 0; wDelay < W_MAX_TIMEOUT; wDelay++) {
 			byWait = ioread8(iobase + MAC_REG_I2MCSR);
@@ -88,7 +88,7 @@ unsigned char SROMbyReadEmbedded(void __iomem *iobase,
 		}
 	}
 	byData = ioread8(iobase + MAC_REG_I2MDIPT);
-	VNSvOutPortB(iobase + MAC_REG_I2MCFG, byOrg);
+	iowrite8(byOrg, iobase + MAC_REG_I2MCFG);
 	return byData;
 }
 
diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h
index 9617667f1a69..2a6d9cd1b42d 100644
--- a/drivers/staging/vt6655/upc.h
+++ b/drivers/staging/vt6655/upc.h
@@ -20,9 +20,6 @@
 
 /* For memory mapped IO */
 
-#define VNSvOutPortB(dwIOAddress, byData) \
-	iowrite8((u8)(byData), dwIOAddress)
-
 #define VNSvOutPortW(dwIOAddress, wData) \
 	iowrite16((u16)(wData), dwIOAddress)
 
-- 
2.25.1


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

* [PATCH v3 5/7] staging: vt6655: Replace VNSvOutPortW with iowrite16
  2022-04-11 20:49 [PATCH v3 0/7] staging: vt6655: Fix CamelCase in upc.h and started in mac.h Philipp Hortmann
                   ` (3 preceding siblings ...)
  2022-04-11 20:49 ` [PATCH v3 4/7] staging: vt6655: Replace VNSvOutPortB with iowrite8 Philipp Hortmann
@ 2022-04-11 20:49 ` Philipp Hortmann
  2022-04-11 20:49 ` [PATCH v3 6/7] staging: vt6655: Replace VNSvOutPortD with iowrite32 Philipp Hortmann
  2022-04-11 20:49 ` [PATCH v3 7/7] staging: vt6655: Remove macro PCAvDelayByIO Philipp Hortmann
  6 siblings, 0 replies; 13+ messages in thread
From: Philipp Hortmann @ 2022-04-11 20:49 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Replace macro VNSvOutPortW with iowrite16.
The name of macro and the arguments use CamelCase which
is not accepted by checkpatch.pl

For constants from 0 to below 0x8000 the u16 cast was omitted.
For variables which are defined as unsigned short the u16 is omitted.

Since there are more than one checkpatch issue per line,
more steps are rquired to fix.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: Patch was not existing
V2 -> V3: Inserted patch that was before in a different way in
          "Rename macros VNSvOutPortB,W,D"
          This patch was part of 5/6 and is now 5/7
---
 drivers/staging/vt6655/card.c        | 29 ++++++++++------------------
 drivers/staging/vt6655/device_main.c |  3 +--
 drivers/staging/vt6655/mac.h         |  7 +++----
 drivers/staging/vt6655/power.c       |  4 ++--
 drivers/staging/vt6655/rf.c          |  2 +-
 drivers/staging/vt6655/upc.h         |  3 ---
 6 files changed, 17 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 62fda818022e..57b9ea385690 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -327,7 +327,7 @@ bool CARDbSetBeaconPeriod(struct vnt_private *priv,
 	qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
 
 	/* set HW beacon interval */
-	VNSvOutPortW(priv->port_offset + MAC_REG_BI, wBeaconInterval);
+	iowrite16(wBeaconInterval, priv->port_offset + MAC_REG_BI);
 	priv->wBeaconInterval = wBeaconInterval;
 	/* Set NextTBTT */
 	VNSvOutPortD(priv->port_offset + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);
@@ -588,68 +588,59 @@ void CARDvSetRSPINF(struct vnt_private *priv, u8 bb_type)
 				   bb_type,
 				   &byTxRate,
 				   &byRsvTime);
-	VNSvOutPortW(priv->port_offset + MAC_REG_RSPINF_A_6,
-		     MAKEWORD(byTxRate, byRsvTime));
+	iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_6);
 	/* RSPINF_a_9 */
 	s_vCalculateOFDMRParameter(RATE_9M,
 				   bb_type,
 				   &byTxRate,
 				   &byRsvTime);
-	VNSvOutPortW(priv->port_offset + MAC_REG_RSPINF_A_9,
-		     MAKEWORD(byTxRate, byRsvTime));
+	iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_9);
 	/* RSPINF_a_12 */
 	s_vCalculateOFDMRParameter(RATE_12M,
 				   bb_type,
 				   &byTxRate,
 				   &byRsvTime);
-	VNSvOutPortW(priv->port_offset + MAC_REG_RSPINF_A_12,
-		     MAKEWORD(byTxRate, byRsvTime));
+	iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_12);
 	/* RSPINF_a_18 */
 	s_vCalculateOFDMRParameter(RATE_18M,
 				   bb_type,
 				   &byTxRate,
 				   &byRsvTime);
-	VNSvOutPortW(priv->port_offset + MAC_REG_RSPINF_A_18,
-		     MAKEWORD(byTxRate, byRsvTime));
+	iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_18);
 	/* RSPINF_a_24 */
 	s_vCalculateOFDMRParameter(RATE_24M,
 				   bb_type,
 				   &byTxRate,
 				   &byRsvTime);
-	VNSvOutPortW(priv->port_offset + MAC_REG_RSPINF_A_24,
-		     MAKEWORD(byTxRate, byRsvTime));
+	iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_24);
 	/* RSPINF_a_36 */
 	s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)priv,
 							   RATE_36M),
 				   bb_type,
 				   &byTxRate,
 				   &byRsvTime);
-	VNSvOutPortW(priv->port_offset + MAC_REG_RSPINF_A_36,
-		     MAKEWORD(byTxRate, byRsvTime));
+	iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_36);
 	/* RSPINF_a_48 */
 	s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)priv,
 							   RATE_48M),
 				   bb_type,
 				   &byTxRate,
 				   &byRsvTime);
-	VNSvOutPortW(priv->port_offset + MAC_REG_RSPINF_A_48,
-		     MAKEWORD(byTxRate, byRsvTime));
+	iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_48);
 	/* RSPINF_a_54 */
 	s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)priv,
 							   RATE_54M),
 				   bb_type,
 				   &byTxRate,
 				   &byRsvTime);
-	VNSvOutPortW(priv->port_offset + MAC_REG_RSPINF_A_54,
-		     MAKEWORD(byTxRate, byRsvTime));
+	iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_54);
 	/* RSPINF_a_72 */
 	s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)priv,
 							   RATE_54M),
 				   bb_type,
 				   &byTxRate,
 				   &byRsvTime);
-	VNSvOutPortW(priv->port_offset + MAC_REG_RSPINF_A_72,
-		     MAKEWORD(byTxRate, byRsvTime));
+	iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_72);
 	/* Set to Page0 */
 	MACvSelectPage0(priv->port_offset);
 
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 1bfccaa08c45..bd97e3b9bc98 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1060,8 +1060,7 @@ static void vnt_interrupt_process(struct vnt_private *priv)
 		if (isr & ISR_FETALERR) {
 			pr_debug(" ISR_FETALERR\n");
 			iowrite8(0, priv->port_offset + MAC_REG_SOFTPWRCTL);
-			VNSvOutPortW(priv->port_offset +
-				     MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPECTI);
+			iowrite16(SOFTPWRCTL_SWPECTI, priv->port_offset + MAC_REG_SOFTPWRCTL);
 			device_error(priv, isr);
 		}
 
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 1017236e3117..9e8f7e1f1655 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -549,7 +549,7 @@ do {									\
 do {									\
 	unsigned short wData;						\
 	wData = ioread16(iobase + byRegOfs);			\
-	VNSvOutPortW(iobase + byRegOfs, wData | (wBits));		\
+	iowrite16((u16)(wData | (wBits)), iobase + byRegOfs);		\
 } while (0)
 
 #define MACvRegBitsOff(iobase, byRegOfs, byBits)			\
@@ -563,7 +563,7 @@ do {									\
 do {									\
 	unsigned short wData;						\
 	wData = ioread16(iobase + byRegOfs);			\
-	VNSvOutPortW(iobase + byRegOfs, wData & ~(wBits));		\
+	iowrite16((u16)(wData & ~(wBits)), iobase + byRegOfs);		\
 } while (0)
 
 /* set the chip with current BCN tx descriptor address */
@@ -573,8 +573,7 @@ do {									\
 
 /* set the chip with current BCN length */
 #define MACvSetCurrBCNLength(iobase, wCurrBCNLength)		\
-	VNSvOutPortW(iobase + MAC_REG_BCNDMACTL + 2,		\
-		     wCurrBCNLength)
+	iowrite16((u16)(wCurrBCNLength), iobase + MAC_REG_BCNDMACTL + 2)
 
 #define MACvWriteBSSIDAddress(iobase, pbyEtherAddr)		\
 do {								\
diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c
index 06066fa56dd5..0bd2ddc61648 100644
--- a/drivers/staging/vt6655/power.c
+++ b/drivers/staging/vt6655/power.c
@@ -52,10 +52,10 @@ void PSvEnablePowerSaving(struct vnt_private *priv,
 	u16 wAID = priv->current_aid | BIT(14) | BIT(15);
 
 	/* set period of power up before TBTT */
-	VNSvOutPortW(priv->port_offset + MAC_REG_PWBT, C_PWBT);
+	iowrite16(C_PWBT, priv->port_offset + MAC_REG_PWBT);
 	if (priv->op_mode != NL80211_IFTYPE_ADHOC) {
 		/* set AID */
-		VNSvOutPortW(priv->port_offset + MAC_REG_AIDATIM, wAID);
+		iowrite16(wAID, priv->port_offset + MAC_REG_AIDATIM);
 	}
 
 	/* Set AutoSleep */
diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c
index d4db0a0b702c..76c651d4da31 100644
--- a/drivers/staging/vt6655/rf.c
+++ b/drivers/staging/vt6655/rf.c
@@ -350,7 +350,7 @@ bool rf_write_wake_prog_syn(struct vnt_private *priv, unsigned char rf_type,
 	unsigned char sleep_count = 0;
 	unsigned short idx = MISCFIFO_SYNDATA_IDX;
 
-	VNSvOutPortW(iobase + MAC_REG_MISCFFNDEX, 0);
+	iowrite16(0, iobase + MAC_REG_MISCFFNDEX);
 	switch (rf_type) {
 	case RF_AIROHA:
 	case RF_AL2230S:
diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h
index 2a6d9cd1b42d..c14b4d98c466 100644
--- a/drivers/staging/vt6655/upc.h
+++ b/drivers/staging/vt6655/upc.h
@@ -20,9 +20,6 @@
 
 /* For memory mapped IO */
 
-#define VNSvOutPortW(dwIOAddress, wData) \
-	iowrite16((u16)(wData), dwIOAddress)
-
 #define VNSvOutPortD(dwIOAddress, dwData) \
 	iowrite32((u32)(dwData), dwIOAddress)
 
-- 
2.25.1


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

* [PATCH v3 6/7] staging: vt6655: Replace VNSvOutPortD with iowrite32
  2022-04-11 20:49 [PATCH v3 0/7] staging: vt6655: Fix CamelCase in upc.h and started in mac.h Philipp Hortmann
                   ` (4 preceding siblings ...)
  2022-04-11 20:49 ` [PATCH v3 5/7] staging: vt6655: Replace VNSvOutPortW with iowrite16 Philipp Hortmann
@ 2022-04-11 20:49 ` Philipp Hortmann
  2022-04-11 20:49 ` [PATCH v3 7/7] staging: vt6655: Remove macro PCAvDelayByIO Philipp Hortmann
  6 siblings, 0 replies; 13+ messages in thread
From: Philipp Hortmann @ 2022-04-11 20:49 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Replace macro VNSvOutPortD with iowrite32.
The name of macro and the arguments use CamelCase which
is not accepted by checkpatch.pl

For constants from 0 to below 0x80000000 the u32 cast was omitted.
For variables which are defined as unsigned long the u32 is omitted.

Since there are more than one checkpatch issue per line,
more steps are rquired to fix.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: Patch was not existing
V2 -> V3: Inserted patch that was before in a different way in
          "Rename macros VNSvOutPortB,W,D"
          This patch was part of 5/6 and is now 6/7
---
 drivers/staging/vt6655/baseband.c    |  2 +-
 drivers/staging/vt6655/card.c        | 27 +++++++++----------
 drivers/staging/vt6655/device_main.c | 14 ++++------
 drivers/staging/vt6655/mac.h         | 39 ++++++++++++++--------------
 drivers/staging/vt6655/rf.c          |  2 +-
 drivers/staging/vt6655/upc.h         |  3 ---
 6 files changed, 38 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
index 4f1c44127e03..3b3211d0077a 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -2014,7 +2014,7 @@ bool bb_vt3253_init(struct vnt_private *priv)
 					byVT3253B0_AGC4_RFMD2959[ii][0],
 					byVT3253B0_AGC4_RFMD2959[ii][1]);
 
-			VNSvOutPortD(iobase + MAC_REG_ITRTMSET, 0x23);
+			iowrite32(0x23, iobase + MAC_REG_ITRTMSET);
 			MACvRegBitsOn(iobase, MAC_REG_PAPEDELAY, BIT(0));
 		}
 		priv->abyBBVGA[0] = 0x18;
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 57b9ea385690..8701a3a6b46f 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -294,10 +294,8 @@ bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate,
 		qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp,
 						local_tsf);
 		/* adjust TSF, HW's TSF add TSF Offset reg */
-		VNSvOutPortD(priv->port_offset + MAC_REG_TSFOFST,
-			     (u32)qwTSFOffset);
-		VNSvOutPortD(priv->port_offset + MAC_REG_TSFOFST + 4,
-			     (u32)(qwTSFOffset >> 32));
+		iowrite32((u32)qwTSFOffset, priv->port_offset + MAC_REG_TSFOFST);
+		iowrite32((u32)(qwTSFOffset >> 32), priv->port_offset + MAC_REG_TSFOFST + 4);
 		MACvRegBitsOn(priv->port_offset, MAC_REG_TFTCTL,
 			      TFTCTL_TSFSYNCEN);
 	}
@@ -330,9 +328,8 @@ bool CARDbSetBeaconPeriod(struct vnt_private *priv,
 	iowrite16(wBeaconInterval, priv->port_offset + MAC_REG_BI);
 	priv->wBeaconInterval = wBeaconInterval;
 	/* Set NextTBTT */
-	VNSvOutPortD(priv->port_offset + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);
-	VNSvOutPortD(priv->port_offset + MAC_REG_NEXTTBTT + 4,
-		     (u32)(qwNextTBTT >> 32));
+	iowrite32((u32)qwNextTBTT, priv->port_offset + MAC_REG_NEXTTBTT);
+	iowrite32((u32)(qwNextTBTT >> 32), priv->port_offset + MAC_REG_NEXTTBTT + 4);
 	MACvRegBitsOn(priv->port_offset, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
 
 	return true;
@@ -554,7 +551,7 @@ void CARDvSetRSPINF(struct vnt_private *priv, u8 bb_type)
 	 /* swap over to get correct write order */
 	swap(phy.swap[0], phy.swap[1]);
 
-	VNSvOutPortD(priv->port_offset + MAC_REG_RSPINF_B_1, phy.field_write);
+	iowrite32(phy.field_write, priv->port_offset + MAC_REG_RSPINF_B_1);
 
 	/* RSPINF_b_2 */
 	vnt_get_phy_field(priv, 14,
@@ -563,7 +560,7 @@ void CARDvSetRSPINF(struct vnt_private *priv, u8 bb_type)
 
 	swap(phy.swap[0], phy.swap[1]);
 
-	VNSvOutPortD(priv->port_offset + MAC_REG_RSPINF_B_2, phy.field_write);
+	iowrite32(phy.field_write, priv->port_offset + MAC_REG_RSPINF_B_2);
 
 	/* RSPINF_b_5 */
 	vnt_get_phy_field(priv, 14,
@@ -572,7 +569,7 @@ void CARDvSetRSPINF(struct vnt_private *priv, u8 bb_type)
 
 	swap(phy.swap[0], phy.swap[1]);
 
-	VNSvOutPortD(priv->port_offset + MAC_REG_RSPINF_B_5, phy.field_write);
+	iowrite32(phy.field_write, priv->port_offset + MAC_REG_RSPINF_B_5);
 
 	/* RSPINF_b_11 */
 	vnt_get_phy_field(priv, 14,
@@ -581,7 +578,7 @@ void CARDvSetRSPINF(struct vnt_private *priv, u8 bb_type)
 
 	swap(phy.swap[0], phy.swap[1]);
 
-	VNSvOutPortD(priv->port_offset + MAC_REG_RSPINF_B_11, phy.field_write);
+	iowrite32(phy.field_write, priv->port_offset + MAC_REG_RSPINF_B_11);
 
 	/* RSPINF_a_6 */
 	s_vCalculateOFDMRParameter(RATE_6M,
@@ -800,8 +797,8 @@ void CARDvSetFirstNextTBTT(struct vnt_private *priv,
 
 	qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
 	/* Set NextTBTT */
-	VNSvOutPortD(iobase + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);
-	VNSvOutPortD(iobase + MAC_REG_NEXTTBTT + 4, (u32)(qwNextTBTT >> 32));
+	iowrite32((u32)qwNextTBTT, iobase + MAC_REG_NEXTTBTT);
+	iowrite32((u32)(qwNextTBTT >> 32), iobase + MAC_REG_NEXTTBTT + 4);
 	MACvRegBitsOn(iobase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
 }
 
@@ -826,8 +823,8 @@ void CARDvUpdateNextTBTT(struct vnt_private *priv, u64 qwTSF,
 
 	qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval);
 	/* Set NextTBTT */
-	VNSvOutPortD(iobase + MAC_REG_NEXTTBTT, (u32)qwTSF);
-	VNSvOutPortD(iobase + MAC_REG_NEXTTBTT + 4, (u32)(qwTSF >> 32));
+	iowrite32((u32)qwTSF, iobase + MAC_REG_NEXTTBTT);
+	iowrite32((u32)(qwTSF >> 32), iobase + MAC_REG_NEXTTBTT + 4);
 	MACvRegBitsOn(iobase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
 	pr_debug("Card:Update Next TBTT[%8llx]\n", qwTSF);
 }
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index bd97e3b9bc98..8de225701ca1 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1522,20 +1522,16 @@ static void vnt_configure(struct ieee80211_hw *hw,
 			if (priv->mc_list_count > 2) {
 				MACvSelectPage1(priv->port_offset);
 
-				VNSvOutPortD(priv->port_offset +
-					     MAC_REG_MAR0, 0xffffffff);
-				VNSvOutPortD(priv->port_offset +
-					    MAC_REG_MAR0 + 4, 0xffffffff);
+				iowrite32((u32)0xffffffff, priv->port_offset + MAC_REG_MAR0);
+				iowrite32((u32)0xffffffff, priv->port_offset + MAC_REG_MAR0 + 4);
 
 				MACvSelectPage0(priv->port_offset);
 			} else {
 				MACvSelectPage1(priv->port_offset);
 
-				VNSvOutPortD(priv->port_offset +
-					     MAC_REG_MAR0, (u32)multicast);
-				VNSvOutPortD(priv->port_offset +
-					     MAC_REG_MAR0 + 4,
-					     (u32)(multicast >> 32));
+				iowrite32((u32)multicast, priv->port_offset + MAC_REG_MAR0);
+				iowrite32((u32)(multicast >> 32),
+					  priv->port_offset + MAC_REG_MAR0 + 4);
 
 				MACvSelectPage0(priv->port_offset);
 			}
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 9e8f7e1f1655..4827f370b5ad 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -568,8 +568,7 @@ do {									\
 
 /* set the chip with current BCN tx descriptor address */
 #define MACvSetCurrBCNTxDescAddr(iobase, dwCurrDescAddr)	\
-	VNSvOutPortD(iobase + MAC_REG_BCNDMAPTR,		\
-		     dwCurrDescAddr)
+	iowrite32((u32)(dwCurrDescAddr), iobase + MAC_REG_BCNDMAPTR)
 
 /* set the chip with current BCN length */
 #define MACvSetCurrBCNLength(iobase, wCurrBCNLength)		\
@@ -603,19 +602,19 @@ do {								\
 	iowrite8(HOSTCR_MACEN | HOSTCR_RXON | HOSTCR_TXON, iobase + MAC_REG_HOSTCR)
 
 #define MACvRx0PerPktMode(iobase)					\
-	VNSvOutPortD(iobase + MAC_REG_RXDMACTL0, RX_PERPKT)
+	iowrite32(RX_PERPKT, iobase + MAC_REG_RXDMACTL0)
 
 #define MACvRx1PerPktMode(iobase)					\
-	VNSvOutPortD(iobase + MAC_REG_RXDMACTL1, RX_PERPKT)
+	iowrite32(RX_PERPKT, iobase + MAC_REG_RXDMACTL1)
 
 #define MACvReceive0(iobase)						\
 do {									\
 	unsigned long dwData;						\
 	dwData = ioread32(iobase + MAC_REG_RXDMACTL0);		\
 	if (dwData & DMACTL_RUN)					\
-		VNSvOutPortD(iobase + MAC_REG_RXDMACTL0, DMACTL_WAKE); \
+		iowrite32(DMACTL_WAKE, iobase + MAC_REG_RXDMACTL0); \
 	else								\
-		VNSvOutPortD(iobase + MAC_REG_RXDMACTL0, DMACTL_RUN); \
+		iowrite32(DMACTL_RUN, iobase + MAC_REG_RXDMACTL0); \
 } while (0)
 
 #define MACvReceive1(iobase)						\
@@ -623,9 +622,9 @@ do {									\
 	unsigned long dwData;						\
 	dwData = ioread32(iobase + MAC_REG_RXDMACTL1);		\
 	if (dwData & DMACTL_RUN)					\
-		VNSvOutPortD(iobase + MAC_REG_RXDMACTL1, DMACTL_WAKE); \
+		iowrite32(DMACTL_WAKE, iobase + MAC_REG_RXDMACTL1); \
 	else								\
-		VNSvOutPortD(iobase + MAC_REG_RXDMACTL1, DMACTL_RUN); \
+		iowrite32(DMACTL_RUN, iobase + MAC_REG_RXDMACTL1); \
 } while (0)
 
 #define MACvTransmit0(iobase)						\
@@ -633,9 +632,9 @@ do {									\
 	unsigned long dwData;						\
 	dwData = ioread32(iobase + MAC_REG_TXDMACTL0);		\
 	if (dwData & DMACTL_RUN)					\
-		VNSvOutPortD(iobase + MAC_REG_TXDMACTL0, DMACTL_WAKE); \
+		iowrite32(DMACTL_WAKE, iobase + MAC_REG_TXDMACTL0); \
 	else								\
-		VNSvOutPortD(iobase + MAC_REG_TXDMACTL0, DMACTL_RUN); \
+		iowrite32(DMACTL_RUN, iobase + MAC_REG_TXDMACTL0); \
 } while (0)
 
 #define MACvTransmitAC0(iobase)					\
@@ -643,9 +642,9 @@ do {									\
 	unsigned long dwData;						\
 	dwData = ioread32(iobase + MAC_REG_AC0DMACTL);		\
 	if (dwData & DMACTL_RUN)					\
-		VNSvOutPortD(iobase + MAC_REG_AC0DMACTL, DMACTL_WAKE); \
+		iowrite32(DMACTL_WAKE, iobase + MAC_REG_AC0DMACTL); \
 	else								\
-		VNSvOutPortD(iobase + MAC_REG_AC0DMACTL, DMACTL_RUN); \
+		iowrite32(DMACTL_RUN, iobase + MAC_REG_AC0DMACTL); \
 } while (0)
 
 #define MACvTransmitBCN(iobase)					\
@@ -663,13 +662,13 @@ do {									\
 	*(pdwValue) = ioread32(iobase + MAC_REG_ISR)
 
 #define MACvWriteISR(iobase, dwValue)				\
-	VNSvOutPortD(iobase + MAC_REG_ISR, dwValue)
+	iowrite32((u32)(dwValue), iobase + MAC_REG_ISR)
 
 #define MACvIntEnable(iobase, dwMask)				\
-	VNSvOutPortD(iobase + MAC_REG_IMR, dwMask)
+	iowrite32((u32)(dwMask), iobase + MAC_REG_IMR)
 
 #define MACvIntDisable(iobase)				\
-	VNSvOutPortD(iobase + MAC_REG_IMR, 0)
+	iowrite32(0, iobase + MAC_REG_IMR)
 
 #define MACvSelectPage0(iobase)				\
 		iowrite8(0, iobase + MAC_REG_PAGE1SEL)
@@ -685,7 +684,7 @@ do {									\
 	unsigned long dwOrgValue;					\
 	dwOrgValue = ioread32(iobase + MAC_REG_ENCFG);		\
 	dwOrgValue = dwOrgValue | ENCFG_PROTECTMD;			\
-	VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue);		\
+	iowrite32((u32)(dwOrgValue), iobase + MAC_REG_ENCFG);		\
 } while (0)
 
 #define MACvDisableProtectMD(iobase)					\
@@ -693,7 +692,7 @@ do {									\
 	unsigned long dwOrgValue;					\
 	dwOrgValue = ioread32(iobase + MAC_REG_ENCFG);		\
 	dwOrgValue = dwOrgValue & ~ENCFG_PROTECTMD;			\
-	VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue);		\
+	iowrite32((u32)(dwOrgValue), iobase + MAC_REG_ENCFG);		\
 } while (0)
 
 #define MACvEnableBarkerPreambleMd(iobase)				\
@@ -701,7 +700,7 @@ do {									\
 	unsigned long dwOrgValue;					\
 	dwOrgValue = ioread32(iobase + MAC_REG_ENCFG);		\
 	dwOrgValue = dwOrgValue | ENCFG_BARKERPREAM;			\
-	VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue);		\
+	iowrite32((u32)(dwOrgValue), iobase + MAC_REG_ENCFG);		\
 } while (0)
 
 #define MACvDisableBarkerPreambleMd(iobase)				\
@@ -709,7 +708,7 @@ do {									\
 	unsigned long dwOrgValue;					\
 	dwOrgValue = ioread32(iobase + MAC_REG_ENCFG);		\
 	dwOrgValue = dwOrgValue & ~ENCFG_BARKERPREAM;			\
-	VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue);		\
+	iowrite32((u32)(dwOrgValue), iobase + MAC_REG_ENCFG);		\
 } while (0)
 
 #define MACvSetBBType(iobase, byTyp)					\
@@ -718,7 +717,7 @@ do {									\
 	dwOrgValue = ioread32(iobase + MAC_REG_ENCFG);		\
 	dwOrgValue = dwOrgValue & ~ENCFG_BBTYPE_MASK;			\
 	dwOrgValue = dwOrgValue | (unsigned long)byTyp;			\
-	VNSvOutPortD(iobase + MAC_REG_ENCFG, dwOrgValue);		\
+	iowrite32((u32)(dwOrgValue), iobase + MAC_REG_ENCFG);		\
 } while (0)
 
 #define MACvGPIOIn(iobase, pbyValue)					\
diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c
index 76c651d4da31..fbbf2ce80120 100644
--- a/drivers/staging/vt6655/rf.c
+++ b/drivers/staging/vt6655/rf.c
@@ -171,7 +171,7 @@ bool IFRFbWriteEmbedded(struct vnt_private *priv, unsigned long dwData)
 	unsigned short ww;
 	unsigned long dwValue;
 
-	VNSvOutPortD(iobase + MAC_REG_IFREGCTL, dwData);
+	iowrite32(dwData, iobase + MAC_REG_IFREGCTL);
 
 	/* W_MAX_TIMEOUT is the timeout period */
 	for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h
index c14b4d98c466..904a299cccb5 100644
--- a/drivers/staging/vt6655/upc.h
+++ b/drivers/staging/vt6655/upc.h
@@ -20,9 +20,6 @@
 
 /* For memory mapped IO */
 
-#define VNSvOutPortD(dwIOAddress, dwData) \
-	iowrite32((u32)(dwData), dwIOAddress)
-
 #define PCAvDelayByIO(uDelayUnit)				\
 do {								\
 	unsigned char __maybe_unused byData;			\
-- 
2.25.1


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

* [PATCH v3 7/7] staging: vt6655: Remove macro PCAvDelayByIO
  2022-04-11 20:49 [PATCH v3 0/7] staging: vt6655: Fix CamelCase in upc.h and started in mac.h Philipp Hortmann
                   ` (5 preceding siblings ...)
  2022-04-11 20:49 ` [PATCH v3 6/7] staging: vt6655: Replace VNSvOutPortD with iowrite32 Philipp Hortmann
@ 2022-04-11 20:49 ` Philipp Hortmann
  6 siblings, 0 replies; 13+ messages in thread
From: Philipp Hortmann @ 2022-04-11 20:49 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Remove do-while(0) and CamelCase macro PCAvDelayByIO as
it is not accepted by checkpatch.pl
As the macro is just used once with a constant <= 50 the
functionality of the macro is implemented by using
udelay() directly.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: Changed converting macro to function to delete macro
          This patch was 7/7 and is now 6/6
V2 -> V3: No changes
          This patch was 6/6 and is now 7/7
---
 drivers/staging/vt6655/srom.c |  2 +-
 drivers/staging/vt6655/upc.h  | 13 -------------
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/staging/vt6655/srom.c b/drivers/staging/vt6655/srom.c
index 7feaa5138de0..e3ee76f09e0c 100644
--- a/drivers/staging/vt6655/srom.c
+++ b/drivers/staging/vt6655/srom.c
@@ -80,7 +80,7 @@ unsigned char SROMbyReadEmbedded(void __iomem *iobase,
 			byWait = ioread8(iobase + MAC_REG_I2MCSR);
 			if (byWait & (I2MCSR_DONE | I2MCSR_NACK))
 				break;
-			PCAvDelayByIO(CB_DELAY_LOOP_WAIT);
+			udelay(CB_DELAY_LOOP_WAIT);
 		}
 		if ((wDelay < W_MAX_TIMEOUT) &&
 		    (!(byWait & I2MCSR_NACK))) {
diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h
index 904a299cccb5..c7966a638fde 100644
--- a/drivers/staging/vt6655/upc.h
+++ b/drivers/staging/vt6655/upc.h
@@ -20,19 +20,6 @@
 
 /* For memory mapped IO */
 
-#define PCAvDelayByIO(uDelayUnit)				\
-do {								\
-	unsigned char __maybe_unused byData;			\
-	unsigned long ii;					\
-								\
-	if (uDelayUnit <= 50) {					\
-		udelay(uDelayUnit);				\
-	} else {						\
-		for (ii = 0; ii < (uDelayUnit); ii++)		\
-			byData = inb(0x61);			\
-	}							\
-} while (0)
-
 /*---------------------  Export Classes  ----------------------------*/
 
 /*---------------------  Export Variables  --------------------------*/
-- 
2.25.1


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

* Re: [PATCH v3 4/7] staging: vt6655: Replace VNSvOutPortB with iowrite8
  2022-04-11 20:49 ` [PATCH v3 4/7] staging: vt6655: Replace VNSvOutPortB with iowrite8 Philipp Hortmann
@ 2022-04-12  6:37   ` Dan Carpenter
  2022-04-12  6:45     ` Philipp Hortmann
  0 siblings, 1 reply; 13+ messages in thread
From: Dan Carpenter @ 2022-04-12  6:37 UTC (permalink / raw)
  To: Philipp Hortmann
  Cc: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

On Mon, Apr 11, 2022 at 10:49:39PM +0200, Philipp Hortmann wrote:
> Replace macro VNSvOutPortB with iowrite8.
> The name of macro and the arguments use CamelCase which
> is not accepted by checkpatch.pl
> 
> For constants from 0 to below 0x80 the u8 cast was omitted.
> For variables which are defined as unsigned char the u8 is omitted.

I hate that GCC prints warnings for this.  Useless.  Horrible.  But I
understand that GCC does and we haven't figured out how to disable it
or who needs to approve that.

But even then I still don't understand the casting in this patch.

Shouldn't the rule be to do the minimum work arounds to silence GCC?
My understand is that the the casting is only needed when you're dealing
with a bitwise negated constant.  These are macros so the parameters
might be constant so basically any bitwise negate gets a cast.

>  #define MACvWordRegBitsOff(iobase, byRegOfs, wBits)			\
> @@ -578,37 +578,30 @@ do {									\
>  
>  #define MACvWriteBSSIDAddress(iobase, pbyEtherAddr)		\
>  do {								\
> -	VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1);		\
> -	VNSvOutPortB(iobase + MAC_REG_BSSID0,			\
> -		     *(pbyEtherAddr));				\
> -	VNSvOutPortB(iobase + MAC_REG_BSSID0 + 1,		\
> -		     *(pbyEtherAddr + 1));			\
> -	VNSvOutPortB(iobase + MAC_REG_BSSID0 + 2,		\
> -		     *(pbyEtherAddr + 2));			\
> -	VNSvOutPortB(iobase + MAC_REG_BSSID0 + 3,		\
> -		     *(pbyEtherAddr + 3));			\
> -	VNSvOutPortB(iobase + MAC_REG_BSSID0 + 4,		\
> -		     *(pbyEtherAddr + 4));			\
> -	VNSvOutPortB(iobase + MAC_REG_BSSID0 + 5,		\
> -		     *(pbyEtherAddr + 5));			\
> -	VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 0);		\
> +	iowrite8(1, iobase + MAC_REG_PAGE1SEL);		\
> +	iowrite8((u8)*(pbyEtherAddr), iobase + MAC_REG_BSSID0);				\
> +	iowrite8((u8)*(pbyEtherAddr + 1), iobase + MAC_REG_BSSID0 + 1);			\
> +	iowrite8((u8)*(pbyEtherAddr + 2), iobase + MAC_REG_BSSID0 + 2);			\
> +	iowrite8((u8)*(pbyEtherAddr + 3), iobase + MAC_REG_BSSID0 + 3);			\
> +	iowrite8((u8)*(pbyEtherAddr + 4), iobase + MAC_REG_BSSID0 + 4);			\
> +	iowrite8((u8)*(pbyEtherAddr + 5), iobase + MAC_REG_BSSID0 + 5);			\
> +	iowrite8(0, iobase + MAC_REG_PAGE1SEL);		\
>  } while (0)


If these casts are required then the pointer math is wrong.  #SeriousBug
I looked at the caller and these casts are not required.  Just remove
the casts.

>  #define MACvClearStckDS(iobase)					\
>  do {									\
>  	unsigned char byOrgValue;					\
>  	byOrgValue = ioread8(iobase + MAC_REG_STICKHW);		\
>  	byOrgValue = byOrgValue & 0xFC;					\
> -	VNSvOutPortB(iobase + MAC_REG_STICKHW, byOrgValue);		\
> +	iowrite8((u8)byOrgValue, iobase + MAC_REG_STICKHW);		\
>  } while (0)

This cast is definitely not required.  byOrgValue is declared as local
to the block so we know it's unsigned char.

> diff --git a/drivers/staging/vt6655/srom.c b/drivers/staging/vt6655/srom.c
> index a0432bacb6a0..7feaa5138de0 100644
> --- a/drivers/staging/vt6655/srom.c
> +++ b/drivers/staging/vt6655/srom.c
> @@ -68,13 +68,13 @@ unsigned char SROMbyReadEmbedded(void __iomem *iobase,
>  	byData = 0xFF;
>  	byOrg = ioread8(iobase + MAC_REG_I2MCFG);
>  	/* turn off hardware retry for getting NACK */
> -	VNSvOutPortB(iobase + MAC_REG_I2MCFG, (byOrg & (~I2MCFG_NORETRY)));
> +	iowrite8((u8)(byOrg & (~I2MCFG_NORETRY)), iobase + MAC_REG_I2MCFG);

In this case we have a bitwise negate but it's ANDed with a u8 so there
is no cast required (hopefully 0_0).

regards,
dan carpenter


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

* Re: [PATCH v3 4/7] staging: vt6655: Replace VNSvOutPortB with iowrite8
  2022-04-12  6:37   ` Dan Carpenter
@ 2022-04-12  6:45     ` Philipp Hortmann
  2022-04-12  6:56       ` Dan Carpenter
  2022-04-12 13:40       ` Greg Kroah-Hartman
  0 siblings, 2 replies; 13+ messages in thread
From: Philipp Hortmann @ 2022-04-12  6:45 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

On 4/12/22 08:37, Dan Carpenter wrote:
> On Mon, Apr 11, 2022 at 10:49:39PM +0200, Philipp Hortmann wrote:
>> Replace macro VNSvOutPortB with iowrite8.
>> The name of macro and the arguments use CamelCase which
>> is not accepted by checkpatch.pl
>>
>> For constants from 0 to below 0x80 the u8 cast was omitted.
>> For variables which are defined as unsigned char the u8 is omitted.
> I hate that GCC prints warnings for this.  Useless.  Horrible.  But I
> understand that GCC does and we haven't figured out how to disable it
> or who needs to approve that.
> 
> But even then I still don't understand the casting in this patch.
> 
> Shouldn't the rule be to do the minimum work arounds to silence GCC?
> My understand is that the the casting is only needed when you're dealing
> with a bitwise negated constant.  These are macros so the parameters
> might be constant so basically any bitwise negate gets a cast.
> 

Please send me the compiler flags you are using.
I was using:
make "KCFLAGS=-pipe -Wall" -C . M=drivers/staging/vt6655/
But of course more flags are set.
I did not see any compiler warnings.

Thanks

Regards,
Philipp Hortmann

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

* Re: [PATCH v3 4/7] staging: vt6655: Replace VNSvOutPortB with iowrite8
  2022-04-12  6:45     ` Philipp Hortmann
@ 2022-04-12  6:56       ` Dan Carpenter
  2022-04-12 13:40       ` Greg Kroah-Hartman
  1 sibling, 0 replies; 13+ messages in thread
From: Dan Carpenter @ 2022-04-12  6:56 UTC (permalink / raw)
  To: Philipp Hortmann
  Cc: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

On Tue, Apr 12, 2022 at 08:45:53AM +0200, Philipp Hortmann wrote:
> On 4/12/22 08:37, Dan Carpenter wrote:
> > On Mon, Apr 11, 2022 at 10:49:39PM +0200, Philipp Hortmann wrote:
> > > Replace macro VNSvOutPortB with iowrite8.
> > > The name of macro and the arguments use CamelCase which
> > > is not accepted by checkpatch.pl
> > > 
> > > For constants from 0 to below 0x80 the u8 cast was omitted.
> > > For variables which are defined as unsigned char the u8 is omitted.
> > I hate that GCC prints warnings for this.  Useless.  Horrible.  But I
> > understand that GCC does and we haven't figured out how to disable it
> > or who needs to approve that.
> > 
> > But even then I still don't understand the casting in this patch.
> > 
> > Shouldn't the rule be to do the minimum work arounds to silence GCC?
> > My understand is that the the casting is only needed when you're dealing
> > with a bitwise negated constant.  These are macros so the parameters
> > might be constant so basically any bitwise negate gets a cast.
> > 
> 
> Please send me the compiler flags you are using.
> I was using:
> make "KCFLAGS=-pipe -Wall" -C . M=drivers/staging/vt6655/
> But of course more flags are set.
> I did not see any compiler warnings.

I think I was not clear.

Why are you doing these casts?  I do not like any of them, and wish we
could remove them.

My understanding is that if you remove the casts kbuild will complain
and the build will fail on certain architectures.  But I have not tried
to compile this.  If we can remove all the casting let's do that, but
if we can only remove some then lets do that.

regards,
dan carpenter


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

* Re: [PATCH v3 4/7] staging: vt6655: Replace VNSvOutPortB with iowrite8
  2022-04-12  6:45     ` Philipp Hortmann
  2022-04-12  6:56       ` Dan Carpenter
@ 2022-04-12 13:40       ` Greg Kroah-Hartman
  1 sibling, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2022-04-12 13:40 UTC (permalink / raw)
  To: Philipp Hortmann; +Cc: Dan Carpenter, Forest Bond, linux-staging, linux-kernel

On Tue, Apr 12, 2022 at 08:45:53AM +0200, Philipp Hortmann wrote:
> On 4/12/22 08:37, Dan Carpenter wrote:
> > On Mon, Apr 11, 2022 at 10:49:39PM +0200, Philipp Hortmann wrote:
> > > Replace macro VNSvOutPortB with iowrite8.
> > > The name of macro and the arguments use CamelCase which
> > > is not accepted by checkpatch.pl
> > > 
> > > For constants from 0 to below 0x80 the u8 cast was omitted.
> > > For variables which are defined as unsigned char the u8 is omitted.
> > I hate that GCC prints warnings for this.  Useless.  Horrible.  But I
> > understand that GCC does and we haven't figured out how to disable it
> > or who needs to approve that.
> > 
> > But even then I still don't understand the casting in this patch.
> > 
> > Shouldn't the rule be to do the minimum work arounds to silence GCC?
> > My understand is that the the casting is only needed when you're dealing
> > with a bitwise negated constant.  These are macros so the parameters
> > might be constant so basically any bitwise negate gets a cast.
> > 
> 
> Please send me the compiler flags you are using.
> I was using:
> make "KCFLAGS=-pipe -Wall" -C . M=drivers/staging/vt6655/

Why are you adding random flags to the build?  Just stick with the
default ones, that's all you need.

thanks,

greg k-h

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

* Re: [PATCH v3 1/7] staging: vt6655: Replace VNSvInPortB with ioread8
  2022-04-11 20:49 ` [PATCH v3 1/7] staging: vt6655: Replace VNSvInPortB with ioread8 Philipp Hortmann
@ 2022-04-12 13:44   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2022-04-12 13:44 UTC (permalink / raw)
  To: Philipp Hortmann; +Cc: Forest Bond, linux-staging, linux-kernel

On Mon, Apr 11, 2022 at 10:49:20PM +0200, Philipp Hortmann wrote:
> Replace macro VNSvInPortB with ioread8.
> The name of macro and the arguments use CamelCase which
> is not accepted by checkpatch.pl
> 
> Since there are more than one checkpatch issue per line,
> more steps are rquired to fix.
> 
> Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
> ---
> V1 -> V2: This patch was 4/7 and is now 3/6
> V2 -> V3: Changed from rename macro arguments to replace
>           macro VNSvInPortB with ioread8
>           This patch was 3/6 and is now 1/7
> ---
>  drivers/staging/vt6655/baseband.c    |  6 +++---
>  drivers/staging/vt6655/card.c        |  2 +-
>  drivers/staging/vt6655/device_main.c |  4 ++--
>  drivers/staging/vt6655/mac.h         | 26 ++++++++++----------------
>  drivers/staging/vt6655/srom.c        |  6 +++---
>  drivers/staging/vt6655/upc.h         |  3 ---
>  6 files changed, 19 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
> index dfdb0ebf43b5..decb55e96f02 100644
> --- a/drivers/staging/vt6655/baseband.c
> +++ b/drivers/staging/vt6655/baseband.c
> @@ -1916,13 +1916,13 @@ bool bb_read_embedded(struct vnt_private *priv, unsigned char by_bb_addr,
>  	MACvRegBitsOn(iobase, MAC_REG_BBREGCTL, BBREGCTL_REGR);
>  	/* W_MAX_TIMEOUT is the timeout period */
>  	for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
> -		VNSvInPortB(iobase + MAC_REG_BBREGCTL, &by_value);
> +		by_value = ioread8(iobase + MAC_REG_BBREGCTL);

This type of change is great, but...

> @@ -597,18 +597,12 @@ do {								\
>  #define MACvReadEtherAddress(iobase, pbyEtherAddr)		\
>  do {								\
>  	VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1);		\
> -	VNSvInPortB(iobase + MAC_REG_PAR0,			\
> -		    (unsigned char *)pbyEtherAddr);		\
> -	VNSvInPortB(iobase + MAC_REG_PAR0 + 1,		\
> -		    pbyEtherAddr + 1);				\
> -	VNSvInPortB(iobase + MAC_REG_PAR0 + 2,		\
> -		    pbyEtherAddr + 2);				\
> -	VNSvInPortB(iobase + MAC_REG_PAR0 + 3,		\
> -		    pbyEtherAddr + 3);				\
> -	VNSvInPortB(iobase + MAC_REG_PAR0 + 4,		\
> -		    pbyEtherAddr + 4);				\
> -	VNSvInPortB(iobase + MAC_REG_PAR0 + 5,		\
> -		    pbyEtherAddr + 5);				\
> +	(*((unsigned char *)pbyEtherAddr) = ioread8(iobase + MAC_REG_PAR0));		\

Why cast one and not all?  No casts should be needed.  If so, the caller
is wrong.

> +	(*(pbyEtherAddr + 1) = ioread8(iobase + MAC_REG_PAR0 + 1));	\

That's odd.

Ok, I guess it's an array, right?  How about:
	pbyEtherAddr[0] = ioread8(iobase + MAC_REG_PAR0);	\
	pbyEtherAddr[1] = ioread8(iobase + MAC_REG_PAR0 + 1);	\
and so on?

Much simpler and easier to understand.

And then there's this odd stuff:

>  #define MACvGPIOIn(iobase, pbyValue)					\
> -	VNSvInPortB(iobase + MAC_REG_GPIOCTL1, pbyValue)
> +	*(pbyValue) = ioread8(iobase + MAC_REG_GPIOCTL1)

pbyValue?  unwind this first, you should be able to just have a normal
ioread() call, right?

Or, make it a function.

thanks,

greg k-h

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

end of thread, other threads:[~2022-04-12 13:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 20:49 [PATCH v3 0/7] staging: vt6655: Fix CamelCase in upc.h and started in mac.h Philipp Hortmann
2022-04-11 20:49 ` [PATCH v3 1/7] staging: vt6655: Replace VNSvInPortB with ioread8 Philipp Hortmann
2022-04-12 13:44   ` Greg Kroah-Hartman
2022-04-11 20:49 ` [PATCH v3 2/7] staging: vt6655: Replace VNSvInPortW with ioread16 Philipp Hortmann
2022-04-11 20:49 ` [PATCH v3 3/7] staging: vt6655: Replace VNSvInPortD with ioread32 Philipp Hortmann
2022-04-11 20:49 ` [PATCH v3 4/7] staging: vt6655: Replace VNSvOutPortB with iowrite8 Philipp Hortmann
2022-04-12  6:37   ` Dan Carpenter
2022-04-12  6:45     ` Philipp Hortmann
2022-04-12  6:56       ` Dan Carpenter
2022-04-12 13:40       ` Greg Kroah-Hartman
2022-04-11 20:49 ` [PATCH v3 5/7] staging: vt6655: Replace VNSvOutPortW with iowrite16 Philipp Hortmann
2022-04-11 20:49 ` [PATCH v3 6/7] staging: vt6655: Replace VNSvOutPortD with iowrite32 Philipp Hortmann
2022-04-11 20:49 ` [PATCH v3 7/7] staging: vt6655: Remove macro PCAvDelayByIO Philipp Hortmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.