linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] Drivers: hv: Simplify data structures for VMBus channel close message
@ 2025-08-31 16:04 mhkelley58
  2025-08-31 17:56 ` Tianyu Lan
  0 siblings, 1 reply; 2+ messages in thread
From: mhkelley58 @ 2025-08-31 16:04 UTC (permalink / raw)
  To: haiyangz, wei.liu, decui, kys, linux-kernel, linux-hyperv; +Cc: gustavoars

From: Michael Kelley <mhklinux@outlook.com>

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>
---
 drivers/hv/channel.c   | 2 +-
 include/linux/hyperv.h | 7 +------
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 7c7c66e0dc3f..162d6aeece7b 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -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;
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index a59c5c3e95fb..59826c89171c 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -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 */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] Drivers: hv: Simplify data structures for VMBus channel close message
  2025-08-31 16:04 [PATCH 1/1] Drivers: hv: Simplify data structures for VMBus channel close message mhkelley58
@ 2025-08-31 17:56 ` Tianyu Lan
  0 siblings, 0 replies; 2+ messages in thread
From: Tianyu Lan @ 2025-08-31 17:56 UTC (permalink / raw)
  To: mhklinux
  Cc: haiyangz, wei.liu, decui, kys, linux-kernel, linux-hyperv,
	gustavoars

On Mon, Sep 1, 2025 at 12:06 AM <mhkelley58@gmail.com> wrote:
>
> From: Michael Kelley <mhklinux@outlook.com>
>
> 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>




-- 
Thanks
Tianyu Lan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-31 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-31 16:04 [PATCH 1/1] Drivers: hv: Simplify data structures for VMBus channel close message mhkelley58
2025-08-31 17:56 ` Tianyu Lan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).