hyperv: Use auto rcu_read macros
Use RCU_READ_LOCK_GUARD and WITH_RCU_READ_LOCK_GUARD to replace the manual rcu_read_(un)lock calls. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
d3e07dc83e
commit
b66173afbd
@ -546,14 +546,14 @@ uint16_t hyperv_hcall_post_message(uint64_t param, bool fast)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = HV_STATUS_INVALID_CONNECTION_ID;
|
ret = HV_STATUS_INVALID_CONNECTION_ID;
|
||||||
rcu_read_lock();
|
WITH_RCU_READ_LOCK_GUARD() {
|
||||||
QLIST_FOREACH_RCU(mh, &msg_handlers, link) {
|
QLIST_FOREACH_RCU(mh, &msg_handlers, link) {
|
||||||
if (mh->conn_id == (msg->connection_id & HV_CONNECTION_ID_MASK)) {
|
if (mh->conn_id == (msg->connection_id & HV_CONNECTION_ID_MASK)) {
|
||||||
ret = mh->handler(msg, mh->data);
|
ret = mh->handler(msg, mh->data);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
|
||||||
|
|
||||||
unmap:
|
unmap:
|
||||||
cpu_physical_memory_unmap(msg, len, 0, 0);
|
cpu_physical_memory_unmap(msg, len, 0, 0);
|
||||||
@ -619,7 +619,6 @@ int hyperv_set_event_flag_handler(uint32_t conn_id, EventNotifier *notifier)
|
|||||||
|
|
||||||
uint16_t hyperv_hcall_signal_event(uint64_t param, bool fast)
|
uint16_t hyperv_hcall_signal_event(uint64_t param, bool fast)
|
||||||
{
|
{
|
||||||
uint16_t ret;
|
|
||||||
EventFlagHandler *handler;
|
EventFlagHandler *handler;
|
||||||
|
|
||||||
if (unlikely(!fast)) {
|
if (unlikely(!fast)) {
|
||||||
@ -645,15 +644,12 @@ uint16_t hyperv_hcall_signal_event(uint64_t param, bool fast)
|
|||||||
return HV_STATUS_INVALID_HYPERCALL_INPUT;
|
return HV_STATUS_INVALID_HYPERCALL_INPUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = HV_STATUS_INVALID_CONNECTION_ID;
|
RCU_READ_LOCK_GUARD();
|
||||||
rcu_read_lock();
|
|
||||||
QLIST_FOREACH_RCU(handler, &event_flag_handlers, link) {
|
QLIST_FOREACH_RCU(handler, &event_flag_handlers, link) {
|
||||||
if (handler->conn_id == param) {
|
if (handler->conn_id == param) {
|
||||||
event_notifier_set(handler->notifier);
|
event_notifier_set(handler->notifier);
|
||||||
ret = 0;
|
return 0;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
return HV_STATUS_INVALID_CONNECTION_ID;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user