Skip to contentSkip to conversation

vxge: Remove unnecessary ; in do {} while (0) macro

PATCH Applied Joe Perches 2 participants 6 messages Apr 3, 2012 – Apr 5, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vxge: Remove unnecessary ; in do {} while (0) macro

This macro doesn't need a terminating ; so just remove it.

---
 drivers/net/ethernet/neterion/vxge/vxge-main.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/neterion/vxge/vxge-main.h +1 -1
index f52a42d..372406c 100644
@@ -421,7 +421,7 @@ struct vxge_tx_priv {
 		timer.function = handle; \
 		timer.data = (unsigned long) arg; \
 		mod_timer(&timer, (jiffies + exp)); \
-	} while (0);
+	} while (0)
 
 void vxge_initialize_ethtool_ops(struct net_device *ndev);
 enum vxge_hw_status vxge_reset_all_vpaths(struct vxgedev *vdev);
maintainer Applied
#1 lore raw

From: Joe Perches <[email protected]>
Date: Tue, 03 Apr 2012 14:53:12 -0700

Quoted 3 lines

This macro doesn't need a terminating ; so just remove it.

Applied, thanks Joe.

Longer term I'd much rather see this turned into an inline function with proper type checking etc.

#2 lore raw

PATCH 1/1 vxge: Convert macro to inline function

Convert the macro to inline function to check the arguments.

---

Quoted 2 lines

Longer term I'd much rather see this turned into an inline function with proper type checking etc.

Something like this?

 drivers/net/ethernet/neterion/vxge/vxge-main.c |    6 +++---
 drivers/net/ethernet/neterion/vxge/vxge-main.h |   15 +++++++++------
 2 files changed, 12 insertions(+), 9 deletions(-)
drivers/net/ethernet/neterion/vxge/vxge-main.c +3 -3
index ef76725..95fb611 100644
@@ -2860,12 +2860,12 @@ static int vxge_open(struct net_device *dev)
 		vdev->config.rx_pause_enable);
 
 	if (vdev->vp_reset_timer.function == NULL)
-		vxge_os_timer(vdev->vp_reset_timer,
-			vxge_poll_vp_reset, vdev, (HZ/2));
+		vxge_os_timer(&vdev->vp_reset_timer, vxge_poll_vp_reset, vdev,
+			      HZ / 2);
 
 	/* There is no need to check for RxD leak and RxD lookup on Titan1A */
 	if (vdev->titan1 && vdev->vp_lockup_timer.function == NULL)
-		vxge_os_timer(vdev->vp_lockup_timer, vxge_poll_vp_lockup, vdev,
+		vxge_os_timer(&vdev->vp_lockup_timer, vxge_poll_vp_lockup, vdev,
 			      HZ / 2);
 
 	set_bit(__VXGE_STATE_CARD_UP, &vdev->state);
drivers/net/ethernet/neterion/vxge/vxge-main.h +9 -6
index f52a42d..35f3e75 100644
@@ -416,12 +416,15 @@ struct vxge_tx_priv {
 	static int p = val; \
 	module_param(p, int, 0)
 
-#define vxge_os_timer(timer, handle, arg, exp) do { \
-		init_timer(&timer); \
-		timer.function = handle; \
-		timer.data = (unsigned long) arg; \
-		mod_timer(&timer, (jiffies + exp)); \
-	} while (0)
+static inline
+void vxge_os_timer(struct timer_list *timer, void (*func)(unsigned long data),
+		   struct vxgedev *vdev, unsigned long timeout)
+{
+	init_timer(timer);
+	timer->function = func;
+	timer->data = (unsigned long)vdev;
+	mod_timer(timer, jiffies + timeout);
+}
 
 void vxge_initialize_ethtool_ops(struct net_device *ndev);
 enum vxge_hw_status vxge_reset_all_vpaths(struct vxgedev *vdev);
maintainer
#3 lore raw

Re: [PATCH net-next] vxge: Convert macro to inline function

From: Joe Perches <[email protected]>
Date: Tue, 03 Apr 2012 15:14:31 -0700

Quoted 8 lines

Convert the macro to inline function to check the arguments.

---

Quoted 2 lines

Longer term I'd much rather see this turned into an inline function with proper type checking etc.

Something like this?

Yep.

#4 lore raw

Re: [PATCH net-next] vxge: Convert macro to inline function

Quoted 9 lines · David Miller

From: Joe Perches <[email protected]>
Date: Tue, 03 Apr 2012 15:14:31 -0700

Quoted 6 lines

Convert the macro to inline function to check the arguments.

---

Quoted 2 lines

Longer term I'd much rather see this turned into an inline function with proper type checking etc.

Something like this?

Yep.

I did sign the patch.
I was intending that you could apply it.
Do you want a resend?

maintainer
#5 lore raw

Re: [PATCH net-next] vxge: Convert macro to inline function

From: Joe Perches <[email protected]>
Date: Wed, 04 Apr 2012 15:37:55 -0700

Quoted 6 lines · David Miller
Quoted 5 lines

From: Joe Perches <[email protected]>
Date: Tue, 03 Apr 2012 15:14:31 -0700

Quoted 3 lines

Convert the macro to inline function to check the arguments.

---

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

Longer term I'd much rather see this turned into an inline function with proper type checking etc.

Something like this?

Yep.

I did sign the patch.
I was intending that you could apply it.

Ok, I see now, applied. Thanks Joe.