lkml.org 
[lkml]   [2022]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 11/12] HID: i2c-hid: no longer need raw access to HID descriptor structure
Date
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>
---
drivers/hid/i2c-hid/i2c-hid-core.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index 07c2ea057013..aa7c573b35bc 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -98,10 +98,7 @@ struct i2c_hid_desc {
struct i2c_hid {
struct i2c_client *client; /* i2c client */
struct hid_device *hid; /* pointer to corresponding HID dev */
- union {
- __u8 hdesc_buffer[sizeof(struct i2c_hid_desc)];
- struct i2c_hid_desc hdesc; /* the HID Descriptor */
- };
+ struct i2c_hid_desc hdesc; /* the HID Descriptor */
__le16 wHIDDescRegister; /* location of the i2c
* register of the HID
* descriptor. */
@@ -918,7 +915,7 @@ static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
"weird size of HID descriptor (%u)\n", dsize);
return -ENODEV;
}
- i2c_hid_dbg(ihid, "HID Descriptor: %*ph\n", dsize, ihid->hdesc_buffer);
+ i2c_hid_dbg(ihid, "HID Descriptor: %*ph\n", dsize, &ihid->hdesc);
return 0;
}

--
2.34.1.703.g22d0c6ccf7-goog
\
 
 \ /
  Last update: 2022-01-18 08:28    [W:0.141 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site