aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/connector/connector.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/connector/connector.c')
-rw-r--r--drivers/connector/connector.c15
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);
41MODULE_PARM_DESC(cn_idx, "Connector's main device idx."); 42MODULE_PARM_DESC(cn_idx, "Connector's main device idx.");
42MODULE_PARM_DESC(cn_val, "Connector's main device val."); 43MODULE_PARM_DESC(cn_val, "Connector's main device val.");
43 44
44static DECLARE_MUTEX(notify_lock); 45static DEFINE_MUTEX(notify_lock);
45static LIST_HEAD(notify_list); 46static LIST_HEAD(notify_list);
46 47
47static struct cn_dev cdev; 48static 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(&notify_lock); 264 mutex_lock(&notify_lock);
264 list_for_each_entry(ent, &notify_list, notify_entry) { 265 list_for_each_entry(ent, &notify_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(&notify_lock); 297 mutex_unlock(&notify_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(&notify_lock); 411 mutex_lock(&notify_lock);
411 list_for_each_entry_safe(ent, n, &notify_list, notify_entry) { 412 list_for_each_entry_safe(ent, n, &notify_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(&notify_lock); 418 mutex_unlock(&notify_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(&notify_lock); 433 mutex_lock(&notify_lock);
433 list_add(&ent->notify_entry, &notify_list); 434 list_add(&ent->notify_entry, &notify_list);
434 up(&notify_lock); 435 mutex_unlock(&notify_lock);
435} 436}
436 437
437static int __init cn_init(void) 438static int __init cn_init(void)