Drivers: hv: kvp: move poll_channel() to hyperv_vmbus.h
authorVitaly Kuznetsov <vkuznets@redhat.com>
Sun, 12 Apr 2015 01:07:41 +0000 (18:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 May 2015 19:17:40 +0000 (12:17 -0700)
Move poll_channel() to hyperv_vmbus.h and make it inline and rename it to hv_poll_channel() so it can be reused
in other hv_util modules.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/hv_kvp.c
drivers/hv/hyperv_vmbus.h

index caa467dc835141dfa3d6af43217fc6f4fec90a92..939c3e7e4175442bd576a0287fa5151015e5c182 100644 (file)
@@ -128,17 +128,6 @@ kvp_work_func(struct work_struct *dummy)
        kvp_respond_to_host(NULL, HV_E_FAIL);
 }
 
-static void poll_channel(struct vmbus_channel *channel)
-{
-       if (channel->target_cpu != smp_processor_id())
-               smp_call_function_single(channel->target_cpu,
-                                        hv_kvp_onchannelcallback,
-                                        channel, true);
-       else
-               hv_kvp_onchannelcallback(channel);
-}
-
-
 static int kvp_handle_handshake(struct hv_kvp_msg *msg)
 {
        int ret = 1;
@@ -166,8 +155,8 @@ static int kvp_handle_handshake(struct hv_kvp_msg *msg)
                pr_info("KVP: user-mode registering done.\n");
                kvp_register(dm_reg_value);
                kvp_transaction.active = false;
-               if (kvp_transaction.kvp_context)
-                       poll_channel(kvp_transaction.kvp_context);
+               hv_poll_channel(kvp_transaction.kvp_context,
+                               hv_kvp_onchannelcallback);
        }
        return ret;
 }
@@ -587,7 +576,7 @@ response_done:
 
        vmbus_sendpacket(channel, recv_buffer, buf_len, req_id,
                                VM_PKT_DATA_INBAND, 0);
-       poll_channel(channel);
+       hv_poll_channel(channel, hv_kvp_onchannelcallback);
 }
 
 /*
index ddcf6c405195e938a4c7f7c346fa2719311c6308..2f30456d90a5dbb5ad7c0a99c7926fbf6554b1e0 100644 (file)
@@ -742,5 +742,17 @@ int hv_fcopy_init(struct hv_util_service *);
 void hv_fcopy_deinit(void);
 void hv_fcopy_onchannelcallback(void *);
 
+static inline void hv_poll_channel(struct vmbus_channel *channel,
+                                  void (*cb)(void *))
+{
+       if (!channel)
+               return;
+
+       if (channel->target_cpu != smp_processor_id())
+               smp_call_function_single(channel->target_cpu,
+                                        cb, channel, true);
+       else
+               cb(channel);
+}
 
 #endif /* _HYPERV_VMBUS_H */