diff options
Diffstat (limited to 'drivers/char/ipmi/ipmi_msghandler.c')
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index a0b6f797d97d..c0c862cce1c3 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -557,7 +557,7 @@ unsigned int ipmi_addr_length(int addr_type) | |||
557 | 557 | ||
558 | static void deliver_response(struct ipmi_recv_msg *msg) | 558 | static void deliver_response(struct ipmi_recv_msg *msg) |
559 | { | 559 | { |
560 | if (! msg->user) { | 560 | if (!msg->user) { |
561 | ipmi_smi_t intf = msg->user_msg_data; | 561 | ipmi_smi_t intf = msg->user_msg_data; |
562 | unsigned long flags; | 562 | unsigned long flags; |
563 | 563 | ||
@@ -598,11 +598,11 @@ static int intf_next_seq(ipmi_smi_t intf, | |||
598 | (i+1)%IPMI_IPMB_NUM_SEQ != intf->curr_seq; | 598 | (i+1)%IPMI_IPMB_NUM_SEQ != intf->curr_seq; |
599 | i = (i+1)%IPMI_IPMB_NUM_SEQ) | 599 | i = (i+1)%IPMI_IPMB_NUM_SEQ) |
600 | { | 600 | { |
601 | if (! intf->seq_table[i].inuse) | 601 | if (!intf->seq_table[i].inuse) |
602 | break; | 602 | break; |
603 | } | 603 | } |
604 | 604 | ||
605 | if (! intf->seq_table[i].inuse) { | 605 | if (!intf->seq_table[i].inuse) { |
606 | intf->seq_table[i].recv_msg = recv_msg; | 606 | intf->seq_table[i].recv_msg = recv_msg; |
607 | 607 | ||
608 | /* Start with the maximum timeout, when the send response | 608 | /* Start with the maximum timeout, when the send response |
@@ -763,7 +763,7 @@ int ipmi_create_user(unsigned int if_num, | |||
763 | } | 763 | } |
764 | 764 | ||
765 | new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); | 765 | new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); |
766 | if (! new_user) | 766 | if (!new_user) |
767 | return -ENOMEM; | 767 | return -ENOMEM; |
768 | 768 | ||
769 | spin_lock_irqsave(&interfaces_lock, flags); | 769 | spin_lock_irqsave(&interfaces_lock, flags); |
@@ -819,14 +819,13 @@ static void free_user(struct kref *ref) | |||
819 | 819 | ||
820 | int ipmi_destroy_user(ipmi_user_t user) | 820 | int ipmi_destroy_user(ipmi_user_t user) |
821 | { | 821 | { |
822 | int rv = -ENODEV; | ||
823 | ipmi_smi_t intf = user->intf; | 822 | ipmi_smi_t intf = user->intf; |
824 | int i; | 823 | int i; |
825 | unsigned long flags; | 824 | unsigned long flags; |
826 | struct cmd_rcvr *rcvr; | 825 | struct cmd_rcvr *rcvr; |
827 | struct cmd_rcvr *rcvrs = NULL; | 826 | struct cmd_rcvr *rcvrs = NULL; |
828 | 827 | ||
829 | user->valid = 1; | 828 | user->valid = 0; |
830 | 829 | ||
831 | /* Remove the user from the interface's sequence table. */ | 830 | /* Remove the user from the interface's sequence table. */ |
832 | spin_lock_irqsave(&intf->seq_lock, flags); | 831 | spin_lock_irqsave(&intf->seq_lock, flags); |
@@ -871,7 +870,7 @@ int ipmi_destroy_user(ipmi_user_t user) | |||
871 | 870 | ||
872 | kref_put(&user->refcount, free_user); | 871 | kref_put(&user->refcount, free_user); |
873 | 872 | ||
874 | return rv; | 873 | return 0; |
875 | } | 874 | } |
876 | 875 | ||
877 | void ipmi_get_version(ipmi_user_t user, | 876 | void ipmi_get_version(ipmi_user_t user, |
@@ -936,7 +935,8 @@ int ipmi_set_gets_events(ipmi_user_t user, int val) | |||
936 | 935 | ||
937 | if (val) { | 936 | if (val) { |
938 | /* Deliver any queued events. */ | 937 | /* Deliver any queued events. */ |
939 | list_for_each_entry_safe(msg, msg2, &intf->waiting_events, link) { | 938 | list_for_each_entry_safe(msg, msg2, &intf->waiting_events, |
939 | link) { | ||
940 | list_del(&msg->link); | 940 | list_del(&msg->link); |
941 | list_add_tail(&msg->link, &msgs); | 941 | list_add_tail(&msg->link, &msgs); |
942 | } | 942 | } |
@@ -978,7 +978,7 @@ int ipmi_register_for_cmd(ipmi_user_t user, | |||
978 | 978 | ||
979 | 979 | ||
980 | rcvr = kmalloc(sizeof(*rcvr), GFP_KERNEL); | 980 | rcvr = kmalloc(sizeof(*rcvr), GFP_KERNEL); |
981 | if (! rcvr) | 981 | if (!rcvr) |
982 | return -ENOMEM; | 982 | return -ENOMEM; |
983 | rcvr->cmd = cmd; | 983 | rcvr->cmd = cmd; |
984 | rcvr->netfn = netfn; | 984 | rcvr->netfn = netfn; |
@@ -1514,7 +1514,7 @@ int ipmi_request_settime(ipmi_user_t user, | |||
1514 | unsigned char saddr, lun; | 1514 | unsigned char saddr, lun; |
1515 | int rv; | 1515 | int rv; |
1516 | 1516 | ||
1517 | if (! user) | 1517 | if (!user) |
1518 | return -EINVAL; | 1518 | return -EINVAL; |
1519 | rv = check_addr(user->intf, addr, &saddr, &lun); | 1519 | rv = check_addr(user->intf, addr, &saddr, &lun); |
1520 | if (rv) | 1520 | if (rv) |
@@ -1545,7 +1545,7 @@ int ipmi_request_supply_msgs(ipmi_user_t user, | |||
1545 | unsigned char saddr, lun; | 1545 | unsigned char saddr, lun; |
1546 | int rv; | 1546 | int rv; |
1547 | 1547 | ||
1548 | if (! user) | 1548 | if (!user) |
1549 | return -EINVAL; | 1549 | return -EINVAL; |
1550 | rv = check_addr(user->intf, addr, &saddr, &lun); | 1550 | rv = check_addr(user->intf, addr, &saddr, &lun); |
1551 | if (rv) | 1551 | if (rv) |
@@ -1570,7 +1570,7 @@ static int ipmb_file_read_proc(char *page, char **start, off_t off, | |||
1570 | char *out = (char *) page; | 1570 | char *out = (char *) page; |
1571 | ipmi_smi_t intf = data; | 1571 | ipmi_smi_t intf = data; |
1572 | int i; | 1572 | int i; |
1573 | int rv= 0; | 1573 | int rv = 0; |
1574 | 1574 | ||
1575 | for (i = 0; i < IPMI_MAX_CHANNELS; i++) | 1575 | for (i = 0; i < IPMI_MAX_CHANNELS; i++) |
1576 | rv += sprintf(out+rv, "%x ", intf->channels[i].address); | 1576 | rv += sprintf(out+rv, "%x ", intf->channels[i].address); |
@@ -1989,7 +1989,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf) | |||
1989 | } else { | 1989 | } else { |
1990 | bmc->dev = platform_device_alloc("ipmi_bmc", | 1990 | bmc->dev = platform_device_alloc("ipmi_bmc", |
1991 | bmc->id.device_id); | 1991 | bmc->id.device_id); |
1992 | if (! bmc->dev) { | 1992 | if (!bmc->dev) { |
1993 | printk(KERN_ERR | 1993 | printk(KERN_ERR |
1994 | "ipmi_msghandler:" | 1994 | "ipmi_msghandler:" |
1995 | " Unable to allocate platform device\n"); | 1995 | " Unable to allocate platform device\n"); |
@@ -2621,7 +2621,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf, | |||
2621 | spin_unlock_irqrestore(&intf->counter_lock, flags); | 2621 | spin_unlock_irqrestore(&intf->counter_lock, flags); |
2622 | 2622 | ||
2623 | recv_msg = ipmi_alloc_recv_msg(); | 2623 | recv_msg = ipmi_alloc_recv_msg(); |
2624 | if (! recv_msg) { | 2624 | if (!recv_msg) { |
2625 | /* We couldn't allocate memory for the | 2625 | /* We couldn't allocate memory for the |
2626 | message, so requeue it for handling | 2626 | message, so requeue it for handling |
2627 | later. */ | 2627 | later. */ |
@@ -2776,7 +2776,7 @@ static int handle_lan_get_msg_cmd(ipmi_smi_t intf, | |||
2776 | spin_unlock_irqrestore(&intf->counter_lock, flags); | 2776 | spin_unlock_irqrestore(&intf->counter_lock, flags); |
2777 | 2777 | ||
2778 | recv_msg = ipmi_alloc_recv_msg(); | 2778 | recv_msg = ipmi_alloc_recv_msg(); |
2779 | if (! recv_msg) { | 2779 | if (!recv_msg) { |
2780 | /* We couldn't allocate memory for the | 2780 | /* We couldn't allocate memory for the |
2781 | message, so requeue it for handling | 2781 | message, so requeue it for handling |
2782 | later. */ | 2782 | later. */ |
@@ -2868,13 +2868,14 @@ static int handle_read_event_rsp(ipmi_smi_t intf, | |||
2868 | events. */ | 2868 | events. */ |
2869 | rcu_read_lock(); | 2869 | rcu_read_lock(); |
2870 | list_for_each_entry_rcu(user, &intf->users, link) { | 2870 | list_for_each_entry_rcu(user, &intf->users, link) { |
2871 | if (! user->gets_events) | 2871 | if (!user->gets_events) |
2872 | continue; | 2872 | continue; |
2873 | 2873 | ||
2874 | recv_msg = ipmi_alloc_recv_msg(); | 2874 | recv_msg = ipmi_alloc_recv_msg(); |
2875 | if (! recv_msg) { | 2875 | if (!recv_msg) { |
2876 | rcu_read_unlock(); | 2876 | rcu_read_unlock(); |
2877 | list_for_each_entry_safe(recv_msg, recv_msg2, &msgs, link) { | 2877 | list_for_each_entry_safe(recv_msg, recv_msg2, &msgs, |
2878 | link) { | ||
2878 | list_del(&recv_msg->link); | 2879 | list_del(&recv_msg->link); |
2879 | ipmi_free_recv_msg(recv_msg); | 2880 | ipmi_free_recv_msg(recv_msg); |
2880 | } | 2881 | } |
@@ -2904,7 +2905,7 @@ static int handle_read_event_rsp(ipmi_smi_t intf, | |||
2904 | /* No one to receive the message, put it in queue if there's | 2905 | /* No one to receive the message, put it in queue if there's |
2905 | not already too many things in the queue. */ | 2906 | not already too many things in the queue. */ |
2906 | recv_msg = ipmi_alloc_recv_msg(); | 2907 | recv_msg = ipmi_alloc_recv_msg(); |
2907 | if (! recv_msg) { | 2908 | if (!recv_msg) { |
2908 | /* We couldn't allocate memory for the | 2909 | /* We couldn't allocate memory for the |
2909 | message, so requeue it for handling | 2910 | message, so requeue it for handling |
2910 | later. */ | 2911 | later. */ |
@@ -3189,7 +3190,7 @@ void ipmi_smi_watchdog_pretimeout(ipmi_smi_t intf) | |||
3189 | 3190 | ||
3190 | rcu_read_lock(); | 3191 | rcu_read_lock(); |
3191 | list_for_each_entry_rcu(user, &intf->users, link) { | 3192 | list_for_each_entry_rcu(user, &intf->users, link) { |
3192 | if (! user->handler->ipmi_watchdog_pretimeout) | 3193 | if (!user->handler->ipmi_watchdog_pretimeout) |
3193 | continue; | 3194 | continue; |
3194 | 3195 | ||
3195 | user->handler->ipmi_watchdog_pretimeout(user->handler_data); | 3196 | user->handler->ipmi_watchdog_pretimeout(user->handler_data); |
@@ -3277,7 +3278,7 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | |||
3277 | 3278 | ||
3278 | smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot, | 3279 | smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot, |
3279 | ent->seqid); | 3280 | ent->seqid); |
3280 | if (! smi_msg) | 3281 | if (!smi_msg) |
3281 | return; | 3282 | return; |
3282 | 3283 | ||
3283 | spin_unlock_irqrestore(&intf->seq_lock, *flags); | 3284 | spin_unlock_irqrestore(&intf->seq_lock, *flags); |
@@ -3313,8 +3314,9 @@ static void ipmi_timeout_handler(long timeout_period) | |||
3313 | 3314 | ||
3314 | /* See if any waiting messages need to be processed. */ | 3315 | /* See if any waiting messages need to be processed. */ |
3315 | spin_lock_irqsave(&intf->waiting_msgs_lock, flags); | 3316 | spin_lock_irqsave(&intf->waiting_msgs_lock, flags); |
3316 | list_for_each_entry_safe(smi_msg, smi_msg2, &intf->waiting_msgs, link) { | 3317 | list_for_each_entry_safe(smi_msg, smi_msg2, |
3317 | if (! handle_new_recv_msg(intf, smi_msg)) { | 3318 | &intf->waiting_msgs, link) { |
3319 | if (!handle_new_recv_msg(intf, smi_msg)) { | ||
3318 | list_del(&smi_msg->link); | 3320 | list_del(&smi_msg->link); |
3319 | ipmi_free_smi_msg(smi_msg); | 3321 | ipmi_free_smi_msg(smi_msg); |
3320 | } else { | 3322 | } else { |