Skip to content

Commit

Permalink
Drivers: hv: avoid passing opaque pointer to vmbus_onmessage()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vitaly Kuznetsov authored and Wei Liu committed Apr 23, 2020
1 parent a276463 commit 5cc4150
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
7 changes: 1 addition & 6 deletions drivers/hv/channel_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/*
Expand Down
3 changes: 2 additions & 1 deletion drivers/hv/vmbus_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion include/linux/hyperv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 5cc4150

Please sign in to comment.