Skip to content

Commit

Permalink
HID: hyperv: remove unused struct synthhid_msg
Browse files Browse the repository at this point in the history
struct synthhid_msg was meant to be a generic representation of the
possible protocol messages sent through VMBus. In practice, only the
header is read and depending on the message type, a cast to the actual
type is done. Also, SYNTHHID_MAX_INPUT_REPORT_SIZE constant isn't used
which I suspect is a leftover from the refactoring made while this
driver was at the staging folder.

This patch removes struct synthhid_msg and refactor the code
accordingly.

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Paulo Miguel Almeida authored and Jiri Kosina committed Oct 24, 2022
1 parent 542f25a commit 6a46289
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions drivers/hid/hid-hyperv.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ struct hv_input_dev_info {
unsigned short reserved[11];
};

/* The maximum size of a synthetic input message. */
#define SYNTHHID_MAX_INPUT_REPORT_SIZE 16

/*
* Current version
*
Expand Down Expand Up @@ -59,11 +56,6 @@ struct synthhid_msg_hdr {
u32 size;
};

struct synthhid_msg {
struct synthhid_msg_hdr header;
char data[]; /* Enclosed message */
};

union synthhid_version {
struct {
u16 minor_version;
Expand Down Expand Up @@ -251,7 +243,7 @@ static void mousevsc_on_receive(struct hv_device *device,
struct vmpacket_descriptor *packet)
{
struct pipe_prt_msg *pipe_msg;
struct synthhid_msg *hid_msg;
struct synthhid_msg_hdr *hid_msg_hdr;
struct mousevsc_dev *input_dev = hv_get_drvdata(device);
struct synthhid_input_report *input_report;
size_t len;
Expand All @@ -262,9 +254,9 @@ static void mousevsc_on_receive(struct hv_device *device,
if (pipe_msg->type != PIPE_MESSAGE_DATA)
return;

hid_msg = (struct synthhid_msg *)pipe_msg->data;
hid_msg_hdr = (struct synthhid_msg_hdr *)pipe_msg->data;

switch (hid_msg->header.type) {
switch (hid_msg_hdr->type) {
case SYNTH_HID_PROTOCOL_RESPONSE:
/*
* While it will be impossible for us to protect against
Expand Down Expand Up @@ -309,7 +301,7 @@ static void mousevsc_on_receive(struct hv_device *device,
break;
default:
pr_err("unsupported hid msg type - type %d len %d\n",
hid_msg->header.type, hid_msg->header.size);
hid_msg_hdr->type, hid_msg_hdr->size);
break;
}

Expand Down

0 comments on commit 6a46289

Please sign in to comment.