diff options
-rw-r--r-- | include/litmus/locking.h | 3 | ||||
-rw-r--r-- | litmus/fifo_lock.c | 14 | ||||
-rw-r--r-- | litmus/prioq_lock.c | 13 |
3 files changed, 20 insertions, 10 deletions
diff --git a/include/litmus/locking.h b/include/litmus/locking.h index 02cc9cf4bb55..3ae6692dbe95 100644 --- a/include/litmus/locking.h +++ b/include/litmus/locking.h | |||
@@ -48,8 +48,7 @@ struct litmus_lock { | |||
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | struct litmus_lock_proc_ops *proc; | 50 | struct litmus_lock_proc_ops *proc; |
51 | struct proc_dir_entry *proc_entry; | 51 | char *name; |
52 | char name[LOCK_NAME_LEN]; | ||
53 | }; | 52 | }; |
54 | 53 | ||
55 | #ifdef CONFIG_LITMUS_DGL_SUPPORT | 54 | #ifdef CONFIG_LITMUS_DGL_SUPPORT |
diff --git a/litmus/fifo_lock.c b/litmus/fifo_lock.c index b3e956f5a93a..0cbba2424701 100644 --- a/litmus/fifo_lock.c +++ b/litmus/fifo_lock.c | |||
@@ -878,14 +878,20 @@ static int fifo_proc_print(char *page, char **start, off_t off, int count, int * | |||
878 | 878 | ||
879 | static void fifo_proc_add(struct litmus_lock* l) | 879 | static void fifo_proc_add(struct litmus_lock* l) |
880 | { | 880 | { |
881 | if (!l->name) | ||
882 | l->name = kmalloc(LOCK_NAME_LEN*sizeof(char), GFP_KERNEL); | ||
881 | snprintf(l->name, LOCK_NAME_LEN, "fifo-%d", l->ident); | 883 | snprintf(l->name, LOCK_NAME_LEN, "fifo-%d", l->ident); |
882 | 884 | litmus_add_proc_lock(l, fifo_proc_print); | |
883 | l->proc_entry = litmus_add_proc_lock(l, fifo_proc_print); | ||
884 | } | 885 | } |
885 | 886 | ||
886 | static void fifo_proc_remove(struct litmus_lock* l) | 887 | static void fifo_proc_remove(struct litmus_lock* l) |
887 | { | 888 | { |
888 | litmus_remove_proc_lock(l); | 889 | if (l->name) { |
890 | litmus_remove_proc_lock(l); | ||
891 | |||
892 | kfree(l->name); | ||
893 | l->name = NULL; | ||
894 | } | ||
889 | } | 895 | } |
890 | 896 | ||
891 | static struct litmus_lock_proc_ops fifo_proc_ops = | 897 | static struct litmus_lock_proc_ops fifo_proc_ops = |
@@ -905,7 +911,7 @@ struct litmus_lock* fifo_mutex_new(struct litmus_lock_ops* ops) | |||
905 | memset(mutex, 0, sizeof(*mutex)); | 911 | memset(mutex, 0, sizeof(*mutex)); |
906 | 912 | ||
907 | mutex->litmus_lock.ops = ops; | 913 | mutex->litmus_lock.ops = ops; |
908 | mutex->owner = NULL; | 914 | mutex->owner = NULL; |
909 | mutex->hp_waiter = NULL; | 915 | mutex->hp_waiter = NULL; |
910 | init_waitqueue_head(&mutex->wait); | 916 | init_waitqueue_head(&mutex->wait); |
911 | 917 | ||
diff --git a/litmus/prioq_lock.c b/litmus/prioq_lock.c index 142f56fe9099..c9ffab1564c3 100644 --- a/litmus/prioq_lock.c +++ b/litmus/prioq_lock.c | |||
@@ -1454,14 +1454,20 @@ static int prioq_proc_print(char *page, char **start, off_t off, int count, int | |||
1454 | 1454 | ||
1455 | static void prioq_proc_add(struct litmus_lock* l) | 1455 | static void prioq_proc_add(struct litmus_lock* l) |
1456 | { | 1456 | { |
1457 | if (!l->name) | ||
1458 | l->name = kmalloc(LOCK_NAME_LEN*sizeof(char), GFP_KERNEL); | ||
1457 | snprintf(l->name, LOCK_NAME_LEN, "prioq-%d", l->ident); | 1459 | snprintf(l->name, LOCK_NAME_LEN, "prioq-%d", l->ident); |
1458 | 1460 | litmus_add_proc_lock(l, prioq_proc_print); | |
1459 | l->proc_entry = litmus_add_proc_lock(l, prioq_proc_print); | ||
1460 | } | 1461 | } |
1461 | 1462 | ||
1462 | static void prioq_proc_remove(struct litmus_lock* l) | 1463 | static void prioq_proc_remove(struct litmus_lock* l) |
1463 | { | 1464 | { |
1464 | litmus_remove_proc_lock(l); | 1465 | if (l->name) { |
1466 | litmus_remove_proc_lock(l); | ||
1467 | |||
1468 | kfree(l->name); | ||
1469 | l->name = NULL; | ||
1470 | } | ||
1465 | } | 1471 | } |
1466 | 1472 | ||
1467 | static struct litmus_lock_proc_ops prioq_proc_ops = | 1473 | static struct litmus_lock_proc_ops prioq_proc_ops = |
@@ -1485,7 +1491,6 @@ struct litmus_lock* prioq_mutex_new(struct litmus_lock_ops* ops) | |||
1485 | mutex->hp_waiter = NULL; | 1491 | mutex->hp_waiter = NULL; |
1486 | init_waitqueue_head(&mutex->wait); | 1492 | init_waitqueue_head(&mutex->wait); |
1487 | 1493 | ||
1488 | |||
1489 | #ifdef CONFIG_DEBUG_SPINLOCK | 1494 | #ifdef CONFIG_DEBUG_SPINLOCK |
1490 | { | 1495 | { |
1491 | __raw_spin_lock_init(&mutex->lock, | 1496 | __raw_spin_lock_init(&mutex->lock, |