From 817c040c3f011b4bbd01774cb3944cff3cac6064 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 06:55:21 +0000 Subject: [PATCH] hyperv/vmbus: Remove unnecessary callback check. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7046 --- sys/dev/hyperv/vmbus/hv_channel.c | 44 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/sys/dev/hyperv/vmbus/hv_channel.c b/sys/dev/hyperv/vmbus/hv_channel.c index 3d3608b0024e..f22de43ef3f2 100644 --- a/sys/dev/hyperv/vmbus/hv_channel.c +++ b/sys/dev/hyperv/vmbus/hv_channel.c @@ -861,31 +861,29 @@ VmbusProcessChannelEvent(void* context, int pending) if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) is_batched_reading = true; - if (channel->on_channel_callback != NULL) { - arg = channel->channel_callback_context; - /* - * Optimize host to guest signaling by ensuring: - * 1. While reading the channel, we disable interrupts from - * host. - * 2. Ensure that we process all posted messages from the host - * before returning from this callback. - * 3. Once we return, enable signaling from the host. Once this - * state is set we check to see if additional packets are - * available to read. In this case we repeat the process. - */ - do { - if (is_batched_reading) - hv_ring_buffer_read_begin(&channel->inbound); + arg = channel->channel_callback_context; + /* + * Optimize host to guest signaling by ensuring: + * 1. While reading the channel, we disable interrupts from + * host. + * 2. Ensure that we process all posted messages from the host + * before returning from this callback. + * 3. Once we return, enable signaling from the host. Once this + * state is set we check to see if additional packets are + * available to read. In this case we repeat the process. + */ + do { + if (is_batched_reading) + hv_ring_buffer_read_begin(&channel->inbound); - channel->on_channel_callback(arg); + channel->on_channel_callback(arg); - if (is_batched_reading) - bytes_to_read = - hv_ring_buffer_read_end(&channel->inbound); - else - bytes_to_read = 0; - } while (is_batched_reading && (bytes_to_read != 0)); - } + if (is_batched_reading) + bytes_to_read = + hv_ring_buffer_read_end(&channel->inbound); + else + bytes_to_read = 0; + } while (is_batched_reading && (bytes_to_read != 0)); } static __inline void