Drivers: hv: avoid passing opaque pointer to vmbus_onmessage()
authorVitaly Kuznetsov <vkuznets@redhat.com>
Mon, 6 Apr 2020 10:41:52 +0000 (12:41 +0200)
committerWei Liu <wei.liu@kernel.org>
Thu, 23 Apr 2020 13:17:11 +0000 (13:17 +0000)
vmbus_onmessage() doesn't need the header of the message, it only
uses it to get to the payload, we can pass the pointer to the
payload directly.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20200406104154.45010-4-vkuznets@redhat.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
drivers/hv/channel_mgmt.c
drivers/hv/vmbus_drv.c
include/linux/hyperv.h

index 501c43c..da93b5f 100644 (file)
@@ -1363,13 +1363,8 @@ channel_message_table[CHANNELMSG_COUNT] = {
  *
  * This is invoked in the vmbus worker thread context.
  */
-void vmbus_onmessage(void *context)
+void vmbus_onmessage(struct vmbus_channel_message_header *hdr)
 {
-       struct hv_message *msg = context;
-       struct vmbus_channel_message_header *hdr;
-
-       hdr = (struct vmbus_channel_message_header *)msg->u.payload;
-
        trace_vmbus_on_message(hdr);
 
        /*
index e356ea4..8f08e82 100644 (file)
@@ -1035,7 +1035,8 @@ static void vmbus_onmessage_work(struct work_struct *work)
 
        ctx = container_of(work, struct onmessage_work_context,
                           work);
-       vmbus_onmessage(&ctx->msg);
+       vmbus_onmessage((struct vmbus_channel_message_header *)
+                       &ctx->msg.payload);
        kfree(ctx);
 }
 
index 692c89c..cbd24f4 100644 (file)
@@ -1017,7 +1017,7 @@ static inline void clear_low_latency_mode(struct vmbus_channel *c)
        c->low_latency = false;
 }
 
-void vmbus_onmessage(void *context);
+void vmbus_onmessage(struct vmbus_channel_message_header *hdr);
 
 int vmbus_request_offers(void);