Skip to content

Commit 6a46289

Browse files
PauloMigAlmeidaJiri Kosina
authored andcommitted
HID: hyperv: remove unused struct synthhid_msg
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 <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 542f25a commit 6a46289

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

drivers/hid/hid-hyperv.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ struct hv_input_dev_info {
2222
unsigned short reserved[11];
2323
};
2424

25-
/* The maximum size of a synthetic input message. */
26-
#define SYNTHHID_MAX_INPUT_REPORT_SIZE 16
27-
2825
/*
2926
* Current version
3027
*
@@ -59,11 +56,6 @@ struct synthhid_msg_hdr {
5956
u32 size;
6057
};
6158

62-
struct synthhid_msg {
63-
struct synthhid_msg_hdr header;
64-
char data[]; /* Enclosed message */
65-
};
66-
6759
union synthhid_version {
6860
struct {
6961
u16 minor_version;
@@ -251,7 +243,7 @@ static void mousevsc_on_receive(struct hv_device *device,
251243
struct vmpacket_descriptor *packet)
252244
{
253245
struct pipe_prt_msg *pipe_msg;
254-
struct synthhid_msg *hid_msg;
246+
struct synthhid_msg_hdr *hid_msg_hdr;
255247
struct mousevsc_dev *input_dev = hv_get_drvdata(device);
256248
struct synthhid_input_report *input_report;
257249
size_t len;
@@ -262,9 +254,9 @@ static void mousevsc_on_receive(struct hv_device *device,
262254
if (pipe_msg->type != PIPE_MESSAGE_DATA)
263255
return;
264256

265-
hid_msg = (struct synthhid_msg *)pipe_msg->data;
257+
hid_msg_hdr = (struct synthhid_msg_hdr *)pipe_msg->data;
266258

267-
switch (hid_msg->header.type) {
259+
switch (hid_msg_hdr->type) {
268260
case SYNTH_HID_PROTOCOL_RESPONSE:
269261
/*
270262
* While it will be impossible for us to protect against
@@ -309,7 +301,7 @@ static void mousevsc_on_receive(struct hv_device *device,
309301
break;
310302
default:
311303
pr_err("unsupported hid msg type - type %d len %d\n",
312-
hid_msg->header.type, hid_msg->header.size);
304+
hid_msg_hdr->type, hid_msg_hdr->size);
313305
break;
314306
}
315307

0 commit comments

Comments
 (0)