| @@ -534,15 +534,20 @@ struct ipmi_smi { · 533 unmodified lines |
| 534 | atomic_t event_waiters; | 534 | atomic_t event_waiters; |
| 535 | unsigned int ticks_to_req_ev; | 535 | unsigned int ticks_to_req_ev; |
| 536 | | 536 | |
| | 537 | spinlock_t watch_lock; /* For dealing with watch stuff below. */ |
| | 538 | |
| 537 | /* How many users are waiting for commands? */ | 539 | /* How many users are waiting for commands? */ |
| 538 | atomic_t command_waiters; | 540 | unsigned int command_waiters; |
| 539 | | 541 | |
| 540 | /* How many users are waiting for watchdogs? */ | 542 | /* How many users are waiting for watchdogs? */ |
| 541 | atomic_t watchdog_waiters; | 543 | unsigned int watchdog_waiters; |
| | 544 | |
| | 545 | /* How many users are waiting for message responses? */ |
| | 546 | unsigned int response_waiters; |
| 542 | | 547 | |
| 543 | /* | 548 | /* |
| 544 | * Tells what the lower layer has last been asked to watch for, | 549 | * Tells what the lower layer has last been asked to watch for, |
| 545 | * messages and/or watchdogs. Protected by xmit_msgs_lock. | 550 | * messages and/or watchdogs. Protected by watch_lock. |
| 546 | */ | 551 | */ |
| 547 | unsigned int last_watch_mask; | 552 | unsigned int last_watch_mask; |
| 548 | | 553 | |
| @@ -938,6 +943,64 @@ static void deliver_err_response(struct ipmi_smi *intf, · 389 unmodified lines |
| 938 | deliver_local_response(intf, msg); | 943 | deliver_local_response(intf, msg); |
| 939 | } | 944 | } |
| 940 | | 945 | |
| | 946 | static void smi_add_watch(struct ipmi_smi *intf, unsigned int flags) |
| | 947 | { |
| | 948 | unsigned long iflags; |
| | 949 | |
| | 950 | if (!intf->handlers->set_need_watch) |
| | 951 | return; |
| | 952 | |
| | 953 | spin_lock_irqsave(&intf->watch_lock, iflags); |
| | 954 | if (flags & IPMI_WATCH_MASK_CHECK_MESSAGES) |
| | 955 | intf->response_waiters++; |
| | 956 | |
| | 957 | if (flags & IPMI_WATCH_MASK_CHECK_WATCHDOG) |
| | 958 | intf->watchdog_waiters++; |
| | 959 | |
| | 960 | if (flags & IPMI_WATCH_MASK_CHECK_COMMANDS) |
| | 961 | intf->command_waiters++; |
| | 962 | |
| | 963 | if ((intf->last_watch_mask & flags) != flags) { |
| | 964 | intf->last_watch_mask |= flags; |
| | 965 | intf->handlers->set_need_watch(intf->send_info, |
| | 966 | intf->last_watch_mask); |
| | 967 | } |
| | 968 | spin_unlock_irqrestore(&intf->watch_lock, iflags); |
| | 969 | } |
| | 970 | |
| | 971 | static void smi_remove_watch(struct ipmi_smi *intf, unsigned int flags) |
| | 972 | { |
| | 973 | unsigned long iflags; |
| | 974 | |
| | 975 | if (!intf->handlers->set_need_watch) |
| | 976 | return; |
| | 977 | |
| | 978 | spin_lock_irqsave(&intf->watch_lock, iflags); |
| | 979 | if (flags & IPMI_WATCH_MASK_CHECK_MESSAGES) |
| | 980 | intf->response_waiters--; |
| | 981 | |
| | 982 | if (flags & IPMI_WATCH_MASK_CHECK_WATCHDOG) |
| | 983 | intf->watchdog_waiters--; |
| | 984 | |
| | 985 | if (flags & IPMI_WATCH_MASK_CHECK_COMMANDS) |
| | 986 | intf->command_waiters--; |
| | 987 | |
| | 988 | flags = 0; |
| | 989 | if (intf->response_waiters) |
| | 990 | flags |= IPMI_WATCH_MASK_CHECK_MESSAGES; |
| | 991 | if (intf->watchdog_waiters) |
| | 992 | flags |= IPMI_WATCH_MASK_CHECK_WATCHDOG; |
| | 993 | if (intf->command_waiters) |
| | 994 | flags |= IPMI_WATCH_MASK_CHECK_COMMANDS; |
| | 995 | |
| | 996 | if (intf->last_watch_mask != flags) { |
| | 997 | intf->last_watch_mask = flags; |
| | 998 | intf->handlers->set_need_watch(intf->send_info, |
| | 999 | intf->last_watch_mask); |
| | 1000 | } |
| | 1001 | spin_unlock_irqrestore(&intf->watch_lock, iflags); |
| | 1002 | } |
| | 1003 | |
| 941 | /* | 1004 | /* |
| 942 | * Find the next sequence number not being used and add the given | 1005 | * Find the next sequence number not being used and add the given |
| 943 | * message with the given timeout to the sequence table. This must be | 1006 | * message with the given timeout to the sequence table. This must be |
| @@ -981,6 +1044,7 @@ static int intf_next_seq(struct ipmi_smi *intf, · 37 unmodified lines |
| 981 | *seq = i; | 1044 | *seq = i; |
| 982 | *seqid = intf->seq_table[i].seqid; | 1045 | *seqid = intf->seq_table[i].seqid; |
| 983 | intf->curr_seq = (i+1)%IPMI_IPMB_NUM_SEQ; | 1046 | intf->curr_seq = (i+1)%IPMI_IPMB_NUM_SEQ; |
| | 1047 | smi_add_watch(intf, IPMI_WATCH_MASK_CHECK_MESSAGES); |
| 984 | need_waiter(intf); | 1048 | need_waiter(intf); |
| 985 | } else { | 1049 | } else { |
| 986 | rv = -EAGAIN; | 1050 | rv = -EAGAIN; |
| @@ -1019,6 +1083,7 @@ static int intf_find_seq(struct ipmi_smi *intf, · 32 unmodified lines |
| 1019 | && (ipmi_addr_equal(addr, &msg->addr))) { | 1083 | && (ipmi_addr_equal(addr, &msg->addr))) { |
| 1020 | *recv_msg = msg; | 1084 | *recv_msg = msg; |
| 1021 | intf->seq_table[seq].inuse = 0; | 1085 | intf->seq_table[seq].inuse = 0; |
| | 1086 | smi_remove_watch(intf, IPMI_WATCH_MASK_CHECK_MESSAGES); |
| 1022 | rv = 0; | 1087 | rv = 0; |
| 1023 | } | 1088 | } |
| 1024 | } | 1089 | } |
| @@ -1080,6 +1145,7 @@ static int intf_err_seq(struct ipmi_smi *intf, · 55 unmodified lines |
| 1080 | struct seq_table *ent = &intf->seq_table[seq]; | 1145 | struct seq_table *ent = &intf->seq_table[seq]; |
| 1081 | | 1146 | |
| 1082 | ent->inuse = 0; | 1147 | ent->inuse = 0; |
| | 1148 | smi_remove_watch(intf, IPMI_WATCH_MASK_CHECK_MESSAGES); |
| 1083 | msg = ent->recv_msg; | 1149 | msg = ent->recv_msg; |
| 1084 | rv = 0; | 1150 | rv = 0; |
| 1085 | } | 1151 | } |
| @@ -1091,30 +1157,6 @@ static int intf_err_seq(struct ipmi_smi *intf, · 5 unmodified lines |
| 1091 | return rv; | 1157 | return rv; |
| 1092 | } | 1158 | } |
| 1093 | | 1159 | |
| 1094 | /* Must be called with xmit_msgs_lock held. */ | | |
| 1095 | static void smi_tell_to_watch(struct ipmi_smi *intf, | | |
| 1096 | unsigned int flags, | | |
| 1097 | struct ipmi_smi_msg *smi_msg) | | |
| 1098 | { | | |
| 1099 | if (flags & IPMI_WATCH_MASK_CHECK_MESSAGES) { | | |
| 1100 | if (!smi_msg) | | |
| 1101 | return; | | |
| 1102 | | | |
| 1103 | if (!smi_msg->needs_response) | | |
| 1104 | return; | | |
| 1105 | } | | |
| 1106 | | | |
| 1107 | if (!intf->handlers->set_need_watch) | | |
| 1108 | return; | | |
| 1109 | | | |
| 1110 | if ((intf->last_watch_mask & flags) == flags) | | |
| 1111 | return; | | |
| 1112 | | | |
| 1113 | intf->last_watch_mask |= flags; | | |
| 1114 | intf->handlers->set_need_watch(intf->send_info, | | |
| 1115 | intf->last_watch_mask); | | |
| 1116 | } | | |
| 1117 | | | |
| 1118 | int ipmi_create_user(unsigned int if_num, | 1160 | int ipmi_create_user(unsigned int if_num, |
| 1119 | const struct ipmi_user_hndl *handler, | 1161 | const struct ipmi_user_hndl *handler, |
| 1120 | void *handler_data, | 1162 | void *handler_data, |
| @@ -1175,12 +1217,9 @@ int ipmi_create_user(unsigned int if_num, · 54 unmodified lines |
| 1175 | spin_lock_irqsave(&intf->seq_lock, flags); | 1217 | spin_lock_irqsave(&intf->seq_lock, flags); |
| 1176 | list_add_rcu(&new_user->link, &intf->users); | 1218 | list_add_rcu(&new_user->link, &intf->users); |
| 1177 | spin_unlock_irqrestore(&intf->seq_lock, flags); | 1219 | spin_unlock_irqrestore(&intf->seq_lock, flags); |
| 1178 | if (handler->ipmi_watchdog_pretimeout) { | 1220 | if (handler->ipmi_watchdog_pretimeout) |
| 1179 | /* User wants pretimeouts, so make sure to watch for them. */ | 1221 | /* User wants pretimeouts, so make sure to watch for them. */ |
| 1180 | if (atomic_inc_return(&intf->watchdog_waiters) == 1) | 1222 | smi_add_watch(intf, IPMI_WATCH_MASK_CHECK_WATCHDOG); |
| 1181 | smi_tell_to_watch(intf, IPMI_WATCH_MASK_CHECK_WATCHDOG, | | |
| 1182 | NULL); | | |
| 1183 | } | | |
| 1184 | srcu_read_unlock(&ipmi_interfaces_srcu, index); | 1223 | srcu_read_unlock(&ipmi_interfaces_srcu, index); |
| 1185 | *user = new_user; | 1224 | *user = new_user; |
| 1186 | return 0; | 1225 | return 0; |
| @@ -1251,7 +1290,7 @@ static void _ipmi_destroy_user(struct ipmi_user *user) · 64 unmodified lines |
| 1251 | user->handler->shutdown(user->handler_data); | 1290 | user->handler->shutdown(user->handler_data); |
| 1252 | | 1291 | |
| 1253 | if (user->handler->ipmi_watchdog_pretimeout) | 1292 | if (user->handler->ipmi_watchdog_pretimeout) |
| 1254 | atomic_dec(&intf->watchdog_waiters); | 1293 | smi_remove_watch(intf, IPMI_WATCH_MASK_CHECK_WATCHDOG); |
| 1255 | | 1294 | |
| 1256 | if (user->gets_events) | 1295 | if (user->gets_events) |
| 1257 | atomic_dec(&intf->event_waiters); | 1296 | atomic_dec(&intf->event_waiters); |
| @@ -1264,6 +1303,7 @@ static void _ipmi_destroy_user(struct ipmi_user *user) · 6 unmodified lines |
| 1264 | if (intf->seq_table[i].inuse | 1303 | if (intf->seq_table[i].inuse |
| 1265 | && (intf->seq_table[i].recv_msg->user == user)) { | 1304 | && (intf->seq_table[i].recv_msg->user == user)) { |
| 1266 | intf->seq_table[i].inuse = 0; | 1305 | intf->seq_table[i].inuse = 0; |
| | 1306 | smi_remove_watch(intf, IPMI_WATCH_MASK_CHECK_MESSAGES); |
| 1267 | ipmi_free_recv_msg(intf->seq_table[i].recv_msg); | 1307 | ipmi_free_recv_msg(intf->seq_table[i].recv_msg); |
| 1268 | } | 1308 | } |
| 1269 | } | 1309 | } |
| @@ -1606,8 +1646,7 @@ int ipmi_register_for_cmd(struct ipmi_user *user, · 336 unmodified lines |
| 1606 | goto out_unlock; | 1646 | goto out_unlock; |
| 1607 | } | 1647 | } |
| 1608 | | 1648 | |
| 1609 | if (atomic_inc_return(&intf->command_waiters) == 1) | 1649 | smi_add_watch(intf, IPMI_WATCH_MASK_CHECK_COMMANDS); |
| 1610 | smi_tell_to_watch(intf, IPMI_WATCH_MASK_CHECK_COMMANDS, NULL); | | |
| 1611 | | 1650 | |
| 1612 | list_add_rcu(&rcvr->link, &intf->cmd_rcvrs); | 1651 | list_add_rcu(&rcvr->link, &intf->cmd_rcvrs); |
| 1613 | | 1652 | |
| @@ -1657,7 +1696,7 @@ int ipmi_unregister_for_cmd(struct ipmi_user *user, · 43 unmodified lines |
| 1657 | synchronize_rcu(); | 1696 | synchronize_rcu(); |
| 1658 | release_ipmi_user(user, index); | 1697 | release_ipmi_user(user, index); |
| 1659 | while (rcvrs) { | 1698 | while (rcvrs) { |
| 1660 | atomic_dec(&intf->command_waiters); | 1699 | smi_remove_watch(intf, IPMI_WATCH_MASK_CHECK_COMMANDS); |
| 1661 | rcvr = rcvrs; | 1700 | rcvr = rcvrs; |
| 1662 | rcvrs = rcvr->next; | 1701 | rcvrs = rcvr->next; |
| 1663 | kfree(rcvr); | 1702 | kfree(rcvr); |
| @@ -1785,8 +1824,6 @@ static void smi_send(struct ipmi_smi *intf, · 121 unmodified lines |
| 1785 | spin_lock_irqsave(&intf->xmit_msgs_lock, flags); | 1824 | spin_lock_irqsave(&intf->xmit_msgs_lock, flags); |
| 1786 | smi_msg = smi_add_send_msg(intf, smi_msg, priority); | 1825 | smi_msg = smi_add_send_msg(intf, smi_msg, priority); |
| 1787 | | 1826 | |
| 1788 | smi_tell_to_watch(intf, IPMI_WATCH_MASK_CHECK_MESSAGES, smi_msg); | | |
| 1789 | | | |
| 1790 | if (!run_to_completion) | 1827 | if (!run_to_completion) |
| 1791 | spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); | 1828 | spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); |
| 1792 | | 1829 | |
| @@ -1986,9 +2023,6 @@ static int i_ipmi_req_ipmb(struct ipmi_smi *intf, · 193 unmodified lines |
| 1986 | ipmb_seq, broadcast, | 2023 | ipmb_seq, broadcast, |
| 1987 | source_address, source_lun); | 2024 | source_address, source_lun); |
| 1988 | | 2025 | |
| 1989 | /* We will be getting a response in the BMC message queue. */ | | |
| 1990 | smi_msg->needs_response = true; | | |
| 1991 | | | |
| 1992 | /* | 2026 | /* |
| 1993 | * Copy the message into the recv message data, so we | 2027 | * Copy the message into the recv message data, so we |
| 1994 | * can retransmit it later if necessary. | 2028 | * can retransmit it later if necessary. |
| @@ -2176,7 +2210,6 @@ static int i_ipmi_request(struct ipmi_user *user, · 181 unmodified lines |
| 2176 | goto out; | 2210 | goto out; |
| 2177 | } | 2211 | } |
| 2178 | } | 2212 | } |
| 2179 | smi_msg->needs_response = false; | | |
| 2180 | | 2213 | |
| 2181 | rcu_read_lock(); | 2214 | rcu_read_lock(); |
| 2182 | if (intf->in_shutdown) { | 2215 | if (intf->in_shutdown) { |
| @@ -3390,9 +3423,8 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, · 1207 unmodified lines |
| 3390 | INIT_LIST_HEAD(&intf->xmit_msgs); | 3423 | INIT_LIST_HEAD(&intf->xmit_msgs); |
| 3391 | INIT_LIST_HEAD(&intf->hp_xmit_msgs); | 3424 | INIT_LIST_HEAD(&intf->hp_xmit_msgs); |
| 3392 | spin_lock_init(&intf->events_lock); | 3425 | spin_lock_init(&intf->events_lock); |
| | 3426 | spin_lock_init(&intf->watch_lock); |
| 3393 | atomic_set(&intf->event_waiters, 0); | 3427 | atomic_set(&intf->event_waiters, 0); |
| 3394 | atomic_set(&intf->watchdog_waiters, 0); | | |
| 3395 | atomic_set(&intf->command_waiters, 0); | | |
| 3396 | intf->ticks_to_req_ev = IPMI_REQUEST_EV_TIME; | 3428 | intf->ticks_to_req_ev = IPMI_REQUEST_EV_TIME; |
| 3397 | INIT_LIST_HEAD(&intf->waiting_events); | 3429 | INIT_LIST_HEAD(&intf->waiting_events); |
| 3398 | intf->waiting_events_count = 0; | 3430 | intf->waiting_events_count = 0; |
| @@ -4408,8 +4440,6 @@ static void smi_recv_tasklet(unsigned long val) · 1009 unmodified lines |
| 4408 | } | 4440 | } |
| 4409 | } | 4441 | } |
| 4410 | | 4442 | |
| 4411 | smi_tell_to_watch(intf, IPMI_WATCH_MASK_CHECK_MESSAGES, newmsg); | | |
| 4412 | | | |
| 4413 | if (!run_to_completion) | 4443 | if (!run_to_completion) |
| 4414 | spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); | 4444 | spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); |
| 4415 | if (newmsg) | 4445 | if (newmsg) |
| @@ -4537,7 +4567,7 @@ static void check_msg_timeout(struct ipmi_smi *intf, struct seq_table *ent, · 121 unmodified lines |
| 4537 | struct list_head *timeouts, | 4567 | struct list_head *timeouts, |
| 4538 | unsigned long timeout_period, | 4568 | unsigned long timeout_period, |
| 4539 | int slot, unsigned long *flags, | 4569 | int slot, unsigned long *flags, |
| 4540 | unsigned int *watch_mask) | 4570 | bool *need_timer) |
| 4541 | { | 4571 | { |
| 4542 | struct ipmi_recv_msg *msg; | 4572 | struct ipmi_recv_msg *msg; |
| 4543 | | 4573 | |
| @@ -4549,13 +4579,14 @@ static void check_msg_timeout(struct ipmi_smi *intf, struct seq_table *ent, · 5 unmodified lines |
| 4549 | | 4579 | |
| 4550 | if (timeout_period < ent->timeout) { | 4580 | if (timeout_period < ent->timeout) { |
| 4551 | ent->timeout -= timeout_period; | 4581 | ent->timeout -= timeout_period; |
| 4552 | *watch_mask |= IPMI_WATCH_MASK_CHECK_MESSAGES; | 4582 | *need_timer = true; |
| 4553 | return; | 4583 | return; |
| 4554 | } | 4584 | } |
| 4555 | | 4585 | |
| 4556 | if (ent->retries_left == 0) { | 4586 | if (ent->retries_left == 0) { |
| 4557 | /* The message has used all its retries. */ | 4587 | /* The message has used all its retries. */ |
| 4558 | ent->inuse = 0; | 4588 | ent->inuse = 0; |
| | 4589 | smi_remove_watch(intf, IPMI_WATCH_MASK_CHECK_MESSAGES); |
| 4559 | msg = ent->recv_msg; | 4590 | msg = ent->recv_msg; |
| 4560 | list_add_tail(&msg->link, timeouts); | 4591 | list_add_tail(&msg->link, timeouts); |
| 4561 | if (ent->broadcast) | 4592 | if (ent->broadcast) |
| @@ -4568,7 +4599,7 @@ static void check_msg_timeout(struct ipmi_smi *intf, struct seq_table *ent, · 6 unmodified lines |
| 4568 | struct ipmi_smi_msg *smi_msg; | 4599 | struct ipmi_smi_msg *smi_msg; |
| 4569 | /* More retries, send again. */ | 4600 | /* More retries, send again. */ |
| 4570 | | 4601 | |
| 4571 | *watch_mask |= IPMI_WATCH_MASK_CHECK_MESSAGES; | 4602 | *need_timer = true; |
| 4572 | | 4603 | |
| 4573 | /* | 4604 | /* |
| 4574 | * Start with the max timer, set to normal timer after | 4605 | * Start with the max timer, set to normal timer after |
| @@ -4613,20 +4644,20 @@ static void check_msg_timeout(struct ipmi_smi *intf, struct seq_table *ent, · 38 unmodified lines |
| 4613 | } | 4644 | } |
| 4614 | } | 4645 | } |
| 4615 | | 4646 | |
| 4616 | static unsigned int ipmi_timeout_handler(struct ipmi_smi *intf, | 4647 | static bool ipmi_timeout_handler(struct ipmi_smi *intf, |
| 4617 | unsigned long timeout_period) | 4648 | unsigned long timeout_period) |
| 4618 | { | 4649 | { |
| 4619 | struct list_head timeouts; | 4650 | struct list_head timeouts; |
| 4620 | struct ipmi_recv_msg *msg, *msg2; | 4651 | struct ipmi_recv_msg *msg, *msg2; |
| 4621 | unsigned long flags; | 4652 | unsigned long flags; |
| 4622 | int i; | 4653 | int i; |
| 4623 | unsigned int watch_mask = 0; | 4654 | bool need_timer = false; |
| 4624 | | 4655 | |
| 4625 | if (!intf->bmc_registered) { | 4656 | if (!intf->bmc_registered) { |
| 4626 | kref_get(&intf->refcount); | 4657 | kref_get(&intf->refcount); |
| 4627 | if (!schedule_work(&intf->bmc_reg_work)) { | 4658 | if (!schedule_work(&intf->bmc_reg_work)) { |
| 4628 | kref_put(&intf->refcount, intf_free); | 4659 | kref_put(&intf->refcount, intf_free); |
| 4629 | watch_mask |= IPMI_WATCH_MASK_INTERNAL; | 4660 | need_timer = true; |
| 4630 | } | 4661 | } |
| 4631 | } | 4662 | } |
| 4632 | | 4663 | |
| @@ -4646,7 +4677,7 @@ static unsigned int ipmi_timeout_handler(struct ipmi_smi *intf, · 13 unmodified lines |
| 4646 | for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++) | 4677 | for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++) |
| 4647 | check_msg_timeout(intf, &intf->seq_table[i], | 4678 | check_msg_timeout(intf, &intf->seq_table[i], |
| 4648 | &timeouts, timeout_period, i, | 4679 | &timeouts, timeout_period, i, |
| 4649 | &flags, &watch_mask); | 4680 | &flags, &need_timer); |
| 4650 | spin_unlock_irqrestore(&intf->seq_lock, flags); | 4681 | spin_unlock_irqrestore(&intf->seq_lock, flags); |
| 4651 | | 4682 | |
| 4652 | list_for_each_entry_safe(msg, msg2, &timeouts, link) | 4683 | list_for_each_entry_safe(msg, msg2, &timeouts, link) |
| @@ -4677,7 +4708,7 @@ static unsigned int ipmi_timeout_handler(struct ipmi_smi *intf, · 24 unmodified lines |
| 4677 | | 4708 | |
| 4678 | tasklet_schedule(&intf->recv_tasklet); | 4709 | tasklet_schedule(&intf->recv_tasklet); |
| 4679 | | 4710 | |
| 4680 | return watch_mask; | 4711 | return need_timer; |
| 4681 | } | 4712 | } |
| 4682 | | 4713 | |
| 4683 | static void ipmi_request_event(struct ipmi_smi *intf) | 4714 | static void ipmi_request_event(struct ipmi_smi *intf) |
| @@ -4697,9 +4728,8 @@ static atomic_t stop_operation; · 13 unmodified lines |
| 4697 | static void ipmi_timeout(struct timer_list *unused) | 4728 | static void ipmi_timeout(struct timer_list *unused) |
| 4698 | { | 4729 | { |
| 4699 | struct ipmi_smi *intf; | 4730 | struct ipmi_smi *intf; |
| 4700 | unsigned int watch_mask = 0; | 4731 | bool need_timer = false; |
| 4701 | int index; | 4732 | int index; |
| 4702 | unsigned long flags; | | |
| 4703 | | 4733 | |
| 4704 | if (atomic_read(&stop_operation)) | 4734 | if (atomic_read(&stop_operation)) |
| 4705 | return; | 4735 | return; |
| @@ -4712,28 +4742,14 @@ static void ipmi_timeout(struct timer_list *unused) · 6 unmodified lines |
| 4712 | ipmi_request_event(intf); | 4742 | ipmi_request_event(intf); |
| 4713 | intf->ticks_to_req_ev = IPMI_REQUEST_EV_TIME; | 4743 | intf->ticks_to_req_ev = IPMI_REQUEST_EV_TIME; |
| 4714 | } | 4744 | } |
| 4715 | watch_mask |= IPMI_WATCH_MASK_INTERNAL; | 4745 | need_timer = true; |
| 4716 | } | 4746 | } |
| 4717 | | 4747 | |
| 4718 | if (atomic_read(&intf->watchdog_waiters)) | 4748 | need_timer |= ipmi_timeout_handler(intf, IPMI_TIMEOUT_TIME); |
| 4719 | watch_mask |= IPMI_WATCH_MASK_CHECK_WATCHDOG; | | |
| 4720 | | | |
| 4721 | if (atomic_read(&intf->command_waiters)) | | |
| 4722 | watch_mask |= IPMI_WATCH_MASK_CHECK_COMMANDS; | | |
| 4723 | | | |
| 4724 | watch_mask |= ipmi_timeout_handler(intf, IPMI_TIMEOUT_TIME); | | |
| 4725 | | | |
| 4726 | spin_lock_irqsave(&intf->xmit_msgs_lock, flags); | | |
| 4727 | if (watch_mask != intf->last_watch_mask && | | |
| 4728 | intf->handlers->set_need_watch) | | |
| 4729 | intf->handlers->set_need_watch(intf->send_info, | | |
| 4730 | watch_mask); | | |
| 4731 | intf->last_watch_mask = watch_mask; | | |
| 4732 | spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags); | | |
| 4733 | } | 4749 | } |
| 4734 | srcu_read_unlock(&ipmi_interfaces_srcu, index); | 4750 | srcu_read_unlock(&ipmi_interfaces_srcu, index); |
| 4735 | | 4751 | |
| 4736 | if (watch_mask) | 4752 | if (need_timer) |
| 4737 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); | 4753 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); |
| 4738 | } | 4754 | } |
| 4739 | | 4755 | |