linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] vxge: Remove unnecessary ; in do {} while (0) macro
@ 2012-04-03 21:53 Joe Perches
  2012-04-03 21:58 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2012-04-03 21:53 UTC (permalink / raw)
  To: Jon Mason; +Cc: netdev, linux-kernel

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

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/ethernet/neterion/vxge/vxge-main.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.h b/drivers/net/ethernet/neterion/vxge/vxge-main.h
index f52a42d..372406c 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-main.h
+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.h
@@ -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);



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

* Re: [PATCH net-next] vxge: Remove unnecessary ; in do {} while (0) macro
  2012-04-03 21:53 [PATCH net-next] vxge: Remove unnecessary ; in do {} while (0) macro Joe Perches
@ 2012-04-03 21:58 ` David Miller
  2012-04-03 22:14   ` [PATCH net-next] vxge: Convert macro to inline function Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2012-04-03 21:58 UTC (permalink / raw)
  To: joe; +Cc: jdmason, netdev, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Tue, 03 Apr 2012 14:53:12 -0700

> This macro doesn't need a terminating ; so just remove it.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied, thanks Joe.

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

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

* [PATCH net-next] vxge: Convert macro to inline function
  2012-04-03 21:58 ` David Miller
@ 2012-04-03 22:14   ` Joe Perches
  2012-04-03 22:18     ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2012-04-03 22:14 UTC (permalink / raw)
  To: David Miller; +Cc: jdmason, netdev, linux-kernel

Convert the macro to inline function to check the arguments.

Signed-off-by: Joe Perches <joe@perches.com>
---
> 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(-)

diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c
index ef76725..95fb611 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-main.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c
@@ -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);
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.h b/drivers/net/ethernet/neterion/vxge/vxge-main.h
index f52a42d..35f3e75 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-main.h
+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.h
@@ -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);



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

* Re: [PATCH net-next] vxge: Convert macro to inline function
  2012-04-03 22:14   ` [PATCH net-next] vxge: Convert macro to inline function Joe Perches
@ 2012-04-03 22:18     ` David Miller
  2012-04-04 22:37       ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2012-04-03 22:18 UTC (permalink / raw)
  To: joe; +Cc: jdmason, netdev, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Tue, 03 Apr 2012 15:14:31 -0700

> Convert the macro to inline function to check the arguments.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>> Longer term I'd much rather see this turned into an inline
>> function with proper type checking etc.
> 
> Something like this?

Yep.

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

* Re: [PATCH net-next] vxge: Convert macro to inline function
  2012-04-03 22:18     ` David Miller
@ 2012-04-04 22:37       ` Joe Perches
  2012-04-05  0:33         ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2012-04-04 22:37 UTC (permalink / raw)
  To: David Miller; +Cc: jdmason, netdev, linux-kernel

On Tue, 2012-04-03 at 18:18 -0400, David Miller wrote:
> From: Joe Perches <joe@perches.com>
> Date: Tue, 03 Apr 2012 15:14:31 -0700
> > Convert the macro to inline function to check the arguments.
> > Signed-off-by: Joe Perches <joe@perches.com>
> > ---
> >> 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?




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

* Re: [PATCH net-next] vxge: Convert macro to inline function
  2012-04-04 22:37       ` Joe Perches
@ 2012-04-05  0:33         ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2012-04-05  0:33 UTC (permalink / raw)
  To: joe; +Cc: jdmason, netdev, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Wed, 04 Apr 2012 15:37:55 -0700

> On Tue, 2012-04-03 at 18:18 -0400, David Miller wrote:
>> From: Joe Perches <joe@perches.com>
>> Date: Tue, 03 Apr 2012 15:14:31 -0700
>> > Convert the macro to inline function to check the arguments.
>> > Signed-off-by: Joe Perches <joe@perches.com>
>> > ---
>> >> 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.

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

end of thread, other threads:[~2012-04-05  0:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-03 21:53 [PATCH net-next] vxge: Remove unnecessary ; in do {} while (0) macro Joe Perches
2012-04-03 21:58 ` David Miller
2012-04-03 22:14   ` [PATCH net-next] vxge: Convert macro to inline function Joe Perches
2012-04-03 22:18     ` David Miller
2012-04-04 22:37       ` Joe Perches
2012-04-05  0:33         ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).