All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] staging: vt6655: Convert four macros to one function
@ 2022-07-29  8:14 Philipp Hortmann
  2022-07-29  8:14 ` [PATCH v2 1/5] staging: vt6655: Convert macro MACvReceive0 to function Philipp Hortmann
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Philipp Hortmann @ 2022-07-29  8:14 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Convert four multiline macros to one function with parameter. Multiline
macros are not liked by kernel community.

Tested with vt6655 on mini PCI Module
Transferred this patch over wlan connection of vt6655

V1 -> V2: Combined patch "Rename dwData to reg_value in four ..." with
          patch "Convert macro MACvReceive0 to function"
          Combined patch "Add parameter to function vt6655_m ..." with
          patch "Rename function MACvReceive0 and add parameter"
          Changed order of renaming function and conversion to function
          Improved to early line breaks in patch descriptions
          Removed function declaration of vt6655_mac_dma_ctl
          Changed variable declaration in vt6655_mac_dma_ctl
          Improved patch descriptions

Philipp Hortmann (5):
  staging: vt6655: Convert macro MACvReceive0 to function
  staging: vt6655: Rename function MACvReceive0 and add parameter
  staging: vt6655: Replace MACvReceive1 with function vt6655_mac_dma_ctl
  staging: vt6655: Replace MACvTransmit0 with function
    vt6655_mac_dma_ctl
  staging: vt6655: Replace MACvTransmitAC0 with function
    vt6655_mac_dma_ctl

 drivers/staging/vt6655/device_main.c | 23 +++++++++++-----
 drivers/staging/vt6655/mac.h         | 40 ----------------------------
 2 files changed, 17 insertions(+), 46 deletions(-)

-- 
2.37.1


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

* [PATCH v2 1/5] staging: vt6655: Convert macro MACvReceive0 to function
  2022-07-29  8:14 [PATCH v2 0/5] staging: vt6655: Convert four macros to one function Philipp Hortmann
@ 2022-07-29  8:14 ` Philipp Hortmann
  2022-07-29  8:14 ` [PATCH v2 2/5] staging: vt6655: Rename function MACvReceive0 and add parameter Philipp Hortmann
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Hortmann @ 2022-07-29  8:14 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Convert macro to static function. Multiline macros are not liked by
kernel community. Rename variable dwData to reg_value to avoid
CamelCase which is not accepted by checkpatch.pl. Change variable
declaration to u32 as this improves readability.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: Combind patch "Rename dwData to reg_value ..." with this one
          Changed order of renaming function and conversion to function
          Removed function declaration
          Changed variable declaration
          Improved patch description
---
 drivers/staging/vt6655/device_main.c | 11 +++++++++++
 drivers/staging/vt6655/mac.h         | 10 ----------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 92583ee8bffd..39bfbb1ab742 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -205,6 +205,17 @@ static void vt6655_mac_read_ether_addr(void __iomem *iobase, u8 *mac_addr)
 	iowrite8(0, iobase + MAC_REG_PAGE1SEL);
 }
 
+static void MACvReceive0(void __iomem *iobase)
+{
+	u32 reg_value;
+
+	reg_value = ioread32(iobase + MAC_REG_RXDMACTL0);
+	if (reg_value & DMACTL_RUN)
+		iowrite32(DMACTL_WAKE, iobase + MAC_REG_RXDMACTL0);
+	else
+		iowrite32(DMACTL_RUN, iobase + MAC_REG_RXDMACTL0);
+}
+
 /*
  * Initialisation of MAC & BBP registers
  */
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 0122c4603c66..d21313f3067e 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -537,16 +537,6 @@
 
 /*---------------------  Export Macros ------------------------------*/
 
-#define MACvReceive0(iobase)						\
-do {									\
-	unsigned long dwData;						\
-	dwData = ioread32(iobase + MAC_REG_RXDMACTL0);			\
-	if (dwData & DMACTL_RUN)					\
-		iowrite32(DMACTL_WAKE, iobase + MAC_REG_RXDMACTL0);	\
-	else								\
-		iowrite32(DMACTL_RUN, iobase + MAC_REG_RXDMACTL0);	\
-} while (0)
-
 #define MACvReceive1(iobase)						\
 do {									\
 	unsigned long dwData;						\
-- 
2.37.1


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

* [PATCH v2 2/5] staging: vt6655: Rename function MACvReceive0 and add parameter
  2022-07-29  8:14 [PATCH v2 0/5] staging: vt6655: Convert four macros to one function Philipp Hortmann
  2022-07-29  8:14 ` [PATCH v2 1/5] staging: vt6655: Convert macro MACvReceive0 to function Philipp Hortmann
@ 2022-07-29  8:14 ` Philipp Hortmann
  2022-07-29  8:14 ` [PATCH v2 3/5] staging: vt6655: Replace MACvReceive1 with function vt6655_mac_dma_ctl Philipp Hortmann
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Hortmann @ 2022-07-29  8:14 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Rename MACvReceive0 function to vt6655_mac_dma_ctl to avoid CamelCase
which is not accepted by checkpatch.pl and to clean up namespace. Add
one parameter to avoid multiple repetitions of the same function.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: Combind patch "Add parameter to function vt..." with this one
          Changed order of renaming function and conversion to function
          Improved patch description
---
 drivers/staging/vt6655/device_main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 39bfbb1ab742..fb40d71d9e8e 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -205,15 +205,15 @@ static void vt6655_mac_read_ether_addr(void __iomem *iobase, u8 *mac_addr)
 	iowrite8(0, iobase + MAC_REG_PAGE1SEL);
 }
 
-static void MACvReceive0(void __iomem *iobase)
+static void vt6655_mac_dma_ctl(void __iomem *iobase, u8 reg_index)
 {
 	u32 reg_value;
 
-	reg_value = ioread32(iobase + MAC_REG_RXDMACTL0);
+	reg_value = ioread32(iobase + reg_index);
 	if (reg_value & DMACTL_RUN)
-		iowrite32(DMACTL_WAKE, iobase + MAC_REG_RXDMACTL0);
+		iowrite32(DMACTL_WAKE, iobase + reg_index);
 	else
-		iowrite32(DMACTL_RUN, iobase + MAC_REG_RXDMACTL0);
+		iowrite32(DMACTL_RUN, iobase + reg_index);
 }
 
 /*
@@ -431,7 +431,7 @@ static void device_init_registers(struct vnt_private *priv)
 		vt6655_mac_reg_bits_on(priv->port_offset, MAC_REG_RCR, RCR_WPAERR);
 
 	/* Turn On Rx DMA */
-	MACvReceive0(priv->port_offset);
+	vt6655_mac_dma_ctl(priv->port_offset, MAC_REG_RXDMACTL0);
 	MACvReceive1(priv->port_offset);
 
 	/* start the adapter */
@@ -1146,7 +1146,7 @@ static void vnt_interrupt_process(struct vnt_private *priv)
 
 		isr = ioread32(priv->port_offset + MAC_REG_ISR);
 
-		MACvReceive0(priv->port_offset);
+		vt6655_mac_dma_ctl(priv->port_offset, MAC_REG_RXDMACTL0);
 		MACvReceive1(priv->port_offset);
 
 		if (max_count > priv->opts.int_works)
-- 
2.37.1


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

* [PATCH v2 3/5] staging: vt6655: Replace MACvReceive1 with function vt6655_mac_dma_ctl
  2022-07-29  8:14 [PATCH v2 0/5] staging: vt6655: Convert four macros to one function Philipp Hortmann
  2022-07-29  8:14 ` [PATCH v2 1/5] staging: vt6655: Convert macro MACvReceive0 to function Philipp Hortmann
  2022-07-29  8:14 ` [PATCH v2 2/5] staging: vt6655: Rename function MACvReceive0 and add parameter Philipp Hortmann
@ 2022-07-29  8:14 ` Philipp Hortmann
  2022-07-29  8:14 ` [PATCH v2 4/5] staging: vt6655: Replace MACvTransmit0 " Philipp Hortmann
  2022-07-29  8:14 ` [PATCH v2 5/5] staging: vt6655: Replace MACvTransmitAC0 " Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Hortmann @ 2022-07-29  8:14 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Convert macro MACvReceive1 to existing static function. This saves
codelines and multiline macros are not liked by kernel community.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: Improved description
---
 drivers/staging/vt6655/device_main.c |  4 ++--
 drivers/staging/vt6655/mac.h         | 10 ----------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index fb40d71d9e8e..554531411dad 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -432,7 +432,7 @@ static void device_init_registers(struct vnt_private *priv)
 
 	/* Turn On Rx DMA */
 	vt6655_mac_dma_ctl(priv->port_offset, MAC_REG_RXDMACTL0);
-	MACvReceive1(priv->port_offset);
+	vt6655_mac_dma_ctl(priv->port_offset, MAC_REG_RXDMACTL1);
 
 	/* start the adapter */
 	iowrite8(HOSTCR_MACEN | HOSTCR_RXON | HOSTCR_TXON, priv->port_offset + MAC_REG_HOSTCR);
@@ -1147,7 +1147,7 @@ static void vnt_interrupt_process(struct vnt_private *priv)
 		isr = ioread32(priv->port_offset + MAC_REG_ISR);
 
 		vt6655_mac_dma_ctl(priv->port_offset, MAC_REG_RXDMACTL0);
-		MACvReceive1(priv->port_offset);
+		vt6655_mac_dma_ctl(priv->port_offset, MAC_REG_RXDMACTL1);
 
 		if (max_count > priv->opts.int_works)
 			break;
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index d21313f3067e..5a473ca393f2 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -537,16 +537,6 @@
 
 /*---------------------  Export Macros ------------------------------*/
 
-#define MACvReceive1(iobase)						\
-do {									\
-	unsigned long dwData;						\
-	dwData = ioread32(iobase + MAC_REG_RXDMACTL1);			\
-	if (dwData & DMACTL_RUN)					\
-		iowrite32(DMACTL_WAKE, iobase + MAC_REG_RXDMACTL1);	\
-	else								\
-		iowrite32(DMACTL_RUN, iobase + MAC_REG_RXDMACTL1);	\
-} while (0)
-
 #define MACvTransmit0(iobase)						\
 do {									\
 	unsigned long dwData;						\
-- 
2.37.1


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

* [PATCH v2 4/5] staging: vt6655: Replace MACvTransmit0 with function vt6655_mac_dma_ctl
  2022-07-29  8:14 [PATCH v2 0/5] staging: vt6655: Convert four macros to one function Philipp Hortmann
                   ` (2 preceding siblings ...)
  2022-07-29  8:14 ` [PATCH v2 3/5] staging: vt6655: Replace MACvReceive1 with function vt6655_mac_dma_ctl Philipp Hortmann
@ 2022-07-29  8:14 ` Philipp Hortmann
  2022-07-29  8:14 ` [PATCH v2 5/5] staging: vt6655: Replace MACvTransmitAC0 " Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Hortmann @ 2022-07-29  8:14 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Convert macro MACvTransmit0 to existing static function. This saves
codelines and multiline macros are not liked by kernel community.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: Improved description
---
 drivers/staging/vt6655/device_main.c |  2 +-
 drivers/staging/vt6655/mac.h         | 10 ----------
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 554531411dad..c0a00063e4d1 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1231,7 +1231,7 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)
 	if (head_td->td_info->flags & TD_FLAGS_NETIF_SKB)
 		MACvTransmitAC0(priv->port_offset);
 	else
-		MACvTransmit0(priv->port_offset);
+		vt6655_mac_dma_ctl(priv->port_offset, MAC_REG_TXDMACTL0);
 
 	priv->iTDUsed[dma_idx]++;
 
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 5a473ca393f2..be33da59dd84 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -537,16 +537,6 @@
 
 /*---------------------  Export Macros ------------------------------*/
 
-#define MACvTransmit0(iobase)						\
-do {									\
-	unsigned long dwData;						\
-	dwData = ioread32(iobase + MAC_REG_TXDMACTL0);			\
-	if (dwData & DMACTL_RUN)					\
-		iowrite32(DMACTL_WAKE, iobase + MAC_REG_TXDMACTL0);	\
-	else								\
-		iowrite32(DMACTL_RUN, iobase + MAC_REG_TXDMACTL0);	\
-} while (0)
-
 #define MACvTransmitAC0(iobase)					\
 do {									\
 	unsigned long dwData;						\
-- 
2.37.1


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

* [PATCH v2 5/5] staging: vt6655: Replace MACvTransmitAC0 with function vt6655_mac_dma_ctl
  2022-07-29  8:14 [PATCH v2 0/5] staging: vt6655: Convert four macros to one function Philipp Hortmann
                   ` (3 preceding siblings ...)
  2022-07-29  8:14 ` [PATCH v2 4/5] staging: vt6655: Replace MACvTransmit0 " Philipp Hortmann
@ 2022-07-29  8:14 ` Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Hortmann @ 2022-07-29  8:14 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, linux-staging, linux-kernel

Convert macro MACvTransmitAC0 to existing static function. This saves
codelines and multiline macros are not liked by kernel community.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
V1 -> V2: Improved description
---
 drivers/staging/vt6655/device_main.c |  2 +-
 drivers/staging/vt6655/mac.h         | 10 ----------
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index c0a00063e4d1..1fc8bdf8a311 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1229,7 +1229,7 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)
 	wmb(); /* second memory barrier */
 
 	if (head_td->td_info->flags & TD_FLAGS_NETIF_SKB)
-		MACvTransmitAC0(priv->port_offset);
+		vt6655_mac_dma_ctl(priv->port_offset, MAC_REG_AC0DMACTL);
 	else
 		vt6655_mac_dma_ctl(priv->port_offset, MAC_REG_TXDMACTL0);
 
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index be33da59dd84..467c599a3289 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -537,16 +537,6 @@
 
 /*---------------------  Export Macros ------------------------------*/
 
-#define MACvTransmitAC0(iobase)					\
-do {									\
-	unsigned long dwData;						\
-	dwData = ioread32(iobase + MAC_REG_AC0DMACTL);			\
-	if (dwData & DMACTL_RUN)					\
-		iowrite32(DMACTL_WAKE, iobase + MAC_REG_AC0DMACTL);	\
-	else								\
-		iowrite32(DMACTL_RUN, iobase + MAC_REG_AC0DMACTL);	\
-} while (0)
-
 #define MACvSelectPage0(iobase)				\
 	iowrite8(0, iobase + MAC_REG_PAGE1SEL)
 
-- 
2.37.1


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

end of thread, other threads:[~2022-07-29  8:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-29  8:14 [PATCH v2 0/5] staging: vt6655: Convert four macros to one function Philipp Hortmann
2022-07-29  8:14 ` [PATCH v2 1/5] staging: vt6655: Convert macro MACvReceive0 to function Philipp Hortmann
2022-07-29  8:14 ` [PATCH v2 2/5] staging: vt6655: Rename function MACvReceive0 and add parameter Philipp Hortmann
2022-07-29  8:14 ` [PATCH v2 3/5] staging: vt6655: Replace MACvReceive1 with function vt6655_mac_dma_ctl Philipp Hortmann
2022-07-29  8:14 ` [PATCH v2 4/5] staging: vt6655: Replace MACvTransmit0 " Philipp Hortmann
2022-07-29  8:14 ` [PATCH v2 5/5] staging: vt6655: Replace MACvTransmitAC0 " 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.