aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi/ipmi_msghandler.c
diff options
context:
space:
mode:
authorCorey Minyard <cminyard@mvista.com>2007-10-18 06:07:11 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:37:32 -0400
commitac0191517c3b5f2cf68ab36756d64ef035c4a770 (patch)
tree0c403b55053faf9c4add07658069430cbc527210 /drivers/char/ipmi/ipmi_msghandler.c
parent612b5a8d3a57d07698ceec0e307a84f38b241fe2 (diff)
IPMI: fix hotmod remove lock
The removal of proc entries was done holding a lock, which is no longer allowed. There is no need for the lock, only a mutex is required, so switch over to a mutex. Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/ipmi/ipmi_msghandler.c')
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 46d14ac16212..5dc1265ce1d5 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -221,10 +221,8 @@ struct ipmi_smi
221 void *send_info; 221 void *send_info;
222 222
223#ifdef CONFIG_PROC_FS 223#ifdef CONFIG_PROC_FS
224 /* A list of proc entries for this interface. This does not 224 /* A list of proc entries for this interface. */
225 need a lock, only one thread creates it and only one thread 225 struct mutex proc_entry_lock;
226 destroys it. */
227 spinlock_t proc_entry_lock;
228 struct ipmi_proc_entry *proc_entries; 226 struct ipmi_proc_entry *proc_entries;
229#endif 227#endif
230 228
@@ -1891,11 +1889,11 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
1891 file->write_proc = write_proc; 1889 file->write_proc = write_proc;
1892 file->owner = owner; 1890 file->owner = owner;
1893 1891
1894 spin_lock(&smi->proc_entry_lock); 1892 mutex_lock(&smi->proc_entry_lock);
1895 /* Stick it on the list. */ 1893 /* Stick it on the list. */
1896 entry->next = smi->proc_entries; 1894 entry->next = smi->proc_entries;
1897 smi->proc_entries = entry; 1895 smi->proc_entries = entry;
1898 spin_unlock(&smi->proc_entry_lock); 1896 mutex_unlock(&smi->proc_entry_lock);
1899 } 1897 }
1900#endif /* CONFIG_PROC_FS */ 1898#endif /* CONFIG_PROC_FS */
1901 1899
@@ -1939,7 +1937,7 @@ static void remove_proc_entries(ipmi_smi_t smi)
1939#ifdef CONFIG_PROC_FS 1937#ifdef CONFIG_PROC_FS
1940 struct ipmi_proc_entry *entry; 1938 struct ipmi_proc_entry *entry;
1941 1939
1942 spin_lock(&smi->proc_entry_lock); 1940 mutex_lock(&smi->proc_entry_lock);
1943 while (smi->proc_entries) { 1941 while (smi->proc_entries) {
1944 entry = smi->proc_entries; 1942 entry = smi->proc_entries;
1945 smi->proc_entries = entry->next; 1943 smi->proc_entries = entry->next;
@@ -1948,7 +1946,7 @@ static void remove_proc_entries(ipmi_smi_t smi)
1948 kfree(entry->name); 1946 kfree(entry->name);
1949 kfree(entry); 1947 kfree(entry);
1950 } 1948 }
1951 spin_unlock(&smi->proc_entry_lock); 1949 mutex_unlock(&smi->proc_entry_lock);
1952 remove_proc_entry(smi->proc_dir_name, proc_ipmi_root); 1950 remove_proc_entry(smi->proc_dir_name, proc_ipmi_root);
1953#endif /* CONFIG_PROC_FS */ 1951#endif /* CONFIG_PROC_FS */
1954} 1952}
@@ -2679,7 +2677,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
2679 } 2677 }
2680 intf->curr_seq = 0; 2678 intf->curr_seq = 0;
2681#ifdef CONFIG_PROC_FS 2679#ifdef CONFIG_PROC_FS
2682 spin_lock_init(&intf->proc_entry_lock); 2680 mutex_init(&intf->proc_entry_lock);
2683#endif 2681#endif
2684 spin_lock_init(&intf->waiting_msgs_lock); 2682 spin_lock_init(&intf->waiting_msgs_lock);
2685 INIT_LIST_HEAD(&intf->waiting_msgs); 2683 INIT_LIST_HEAD(&intf->waiting_msgs);