# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1188487419 -3600
# Node ID 720571c2139e66aecb2552a59be897fda40238fa
# Parent 7419a3be82737bc2de83749030759e104c92e1ea
netfront: Add kref support for legacy Linux kernels.
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@xxxxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
drivers/xen/netfront/accel.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff -r 7419a3be8273 -r 720571c2139e drivers/xen/netfront/accel.c
--- a/drivers/xen/netfront/accel.c Tue Aug 28 15:33:15 2007 +0100
+++ b/drivers/xen/netfront/accel.c Thu Aug 30 16:23:39 2007 +0100
@@ -45,6 +45,14 @@
#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 n
*/
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_a
* 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
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|