Skip to content

Commit 551117c

Browse files
dtorJiri Kosina
authored andcommitted
HID: i2c-hid: no longer need raw access to HID descriptor structure
We can stop defining a union for HID descriptor data as we now only access individual members of it by names and using proper types instead of accessing by offset from the beginning of the data structure. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 86fc3fd commit 551117c

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

drivers/hid/i2c-hid/i2c-hid-core.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ struct i2c_hid_desc {
9898
struct i2c_hid {
9999
struct i2c_client *client; /* i2c client */
100100
struct hid_device *hid; /* pointer to corresponding HID dev */
101-
union {
102-
__u8 hdesc_buffer[sizeof(struct i2c_hid_desc)];
103-
struct i2c_hid_desc hdesc; /* the HID Descriptor */
104-
};
101+
struct i2c_hid_desc hdesc; /* the HID Descriptor */
105102
__le16 wHIDDescRegister; /* location of the i2c
106103
* register of the HID
107104
* descriptor. */
@@ -923,7 +920,7 @@ static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
923920
"weird size of HID descriptor (%u)\n", dsize);
924921
return -ENODEV;
925922
}
926-
i2c_hid_dbg(ihid, "HID Descriptor: %*ph\n", dsize, ihid->hdesc_buffer);
923+
i2c_hid_dbg(ihid, "HID Descriptor: %*ph\n", dsize, &ihid->hdesc);
927924
return 0;
928925
}
929926

0 commit comments

Comments
 (0)