diff options
Diffstat (limited to 'drivers/connector')
-rw-r--r-- | drivers/connector/connector.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index d7125f4d9113..35897079a78d 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/netlink.h> | 26 | #include <linux/netlink.h> |
27 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
28 | #include <linux/connector.h> | 28 | #include <linux/connector.h> |
29 | #include <linux/mutex.h> | ||
29 | 30 | ||
30 | #include <net/sock.h> | 31 | #include <net/sock.h> |
31 | 32 | ||
@@ -41,7 +42,7 @@ module_param(cn_val, uint, 0); | |||
41 | MODULE_PARM_DESC(cn_idx, "Connector's main device idx."); | 42 | MODULE_PARM_DESC(cn_idx, "Connector's main device idx."); |
42 | MODULE_PARM_DESC(cn_val, "Connector's main device val."); | 43 | MODULE_PARM_DESC(cn_val, "Connector's main device val."); |
43 | 44 | ||
44 | static DECLARE_MUTEX(notify_lock); | 45 | static DEFINE_MUTEX(notify_lock); |
45 | static LIST_HEAD(notify_list); | 46 | static LIST_HEAD(notify_list); |
46 | 47 | ||
47 | static struct cn_dev cdev; | 48 | static struct cn_dev cdev; |
@@ -260,7 +261,7 @@ static void cn_notify(struct cb_id *id, u32 notify_event) | |||
260 | { | 261 | { |
261 | struct cn_ctl_entry *ent; | 262 | struct cn_ctl_entry *ent; |
262 | 263 | ||
263 | down(¬ify_lock); | 264 | mutex_lock(¬ify_lock); |
264 | list_for_each_entry(ent, ¬ify_list, notify_entry) { | 265 | list_for_each_entry(ent, ¬ify_list, notify_entry) { |
265 | int i; | 266 | int i; |
266 | struct cn_notify_req *req; | 267 | struct cn_notify_req *req; |
@@ -293,7 +294,7 @@ static void cn_notify(struct cb_id *id, u32 notify_event) | |||
293 | cn_netlink_send(&m, ctl->group, GFP_KERNEL); | 294 | cn_netlink_send(&m, ctl->group, GFP_KERNEL); |
294 | } | 295 | } |
295 | } | 296 | } |
296 | up(¬ify_lock); | 297 | mutex_unlock(¬ify_lock); |
297 | } | 298 | } |
298 | 299 | ||
299 | /* | 300 | /* |
@@ -407,14 +408,14 @@ static void cn_callback(void *data) | |||
407 | if (ctl->group == 0) { | 408 | if (ctl->group == 0) { |
408 | struct cn_ctl_entry *n; | 409 | struct cn_ctl_entry *n; |
409 | 410 | ||
410 | down(¬ify_lock); | 411 | mutex_lock(¬ify_lock); |
411 | list_for_each_entry_safe(ent, n, ¬ify_list, notify_entry) { | 412 | list_for_each_entry_safe(ent, n, ¬ify_list, notify_entry) { |
412 | if (cn_ctl_msg_equals(ent->msg, ctl)) { | 413 | if (cn_ctl_msg_equals(ent->msg, ctl)) { |
413 | list_del(&ent->notify_entry); | 414 | list_del(&ent->notify_entry); |
414 | kfree(ent); | 415 | kfree(ent); |
415 | } | 416 | } |
416 | } | 417 | } |
417 | up(¬ify_lock); | 418 | mutex_unlock(¬ify_lock); |
418 | 419 | ||
419 | return; | 420 | return; |
420 | } | 421 | } |
@@ -429,9 +430,9 @@ static void cn_callback(void *data) | |||
429 | 430 | ||
430 | memcpy(ent->msg, ctl, size - sizeof(*ent)); | 431 | memcpy(ent->msg, ctl, size - sizeof(*ent)); |
431 | 432 | ||
432 | down(¬ify_lock); | 433 | mutex_lock(¬ify_lock); |
433 | list_add(&ent->notify_entry, ¬ify_list); | 434 | list_add(&ent->notify_entry, ¬ify_list); |
434 | up(¬ify_lock); | 435 | mutex_unlock(¬ify_lock); |
435 | } | 436 | } |
436 | 437 | ||
437 | static int __init cn_init(void) | 438 | static int __init cn_init(void) |