]> xenbits.xensource.com Git - legacy/linux-2.6.18-xen.git/commitdiff
netfront: Add kref support for legacy Linux kernels.
authorkfraser <kfraser@localhost.localdomain>
Thu, 30 Aug 2007 15:23:39 +0000 (16:23 +0100)
committerkfraser <kfraser@localhost.localdomain>
Thu, 30 Aug 2007 15:23:39 +0000 (16:23 +0100)
In kernels <= 2.6.5 kref_init, and kref_put had a different interface.
This patch allows for older kernels to compile with the older
interface.

Signed-off-by: Ben Guthro <bguthro@virtualiron.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
drivers/xen/netfront/accel.c

index d09980e3e76db919d8966a9001c3b3a189231f6e..d0e4e678b8c819ac31d14fbc8bce50a5a7cbb368 100644 (file)
 #define WPRINTK(fmt, args...)                          \
        printk(KERN_WARNING "netfront/accel: " fmt, ##args)
 
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 5)
+#define kref_init(x,y) kref_init(x,y)
+#define kref_put(x,y)  kref_put(x)
+#else
+#define kref_init(x,y) kref_init(x)
+#define kref_put(x,y)  kref_put(x,y)
+#endif
+
 /*
  * List of all netfront accelerator plugin modules available.  Each
  * list entry is of type struct netfront_accelerator.
@@ -176,7 +184,7 @@ accelerator_set_vif_state_hooks(struct netfront_accel_vif_state *vif_state)
         */
        kref_get(&vif_state->np->accelerator->accel_kref);
        /* This persists until vif_state->hooks are cleared */
-       kref_init(&vif_state->vif_kref);
+       kref_init(&vif_state->vif_kref, vif_kref_release);
 
        /* Make sure there are no data path operations going on */
        netif_poll_disable(vif_state->np->netdev);
@@ -318,7 +326,7 @@ accelerator_probe_vifs(struct netfront_accelerator *accelerator,
         * persist until the accelerator hooks are removed (e.g. by
         * accelerator module unload)
         */
-       kref_init(&accelerator->accel_kref);
+       kref_init(&accelerator->accel_kref, accel_kref_release);
 
        /* 
         * Store the hooks for future calls to probe a new device, and