netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ATM: Fix wrong usage of INIT_WORK
@ 2011-07-07 11:51 stufever
  2011-07-07 11:51 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: stufever @ 2011-07-07 11:51 UTC (permalink / raw)
  To: netdev; +Cc: Wang Shaoyan, Chas Williams, open list:ATM

From: Wang Shaoyan <wangshaoyan.pt@taobao.com>

If we define FILL_RX_POOLS_IN_BH, the compiler will report error such as
  drivers/atm/ambassador.c:2159:64: error: macro "INIT_WORK" passed 3 arguments, but takes just 2
because the function INIT_WORK() don't accept "data" now, it only has
two arguments, so use the right way to initialise work queue.

Cc: Chas Williams <chas@cmf.nrl.navy.mil> (maintainer:ATM)
Cc: linux-atm-general@lists.sourceforge.net (open list:ATM)
Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
---
 drivers/atm/ambassador.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index a5fcb1e..3618c5c 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -814,7 +814,12 @@ static void fill_rx_pool (amb_dev * dev, unsigned char pool,
 }
 
 // top up all RX pools (can also be called as a bottom half)
+#ifdef FILL_RX_POOLS_IN_BH
+static void fill_rx_pools (struct work_struct * work) {
+  amb_dev * dev = container_of(work, amb_dev, bh);
+#else
 static void fill_rx_pools (amb_dev * dev) {
+#endif
   unsigned char pool;
   
   PRINTD (DBG_FLOW|DBG_POOL, "fill_rx_pools %p", dev);
@@ -1503,7 +1508,11 @@ static void do_housekeeping (unsigned long arg) {
   // could collect device-specific (not driver/atm-linux) stats here
       
   // last resort refill once every ten seconds
+#ifdef FILL_RX_POOLS_IN_BH
+  fill_rx_pools (&dev->bh);
+#else
   fill_rx_pools (dev);
+#endif
   mod_timer(&dev->housekeeping, jiffies + 10*HZ);
   
   return;
@@ -2156,7 +2165,7 @@ static void setup_dev(amb_dev *dev, struct pci_dev *pci_dev)
       
 #ifdef FILL_RX_POOLS_IN_BH
       // initialise bottom half
-      INIT_WORK(&dev->bh, (void (*)(void *)) fill_rx_pools, dev);
+      INIT_WORK(&dev->bh, fill_rx_pools);
 #endif
       
       // semaphore for txer/rxer modifications - we cannot use a
-- 
1.7.4.1


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

* Re: [PATCH] ATM: Fix wrong usage of INIT_WORK
  2011-07-07 11:51 [PATCH] ATM: Fix wrong usage of INIT_WORK stufever
@ 2011-07-07 11:51 ` David Miller
  2011-07-07 12:04   ` Wang Shaoyan
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2011-07-07 11:51 UTC (permalink / raw)
  To: stufever; +Cc: netdev, wangshaoyan.pt, chas, linux-atm-general

From: stufever@gmail.com
Date: Thu,  7 Jul 2011 19:51:52 +0800

> From: Wang Shaoyan <wangshaoyan.pt@taobao.com>
> 
> If we define FILL_RX_POOLS_IN_BH, the compiler will report error such as
>   drivers/atm/ambassador.c:2159:64: error: macro "INIT_WORK" passed 3 arguments, but takes just 2
> because the function INIT_WORK() don't accept "data" now, it only has
> two arguments, so use the right way to initialise work queue.
> 
> Cc: Chas Williams <chas@cmf.nrl.navy.mil> (maintainer:ATM)
> Cc: linux-atm-general@lists.sourceforge.net (open list:ATM)
> Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>

This just makes the driver a bigger CPP mess.

Unconditionally provide the dev->bh member, and unconditionally pass
it into the worker function.


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

* Re: [PATCH] ATM: Fix wrong usage of INIT_WORK
  2011-07-07 11:51 ` David Miller
@ 2011-07-07 12:04   ` Wang Shaoyan
  2011-07-07 12:10     ` David Miller
  2011-07-07 12:29     ` chas williams - CONTRACTOR
  0 siblings, 2 replies; 5+ messages in thread
From: Wang Shaoyan @ 2011-07-07 12:04 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, wangshaoyan.pt, chas, linux-atm-general

I just don't know whether the marco FILL_RX_POOLS_IN_BH is useful?

2011/7/7 David Miller <davem@davemloft.net>:

>
> This just makes the driver a bigger CPP mess.
>
> Unconditionally provide the dev->bh member, and unconditionally pass
> it into the worker function.
>
>



-- 
Wang Shaoyan

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

* Re: [PATCH] ATM: Fix wrong usage of INIT_WORK
  2011-07-07 12:04   ` Wang Shaoyan
@ 2011-07-07 12:10     ` David Miller
  2011-07-07 12:29     ` chas williams - CONTRACTOR
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2011-07-07 12:10 UTC (permalink / raw)
  To: stufever; +Cc: netdev, wangshaoyan.pt, chas, linux-atm-general

From: Wang Shaoyan <stufever@gmail.com>
Date: Thu, 7 Jul 2011 20:04:25 +0800

> I just don't know whether the marco FILL_RX_POOLS_IN_BH is useful?

Yes, another option is to delete all of the code protected by
that macro altogether.

It obviously hasn't been build tested in a long time, if at all.

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

* Re: [PATCH] ATM: Fix wrong usage of INIT_WORK
  2011-07-07 12:04   ` Wang Shaoyan
  2011-07-07 12:10     ` David Miller
@ 2011-07-07 12:29     ` chas williams - CONTRACTOR
  1 sibling, 0 replies; 5+ messages in thread
From: chas williams - CONTRACTOR @ 2011-07-07 12:29 UTC (permalink / raw)
  To: Wang Shaoyan; +Cc: David Miller, netdev, wangshaoyan.pt, linux-atm-general

On Thu, 7 Jul 2011 20:04:25 +0800
Wang Shaoyan <stufever@gmail.com> wrote:

> I just don't know whether the marco FILL_RX_POOLS_IN_BH is useful?

the macro doesnt seem to be useful in anyway.  it can simply be
eliminated.

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

end of thread, other threads:[~2011-07-07 12:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-07 11:51 [PATCH] ATM: Fix wrong usage of INIT_WORK stufever
2011-07-07 11:51 ` David Miller
2011-07-07 12:04   ` Wang Shaoyan
2011-07-07 12:10     ` David Miller
2011-07-07 12:29     ` chas williams - CONTRACTOR

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