Skip to contentSkip to conversation

question about drivers/net/ethernet/jme.{c,h}

DISCUSSION Julia Lawall 2 participants 2 messages Aug 13, 2013

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

I wonder what is the point of the macro NETIF_NAPI_SET? It has only one definition, and it just transfers its arguments directly to the more common function netif_napi_add. The fact that the definition of the macro contains a semicolon also makes the use of NETIF_NAPI_SET not look like a normal function call.

thanks,
julia

#1 lore raw
Quoted 1 line · Julia Lawall

I wonder what is the point of the macro NETIF_NAPI_SET?

Today it seems pretty clear it's useless indirection.

It might have been useful sometime before the jme.c file was first submitted, but now it should be removed.

In the jme.h file on JMicron's website, the driver still supports linux versions less than 2.6.23 and uses a form like this:

ftp://driver.jmicron.com.tw/Ethernet/Linux/jmebp-1.0.8.5.tar.bz

#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)

#define NETIF_NAPI_SET(dev, napis, pollfn, q) \
	dev->poll = pollfn; \
	dev->weight = q;
#else
#define NETIF_NAPI_SET(dev, napis, pollfn, q) \
	netif_napi_add(dev, napis, pollfn, q);