[NET] sem2mutex: net/
[linux-2.6.git] / net / ipv6 / xfrm6_tunnel.c
index da09ff2..08f9abb 100644 (file)
@@ -31,6 +31,7 @@
 #include <net/protocol.h>
 #include <linux/ipv6.h>
 #include <linux/icmpv6.h>
+#include <linux/mutex.h>
 
 #ifdef CONFIG_IPV6_XFRM6_TUNNEL_DEBUG
 # define X6TDEBUG      3
@@ -259,8 +260,7 @@ try_next_2:;
        spi = 0;
        goto out;
 alloc_spi:
-       X6TPRINTK3(KERN_DEBUG "%s(): allocate new spi for "
-                             "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", 
+       X6TPRINTK3(KERN_DEBUG "%s(): allocate new spi for " NIP6_FMT "\n",
                              __FUNCTION__, 
                              NIP6(*(struct in6_addr *)saddr));
        x6spi = kmem_cache_alloc(xfrm6_tunnel_spi_kmem, SLAB_ATOMIC);
@@ -323,9 +323,8 @@ void xfrm6_tunnel_free_spi(xfrm_address_t *saddr)
                                  list_byaddr)
        {
                if (memcmp(&x6spi->addr, saddr, sizeof(x6spi->addr)) == 0) {
-                       X6TPRINTK3(KERN_DEBUG "%s(): x6spi object "
-                                             "for %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x "
-                                             "found at %p\n",
+                       X6TPRINTK3(KERN_DEBUG "%s(): x6spi object for " NIP6_FMT 
+                                             " found at %p\n",
                                   __FUNCTION__, 
                                   NIP6(*(struct in6_addr *)saddr),
                                   x6spi);
@@ -359,19 +358,19 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct xfrm_decap_state *dec
 }
 
 static struct xfrm6_tunnel *xfrm6_tunnel_handler;
-static DECLARE_MUTEX(xfrm6_tunnel_sem);
+static DEFINE_MUTEX(xfrm6_tunnel_mutex);
 
 int xfrm6_tunnel_register(struct xfrm6_tunnel *handler)
 {
        int ret;
 
-       down(&xfrm6_tunnel_sem);
+       mutex_lock(&xfrm6_tunnel_mutex);
        ret = 0;
        if (xfrm6_tunnel_handler != NULL)
                ret = -EINVAL;
        if (!ret)
                xfrm6_tunnel_handler = handler;
-       up(&xfrm6_tunnel_sem);
+       mutex_unlock(&xfrm6_tunnel_mutex);
 
        return ret;
 }
@@ -382,13 +381,13 @@ int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler)
 {
        int ret;
 
-       down(&xfrm6_tunnel_sem);
+       mutex_lock(&xfrm6_tunnel_mutex);
        ret = 0;
        if (xfrm6_tunnel_handler != handler)
                ret = -EINVAL;
        if (!ret)
                xfrm6_tunnel_handler = NULL;
-       up(&xfrm6_tunnel_sem);
+       mutex_unlock(&xfrm6_tunnel_mutex);
 
        synchronize_net();