diff mbox

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

Message ID 1333491271.2695.20.camel@joe2Laptop
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Joe Perches April 3, 2012, 10:14 p.m. UTC
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(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller April 3, 2012, 10:18 p.m. UTC | #1
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joe Perches April 4, 2012, 10:37 p.m. UTC | #2
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?



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller April 5, 2012, 12:33 a.m. UTC | #3
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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