#include <linux/netlink.h>
#include <linux/moduleparam.h>
#include <linux/connector.h>
-#include <linux/mutex.h>
#include <net/sock.h>
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;
group = __group;
}
- if (!netlink_has_listeners(dev->nls, group))
- return -ESRCH;
-
size = NLMSG_SPACE(sizeof(*msg) + msg->len);
skb = alloc_skb(size, 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);
{
struct cn_ctl_entry *ent;
- mutex_lock(¬ify_lock);
+ down(¬ify_lock);
list_for_each_entry(ent, ¬ify_list, notify_entry) {
int i;
struct cn_notify_req *req;
cn_netlink_send(&m, ctl->group, GFP_KERNEL);
}
}
- mutex_unlock(¬ify_lock);
+ up(¬ify_lock);
}
/*
if (ctl->group == 0) {
struct cn_ctl_entry *n;
- mutex_lock(¬ify_lock);
+ down(¬ify_lock);
list_for_each_entry_safe(ent, n, ¬ify_list, notify_entry) {
if (cn_ctl_msg_equals(ent->msg, ctl)) {
list_del(&ent->notify_entry);
kfree(ent);
}
}
- mutex_unlock(¬ify_lock);
+ up(¬ify_lock);
return;
}
memcpy(ent->msg, ctl, size - sizeof(*ent));
- mutex_lock(¬ify_lock);
+ down(¬ify_lock);
list_add(&ent->notify_entry, ¬ify_list);
- mutex_unlock(¬ify_lock);
+ up(¬ify_lock);
}
static int __init cn_init(void)