aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c42
1 files changed, 11 insertions, 31 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 792f4c282291..463351d4f942 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -202,12 +202,6 @@ struct ipmi_smi
202 struct list_head waiting_events; 202 struct list_head waiting_events;
203 unsigned int waiting_events_count; /* How many events in queue? */ 203 unsigned int waiting_events_count; /* How many events in queue? */
204 204
205 /* This will be non-null if someone registers to receive all
206 IPMI commands (this is for interface emulation). There
207 may not be any things in the cmd_rcvrs list above when
208 this is registered. */
209 ipmi_user_t all_cmd_rcvr;
210
211 /* The event receiver for my BMC, only really used at panic 205 /* The event receiver for my BMC, only really used at panic
212 shutdown as a place to store this. */ 206 shutdown as a place to store this. */
213 unsigned char event_receiver; 207 unsigned char event_receiver;
@@ -867,11 +861,6 @@ int ipmi_register_for_cmd(ipmi_user_t user,
867 861
868 read_lock(&(user->intf->users_lock)); 862 read_lock(&(user->intf->users_lock));
869 write_lock_irqsave(&(user->intf->cmd_rcvr_lock), flags); 863 write_lock_irqsave(&(user->intf->cmd_rcvr_lock), flags);
870 if (user->intf->all_cmd_rcvr != NULL) {
871 rv = -EBUSY;
872 goto out_unlock;
873 }
874
875 /* Make sure the command/netfn is not already registered. */ 864 /* Make sure the command/netfn is not already registered. */
876 list_for_each_entry(cmp, &(user->intf->cmd_rcvrs), link) { 865 list_for_each_entry(cmp, &(user->intf->cmd_rcvrs), link) {
877 if ((cmp->netfn == netfn) && (cmp->cmd == cmd)) { 866 if ((cmp->netfn == netfn) && (cmp->cmd == cmd)) {
@@ -886,7 +875,7 @@ int ipmi_register_for_cmd(ipmi_user_t user,
886 rcvr->user = user; 875 rcvr->user = user;
887 list_add_tail(&(rcvr->link), &(user->intf->cmd_rcvrs)); 876 list_add_tail(&(rcvr->link), &(user->intf->cmd_rcvrs));
888 } 877 }
889 out_unlock: 878
890 write_unlock_irqrestore(&(user->intf->cmd_rcvr_lock), flags); 879 write_unlock_irqrestore(&(user->intf->cmd_rcvr_lock), flags);
891 read_unlock(&(user->intf->users_lock)); 880 read_unlock(&(user->intf->users_lock));
892 881
@@ -1799,7 +1788,6 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
1799 rwlock_init(&(new_intf->cmd_rcvr_lock)); 1788 rwlock_init(&(new_intf->cmd_rcvr_lock));
1800 init_waitqueue_head(&new_intf->waitq); 1789 init_waitqueue_head(&new_intf->waitq);
1801 INIT_LIST_HEAD(&(new_intf->cmd_rcvrs)); 1790 INIT_LIST_HEAD(&(new_intf->cmd_rcvrs));
1802 new_intf->all_cmd_rcvr = NULL;
1803 1791
1804 spin_lock_init(&(new_intf->counter_lock)); 1792 spin_lock_init(&(new_intf->counter_lock));
1805 1793
@@ -2037,15 +2025,11 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf,
2037 2025
2038 read_lock(&(intf->cmd_rcvr_lock)); 2026 read_lock(&(intf->cmd_rcvr_lock));
2039 2027
2040 if (intf->all_cmd_rcvr) { 2028 /* Find the command/netfn. */
2041 user = intf->all_cmd_rcvr; 2029 list_for_each_entry(rcvr, &(intf->cmd_rcvrs), link) {
2042 } else { 2030 if ((rcvr->netfn == netfn) && (rcvr->cmd == cmd)) {
2043 /* Find the command/netfn. */ 2031 user = rcvr->user;
2044 list_for_each_entry(rcvr, &(intf->cmd_rcvrs), link) { 2032 break;
2045 if ((rcvr->netfn == netfn) && (rcvr->cmd == cmd)) {
2046 user = rcvr->user;
2047 break;
2048 }
2049 } 2033 }
2050 } 2034 }
2051 read_unlock(&(intf->cmd_rcvr_lock)); 2035 read_unlock(&(intf->cmd_rcvr_lock));
@@ -2222,15 +2206,11 @@ static int handle_lan_get_msg_cmd(ipmi_smi_t intf,
2222 2206
2223 read_lock(&(intf->cmd_rcvr_lock)); 2207 read_lock(&(intf->cmd_rcvr_lock));
2224 2208
2225 if (intf->all_cmd_rcvr) { 2209 /* Find the command/netfn. */
2226 user = intf->all_cmd_rcvr; 2210 list_for_each_entry(rcvr, &(intf->cmd_rcvrs), link) {
2227 } else { 2211 if ((rcvr->netfn == netfn) && (rcvr->cmd == cmd)) {
2228 /* Find the command/netfn. */ 2212 user = rcvr->user;
2229 list_for_each_entry(rcvr, &(intf->cmd_rcvrs), link) { 2213 break;
2230 if ((rcvr->netfn == netfn) && (rcvr->cmd == cmd)) {
2231 user = rcvr->user;
2232 break;
2233 }
2234 } 2214 }
2235 } 2215 }
2236 read_unlock(&(intf->cmd_rcvr_lock)); 2216 read_unlock(&(intf->cmd_rcvr_lock));