]> Gentwo Git Trees - linux/.git/commitdiff
Drivers: hv: Simplify data structures for VMBus channel close message
authorMichael Kelley <mhklinux@outlook.com>
Sun, 31 Aug 2025 16:04:06 +0000 (09:04 -0700)
committerWei Liu <wei.liu@kernel.org>
Mon, 8 Sep 2025 22:11:03 +0000 (22:11 +0000)
struct vmbus_close_msg is used for sending the VMBus channel close
message. It contains a struct vmbus_channel_msginfo, which has a
flex array member at the end. The latter's presence in the middle
of struct vmbus_close_msg causes warnings when built with
-Wflex-array-member-not-at-end.

But the struct vmbus_channel_msginfo is unused because the Hyper-V host
does not send a response to the channel close message. So remove the
struct vmbus_channel_msginfo. Then, since the only remaining field is
struct vmbus_channel_close_channel, also remove the containing struct
vmbus_close_msg and directly use struct vmbus_channel_close_channel.
Besides eliminating unnecessary complexity, these changes resolve the
-Wflex-array-member-not-at-end warnings.

Signed-off-by: Michael Kelley <mhklinux@outlook.com>
Reviewed-by: Tianyu Lan <tiala@microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
drivers/hv/channel.c
include/linux/hyperv.h

index 7c7c66e0dc3f23804d0763a9a5fa7ebc15c7a8f3..162d6aeece7b3b6e4c321b07008efac49c253af4 100644 (file)
@@ -925,7 +925,7 @@ static int vmbus_close_internal(struct vmbus_channel *channel)
 
        /* Send a closing message */
 
-       msg = &channel->close_msg.msg;
+       msg = &channel->close_msg;
 
        msg->header.msgtype = CHANNELMSG_CLOSECHANNEL;
        msg->child_relid = channel->offermsg.child_relid;
index a59c5c3e95fb87e500be8f9f47d24bb8e252dfa9..59826c89171c7965a6d94746b8f43ebf7f427093 100644 (file)
@@ -707,11 +707,6 @@ struct vmbus_channel_msginfo {
        unsigned char msg[];
 };
 
-struct vmbus_close_msg {
-       struct vmbus_channel_msginfo info;
-       struct vmbus_channel_close_channel msg;
-};
-
 enum vmbus_device_type {
        HV_IDE = 0,
        HV_SCSI,
@@ -800,7 +795,7 @@ struct vmbus_channel {
        struct hv_ring_buffer_info outbound;    /* send to parent */
        struct hv_ring_buffer_info inbound;     /* receive from parent */
 
-       struct vmbus_close_msg close_msg;
+       struct vmbus_channel_close_channel close_msg;
 
        /* Statistics */
        u64     interrupts;     /* Host to Guest interrupts */