linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / connector / connector.c
index 3589707..505677f 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/netlink.h>
 #include <linux/moduleparam.h>
 #include <linux/connector.h>
-#include <linux/mutex.h>
 
 #include <net/sock.h>
 
@@ -42,7 +41,7 @@ module_param(cn_val, uint, 0);
 MODULE_PARM_DESC(cn_idx, "Connector's main device idx.");
 MODULE_PARM_DESC(cn_val, "Connector's main device val.");
 
-static DEFINE_MUTEX(notify_lock);
+static DECLARE_MUTEX(notify_lock);
 static LIST_HEAD(notify_list);
 
 static struct cn_dev cdev;
@@ -98,9 +97,6 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask)
                group = __group;
        }
 
-       if (!netlink_has_listeners(dev->nls, group))
-               return -ESRCH;
-
        size = NLMSG_SPACE(sizeof(*msg) + msg->len);
 
        skb = alloc_skb(size, gfp_mask);
@@ -115,7 +111,9 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask)
 
        NETLINK_CB(skb).dst_group = group;
 
-       return netlink_broadcast(dev->nls, skb, 0, group, gfp_mask);
+       netlink_broadcast(dev->nls, skb, 0, group, gfp_mask);
+
+       return 0;
 
 nlmsg_failure:
        kfree_skb(skb);
@@ -261,7 +259,7 @@ static void cn_notify(struct cb_id *id, u32 notify_event)
 {
        struct cn_ctl_entry *ent;
 
-       mutex_lock(&notify_lock);
+       down(&notify_lock);
        list_for_each_entry(ent, &notify_list, notify_entry) {
                int i;
                struct cn_notify_req *req;
@@ -294,7 +292,7 @@ static void cn_notify(struct cb_id *id, u32 notify_event)
                        cn_netlink_send(&m, ctl->group, GFP_KERNEL);
                }
        }
-       mutex_unlock(&notify_lock);
+       up(&notify_lock);
 }
 
 /*
@@ -408,14 +406,14 @@ static void cn_callback(void *data)
        if (ctl->group == 0) {
                struct cn_ctl_entry *n;
 
-               mutex_lock(&notify_lock);
+               down(&notify_lock);
                list_for_each_entry_safe(ent, n, &notify_list, notify_entry) {
                        if (cn_ctl_msg_equals(ent->msg, ctl)) {
                                list_del(&ent->notify_entry);
                                kfree(ent);
                        }
                }
-               mutex_unlock(&notify_lock);
+               up(&notify_lock);
 
                return;
        }
@@ -430,9 +428,9 @@ static void cn_callback(void *data)
 
        memcpy(ent->msg, ctl, size - sizeof(*ent));
 
-       mutex_lock(&notify_lock);
+       down(&notify_lock);
        list_add(&ent->notify_entry, &notify_list);
-       mutex_unlock(&notify_lock);
+       up(&notify_lock);
 }
 
 static int __init cn_init(void)