summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/devices.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/devices.c b/kernel/devices.c
index 857a106..a9e7249 100644
--- a/kernel/devices.c
+++ b/kernel/devices.c
@@ -129,7 +129,11 @@ int add_device(dnbd2_device_t *dev, int minor)
dev->rid = 0;
atomic_set(&dev->refcnt, 0);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
+ sema_init(&dev->config_mutex, 1);
+#else
init_MUTEX(&dev->config_mutex);
+#endif
spin_lock_init(&dev->blk_lock);
@@ -146,7 +150,11 @@ int add_device(dnbd2_device_t *dev, int minor)
init_completion(&dev->tx_start);
init_completion(&dev->tx_stop);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
+ sema_init(&dev->servers_mutex, 1);
+#else
init_MUTEX(&dev->servers_mutex);
+#endif
for_each_server(i) {
dev->emerg_list[i].ip = 0;
dev->emerg_list[i].port = 0;