Skip to content

Commit 646e40b

Browse files
committed
ipmi_msghandler: Change the events lock to a mutex
It can only be called from thread context now. Signed-off-by: Corey Minyard <cminyard@mvista.com>
1 parent 557602f commit 646e40b

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

drivers/char/ipmi/ipmi_msghandler.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ struct ipmi_smi {
528528
* Events that were queues because no one was there to receive
529529
* them.
530530
*/
531-
spinlock_t events_lock; /* For dealing with event stuff. */
531+
struct mutex events_mutex; /* For dealing with event stuff. */
532532
struct list_head waiting_events;
533533
unsigned int waiting_events_count; /* How many events in queue? */
534534
char event_msg_printed;
@@ -1594,7 +1594,6 @@ EXPORT_SYMBOL(ipmi_set_maintenance_mode);
15941594

15951595
int ipmi_set_gets_events(struct ipmi_user *user, bool val)
15961596
{
1597-
unsigned long flags;
15981597
struct ipmi_smi *intf = user->intf;
15991598
struct ipmi_recv_msg *msg, *msg2;
16001599
struct list_head msgs;
@@ -1606,7 +1605,7 @@ int ipmi_set_gets_events(struct ipmi_user *user, bool val)
16061605

16071606
INIT_LIST_HEAD(&msgs);
16081607

1609-
spin_lock_irqsave(&intf->events_lock, flags);
1608+
mutex_lock(&intf->events_mutex);
16101609
if (user->gets_events == val)
16111610
goto out;
16121611

@@ -1637,7 +1636,7 @@ int ipmi_set_gets_events(struct ipmi_user *user, bool val)
16371636
}
16381637

16391638
out:
1640-
spin_unlock_irqrestore(&intf->events_lock, flags);
1639+
mutex_unlock(&intf->events_mutex);
16411640
release_ipmi_user(user, index);
16421641

16431642
return 0;
@@ -3605,7 +3604,7 @@ int ipmi_add_smi(struct module *owner,
36053604
spin_lock_init(&intf->xmit_msgs_lock);
36063605
INIT_LIST_HEAD(&intf->xmit_msgs);
36073606
INIT_LIST_HEAD(&intf->hp_xmit_msgs);
3608-
spin_lock_init(&intf->events_lock);
3607+
mutex_init(&intf->events_mutex);
36093608
spin_lock_init(&intf->watch_lock);
36103609
atomic_set(&intf->event_waiters, 0);
36113610
intf->ticks_to_req_ev = IPMI_REQUEST_EV_TIME;
@@ -4391,7 +4390,6 @@ static int handle_read_event_rsp(struct ipmi_smi *intf,
43914390
struct list_head msgs;
43924391
struct ipmi_user *user;
43934392
int rv = 0, deliver_count = 0, index;
4394-
unsigned long flags;
43954393

43964394
if (msg->rsp_size < 19) {
43974395
/* Message is too small to be an IPMB event. */
@@ -4406,7 +4404,7 @@ static int handle_read_event_rsp(struct ipmi_smi *intf,
44064404

44074405
INIT_LIST_HEAD(&msgs);
44084406

4409-
spin_lock_irqsave(&intf->events_lock, flags);
4407+
mutex_lock(&intf->events_mutex);
44104408

44114409
ipmi_inc_stat(intf, events);
44124410

@@ -4481,7 +4479,7 @@ static int handle_read_event_rsp(struct ipmi_smi *intf,
44814479
}
44824480

44834481
out:
4484-
spin_unlock_irqrestore(&intf->events_lock, flags);
4482+
mutex_unlock(&intf->events_mutex);
44854483

44864484
return rv;
44874485
}

0 commit comments

Comments
 (0)