* [PATCH 00/14] HID: constify fixed up report descriptors
@ 2024-08-28 7:33 Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 01/14] HID: bigbenff: constify fixed up report descriptor Thomas Weißschuh
` (14 more replies)
0 siblings, 15 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
This is based upon hid/for-6.12/constify-rdesc.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (14):
HID: bigbenff: constify fixed up report descriptor
HID: dr: constify fixed up report descriptor
HID: holtek-kbd: constify fixed up report descriptor
HID: keytouch: constify fixed up report descriptor
HID: maltron: constify fixed up report descriptor
HID: xiaomi: constify fixed up report descriptor
HID: vrc2: constify fixed up report descriptor
HID: viewsonic: constify fixed up report descriptor
HID: steelseries: constify fixed up report descriptor
HID: pxrc: constify fixed up report descriptor
HID: sony: constify fixed up report descriptor
HID: waltop: constify fixed up report descriptor
HID: lg: constify fixed up report descriptor
HID: uclogic: constify fixed up report descriptor
drivers/hid/hid-bigbenff.c | 4 ++--
drivers/hid/hid-dr.c | 4 ++--
drivers/hid/hid-holtek-kbd.c | 4 ++--
drivers/hid/hid-keytouch.c | 6 ++----
drivers/hid/hid-lg.c | 31 +++++++++++++++++--------------
drivers/hid/hid-maltron.c | 4 ++--
drivers/hid/hid-pxrc.c | 2 +-
drivers/hid/hid-sony.c | 12 ++++++------
drivers/hid/hid-steelseries.c | 4 ++--
drivers/hid/hid-uclogic-core.c | 2 +-
drivers/hid/hid-uclogic-params.c | 4 ++--
drivers/hid/hid-uclogic-params.h | 10 +++++-----
drivers/hid/hid-uclogic-rdesc.c | 20 ++++++++++----------
drivers/hid/hid-uclogic-rdesc.h | 20 ++++++++++----------
drivers/hid/hid-viewsonic.c | 4 ++--
drivers/hid/hid-vrc2.c | 2 +-
drivers/hid/hid-waltop.c | 28 ++++++++++++++--------------
drivers/hid/hid-xiaomi.c | 4 ++--
18 files changed, 83 insertions(+), 82 deletions(-)
---
base-commit: c1f9eff7b270861005c7ec8146b6ad398c40940b
change-id: 20240803-hid-const-fixup-2-7c60ac529531
prerequisite-change-id: 20240730-hid-const-fixup-8b01cbda1b49:v2
prerequisite-patch-id: 92216ced5d79ee5578fbe1c24c994b6fd550d1fb
prerequisite-patch-id: 4dd3e0fa6b0387f2a722c2bb924fc9c3b784f49d
prerequisite-patch-id: 7a5b42060b989b053d2bc71d52e0281815da542d
prerequisite-patch-id: 15809fd82225c2d44cdbed2d570d621ba7378cec
prerequisite-patch-id: baba272935e0f16c67170413cadb682b535b3a6d
prerequisite-patch-id: 4e6017ca6b8df87fe8270fffd43a585eddba88c7
prerequisite-patch-id: 06023fde4515232fdcc4044b252aa42ed9a47885
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 01/14] HID: bigbenff: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 02/14] HID: dr: " Thomas Weißschuh
` (13 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-bigbenff.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-bigbenff.c b/drivers/hid/hid-bigbenff.c
index a2ff60dd834c..9f05465358d9 100644
--- a/drivers/hid/hid-bigbenff.c
+++ b/drivers/hid/hid-bigbenff.c
@@ -99,7 +99,7 @@
* - map previously unused analog trigger data to Z/RZ
* - simplify feature and output descriptor
*/
-static __u8 pid0902_rdesc_fixed[] = {
+static const __u8 pid0902_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */
0x09, 0x05, /* Usage (Game Pad) */
0xA1, 0x01, /* Collection (Application) */
@@ -468,8 +468,8 @@ static const __u8 *bigben_report_fixup(struct hid_device *hid, __u8 *rdesc,
unsigned int *rsize)
{
if (*rsize == PID0902_RDESC_ORIG_SIZE) {
- rdesc = pid0902_rdesc_fixed;
*rsize = sizeof(pid0902_rdesc_fixed);
+ return pid0902_rdesc_fixed;
} else
hid_warn(hid, "unexpected rdesc, please submit for review\n");
return rdesc;
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 02/14] HID: dr: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 01/14] HID: bigbenff: constify fixed up report descriptor Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 03/14] HID: holtek-kbd: " Thomas Weißschuh
` (12 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-dr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-dr.c b/drivers/hid/hid-dr.c
index b24f9bc743e1..84e1e90a266b 100644
--- a/drivers/hid/hid-dr.c
+++ b/drivers/hid/hid-dr.c
@@ -199,7 +199,7 @@ static inline int drff_init(struct hid_device *hid)
#define PID0011_RDESC_ORIG_SIZE 101
/* Fixed report descriptor for PID 0x011 joystick */
-static __u8 pid0011_rdesc_fixed[] = {
+static const __u8 pid0011_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -234,8 +234,8 @@ static const __u8 *dr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
switch (hdev->product) {
case 0x0011:
if (*rsize == PID0011_RDESC_ORIG_SIZE) {
- rdesc = pid0011_rdesc_fixed;
*rsize = sizeof(pid0011_rdesc_fixed);
+ return pid0011_rdesc_fixed;
}
break;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 03/14] HID: holtek-kbd: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 01/14] HID: bigbenff: constify fixed up report descriptor Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 02/14] HID: dr: " Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 04/14] HID: keytouch: " Thomas Weißschuh
` (11 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-holtek-kbd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-holtek-kbd.c b/drivers/hid/hid-holtek-kbd.c
index 794d609c2e31..d13543517a6c 100644
--- a/drivers/hid/hid-holtek-kbd.c
+++ b/drivers/hid/hid-holtek-kbd.c
@@ -27,7 +27,7 @@
* to the boot interface.
*/
-static __u8 holtek_kbd_rdesc_fixed[] = {
+static const __u8 holtek_kbd_rdesc_fixed[] = {
/* Original report descriptor, with reduced number of consumer usages */
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x80, /* Usage (Sys Control), */
@@ -108,8 +108,8 @@ static const __u8 *holtek_kbd_report_fixup(struct hid_device *hdev, __u8 *rdesc,
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
if (intf->cur_altsetting->desc.bInterfaceNumber == 1) {
- rdesc = holtek_kbd_rdesc_fixed;
*rsize = sizeof(holtek_kbd_rdesc_fixed);
+ return holtek_kbd_rdesc_fixed;
}
return rdesc;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 04/14] HID: keytouch: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
` (2 preceding siblings ...)
2024-08-28 7:33 ` [PATCH 03/14] HID: holtek-kbd: " Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 05/14] HID: maltron: " Thomas Weißschuh
` (10 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-keytouch.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/hid/hid-keytouch.c b/drivers/hid/hid-keytouch.c
index 6e3033bb80dd..b9abd53a5864 100644
--- a/drivers/hid/hid-keytouch.c
+++ b/drivers/hid/hid-keytouch.c
@@ -16,7 +16,7 @@
/* Replace the broken report descriptor of this device with rather
* a default one */
-static __u8 keytouch_fixed_rdesc[] = {
+static const __u8 keytouch_fixed_rdesc[] = {
0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15,
0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08,
0x81, 0x01, 0x95, 0x03, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91,
@@ -29,10 +29,8 @@ static const __u8 *keytouch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
{
hid_info(hdev, "fixing up Keytouch IEC report descriptor\n");
- rdesc = keytouch_fixed_rdesc;
*rsize = sizeof(keytouch_fixed_rdesc);
-
- return rdesc;
+ return keytouch_fixed_rdesc;
}
static const struct hid_device_id keytouch_devices[] = {
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 05/14] HID: maltron: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
` (3 preceding siblings ...)
2024-08-28 7:33 ` [PATCH 04/14] HID: keytouch: " Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 06/14] HID: xiaomi: " Thomas Weißschuh
` (9 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-maltron.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-maltron.c b/drivers/hid/hid-maltron.c
index 374c64dd82c2..f0aad1ba2e6d 100644
--- a/drivers/hid/hid-maltron.c
+++ b/drivers/hid/hid-maltron.c
@@ -22,7 +22,7 @@
#include "hid-ids.h"
/* The original buggy USB descriptor */
-static u8 maltron_rdesc_o[] = {
+static const u8 maltron_rdesc_o[] = {
0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */
0x09, 0x80, /* Usage (Sys Control) */
0xA1, 0x01, /* Collection (Application) */
@@ -79,7 +79,7 @@ static u8 maltron_rdesc_o[] = {
};
/* The patched descriptor, allowing media key events to be accepted as valid */
-static u8 maltron_rdesc[] = {
+static const u8 maltron_rdesc[] = {
0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */
0x09, 0x80, /* Usage (Sys Control) */
0xA1, 0x01, /* Collection (Application) */
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 06/14] HID: xiaomi: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
` (4 preceding siblings ...)
2024-08-28 7:33 ` [PATCH 05/14] HID: maltron: " Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 07/14] HID: vrc2: " Thomas Weißschuh
` (8 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-xiaomi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-xiaomi.c b/drivers/hid/hid-xiaomi.c
index 035733fce2e1..ef6598550a40 100644
--- a/drivers/hid/hid-xiaomi.c
+++ b/drivers/hid/hid-xiaomi.c
@@ -14,7 +14,7 @@
/* Fixed Mi Silent Mouse report descriptor */
/* Button's Usage Maximum changed from 3 to 5 to make side buttons work */
#define MI_SILENT_MOUSE_ORIG_RDESC_LENGTH 87
-static __u8 mi_silent_mouse_rdesc_fixed[] = {
+static const __u8 mi_silent_mouse_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x02, /* Usage (Mouse), */
0xA1, 0x01, /* Collection (Application), */
@@ -68,8 +68,8 @@ static const __u8 *xiaomi_report_fixup(struct hid_device *hdev, __u8 *rdesc,
case USB_DEVICE_ID_MI_SILENT_MOUSE:
if (*rsize == MI_SILENT_MOUSE_ORIG_RDESC_LENGTH) {
hid_info(hdev, "fixing up Mi Silent Mouse report descriptor\n");
- rdesc = mi_silent_mouse_rdesc_fixed;
*rsize = sizeof(mi_silent_mouse_rdesc_fixed);
+ return mi_silent_mouse_rdesc_fixed;
}
break;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 07/14] HID: vrc2: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
` (5 preceding siblings ...)
2024-08-28 7:33 ` [PATCH 06/14] HID: xiaomi: " Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-09-18 9:17 ` Marcus Folkesson
2024-08-28 7:33 ` [PATCH 08/14] HID: viewsonic: " Thomas Weißschuh
` (7 subsequent siblings)
14 siblings, 1 reply; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-vrc2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-vrc2.c b/drivers/hid/hid-vrc2.c
index 9a4840b524ba..7dc41e92f488 100644
--- a/drivers/hid/hid-vrc2.c
+++ b/drivers/hid/hid-vrc2.c
@@ -16,7 +16,7 @@
#define USB_VENDOR_ID_VRC2 (0x07c0)
#define USB_DEVICE_ID_VRC2 (0x1125)
-static __u8 vrc2_rdesc_fixed[] = {
+static const __u8 vrc2_rdesc_fixed[] = {
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x09, 0x04, // Usage (Joystick)
0xA1, 0x01, // Collection (Application)
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 08/14] HID: viewsonic: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
` (6 preceding siblings ...)
2024-08-28 7:33 ` [PATCH 07/14] HID: vrc2: " Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 09/14] HID: steelseries: " Thomas Weißschuh
` (6 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-viewsonic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-viewsonic.c b/drivers/hid/hid-viewsonic.c
index 86f41e3fcb95..532bed88bdf8 100644
--- a/drivers/hid/hid-viewsonic.c
+++ b/drivers/hid/hid-viewsonic.c
@@ -22,7 +22,7 @@
#define PD1011_RDESC_ORIG_SIZE 408
/* Fixed report descriptor of PD1011 signature pad */
-static __u8 pd1011_rdesc_fixed[] = {
+static const __u8 pd1011_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -77,8 +77,8 @@ static const __u8 *viewsonic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
case USB_DEVICE_ID_VIEWSONIC_PD1011:
case USB_DEVICE_ID_SIGNOTEC_VIEWSONIC_PD1011:
if (*rsize == PD1011_RDESC_ORIG_SIZE) {
- rdesc = pd1011_rdesc_fixed;
*rsize = sizeof(pd1011_rdesc_fixed);
+ return pd1011_rdesc_fixed;
}
break;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 09/14] HID: steelseries: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
` (7 preceding siblings ...)
2024-08-28 7:33 ` [PATCH 08/14] HID: viewsonic: " Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 10/14] HID: pxrc: " Thomas Weißschuh
` (5 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-steelseries.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
index 895da49e8ead..7e83fee1ffa0 100644
--- a/drivers/hid/hid-steelseries.c
+++ b/drivers/hid/hid-steelseries.c
@@ -51,7 +51,7 @@ struct steelseries_srws1_data {
* appear in the 'Generic Desktop' usage.
*/
-static __u8 steelseries_srws1_rdesc_fixed[] = {
+static const __u8 steelseries_srws1_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop) */
0x09, 0x08, /* Usage (MultiAxis), Changed */
0xA1, 0x01, /* Collection (Application), */
@@ -580,8 +580,8 @@ static const __u8 *steelseries_srws1_report_fixup(struct hid_device *hdev,
if (*rsize >= 115 && rdesc[11] == 0x02 && rdesc[13] == 0xc8
&& rdesc[29] == 0xbb && rdesc[40] == 0xc5) {
hid_info(hdev, "Fixing up Steelseries SRW-S1 report descriptor\n");
- rdesc = steelseries_srws1_rdesc_fixed;
*rsize = sizeof(steelseries_srws1_rdesc_fixed);
+ return steelseries_srws1_rdesc_fixed;
}
return rdesc;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 10/14] HID: pxrc: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
` (8 preceding siblings ...)
2024-08-28 7:33 ` [PATCH 09/14] HID: steelseries: " Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 11/14] HID: sony: " Thomas Weißschuh
` (4 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-pxrc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-pxrc.c b/drivers/hid/hid-pxrc.c
index ef38730e78ab..71fe0c06ddcd 100644
--- a/drivers/hid/hid-pxrc.c
+++ b/drivers/hid/hid-pxrc.c
@@ -17,7 +17,7 @@ struct pxrc_priv {
bool alternate;
};
-static __u8 pxrc_rdesc_fixed[] = {
+static const __u8 pxrc_rdesc_fixed[] = {
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x09, 0x04, // Usage (Joystick)
0xA1, 0x01, // Collection (Application)
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 11/14] HID: sony: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
` (9 preceding siblings ...)
2024-08-28 7:33 ` [PATCH 10/14] HID: pxrc: " Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 12/14] HID: waltop: " Thomas Weißschuh
` (3 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-sony.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 8e2e914bd236..df29c614e490 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -99,7 +99,7 @@ static const char ghl_ps4_magic_data[] = {
};
/* PS/3 Motion controller */
-static u8 motion_rdesc[] = {
+static const u8 motion_rdesc[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -195,7 +195,7 @@ static u8 motion_rdesc[] = {
0xC0 /* End Collection */
};
-static u8 ps3remote_rdesc[] = {
+static const u8 ps3remote_rdesc[] = {
0x05, 0x01, /* GUsagePage Generic Desktop */
0x09, 0x05, /* LUsage 0x05 [Game Pad] */
0xA1, 0x01, /* MCollection Application (mouse, keyboard) */
@@ -599,15 +599,15 @@ static int guitar_mapping(struct hid_device *hdev, struct hid_input *hi,
return 0;
}
-static u8 *motion_fixup(struct hid_device *hdev, u8 *rdesc,
- unsigned int *rsize)
+static const u8 *motion_fixup(struct hid_device *hdev, u8 *rdesc,
+ unsigned int *rsize)
{
*rsize = sizeof(motion_rdesc);
return motion_rdesc;
}
-static u8 *ps3remote_fixup(struct hid_device *hdev, u8 *rdesc,
- unsigned int *rsize)
+static const u8 *ps3remote_fixup(struct hid_device *hdev, u8 *rdesc,
+ unsigned int *rsize)
{
*rsize = sizeof(ps3remote_rdesc);
return ps3remote_rdesc;
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 12/14] HID: waltop: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
` (10 preceding siblings ...)
2024-08-28 7:33 ` [PATCH 11/14] HID: sony: " Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 13/14] HID: lg: " Thomas Weißschuh
` (2 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-waltop.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/hid/hid-waltop.c b/drivers/hid/hid-waltop.c
index 137a682ef5fb..be34be27d4d5 100644
--- a/drivers/hid/hid-waltop.c
+++ b/drivers/hid/hid-waltop.c
@@ -43,7 +43,7 @@
#define SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE 222
/* Fixed Slim Tablet 5.8 inch descriptor */
-static __u8 slim_tablet_5_8_inch_rdesc_fixed[] = {
+static const __u8 slim_tablet_5_8_inch_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -94,7 +94,7 @@ static __u8 slim_tablet_5_8_inch_rdesc_fixed[] = {
#define SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE 269
/* Fixed Slim Tablet 12.1 inch descriptor */
-static __u8 slim_tablet_12_1_inch_rdesc_fixed[] = {
+static const __u8 slim_tablet_12_1_inch_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -145,7 +145,7 @@ static __u8 slim_tablet_12_1_inch_rdesc_fixed[] = {
#define Q_PAD_RDESC_ORIG_SIZE 241
/* Fixed Q Pad descriptor */
-static __u8 q_pad_rdesc_fixed[] = {
+static const __u8 q_pad_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -198,7 +198,7 @@ static __u8 q_pad_rdesc_fixed[] = {
/*
* Fixed report descriptor for tablet with PID 0038.
*/
-static __u8 pid_0038_rdesc_fixed[] = {
+static const __u8 pid_0038_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -249,7 +249,7 @@ static __u8 pid_0038_rdesc_fixed[] = {
#define MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE 300
/* Fixed Media Tablet 10.6 inch descriptor */
-static __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
+static const __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -362,7 +362,7 @@ static __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
#define MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE 309
/* Fixed Media Tablet 14.1 inch descriptor */
-static __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
+static const __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -473,7 +473,7 @@ static __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
#define SIRIUS_BATTERY_FREE_TABLET_RDESC_ORIG_SIZE 335
/* Fixed Sirius Battery Free Tablet descriptor */
-static __u8 sirius_battery_free_tablet_rdesc_fixed[] = {
+static const __u8 sirius_battery_free_tablet_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -605,44 +605,44 @@ static const __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc,
switch (hdev->product) {
case USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH:
if (*rsize == SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE) {
- rdesc = slim_tablet_5_8_inch_rdesc_fixed;
*rsize = sizeof(slim_tablet_5_8_inch_rdesc_fixed);
+ return slim_tablet_5_8_inch_rdesc_fixed;
}
break;
case USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH:
if (*rsize == SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE) {
- rdesc = slim_tablet_12_1_inch_rdesc_fixed;
*rsize = sizeof(slim_tablet_12_1_inch_rdesc_fixed);
+ return slim_tablet_12_1_inch_rdesc_fixed;
}
break;
case USB_DEVICE_ID_WALTOP_Q_PAD:
if (*rsize == Q_PAD_RDESC_ORIG_SIZE) {
- rdesc = q_pad_rdesc_fixed;
*rsize = sizeof(q_pad_rdesc_fixed);
+ return q_pad_rdesc_fixed;
}
break;
case USB_DEVICE_ID_WALTOP_PID_0038:
if (*rsize == PID_0038_RDESC_ORIG_SIZE) {
- rdesc = pid_0038_rdesc_fixed;
*rsize = sizeof(pid_0038_rdesc_fixed);
+ return pid_0038_rdesc_fixed;
}
break;
case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH:
if (*rsize == MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE) {
- rdesc = media_tablet_10_6_inch_rdesc_fixed;
*rsize = sizeof(media_tablet_10_6_inch_rdesc_fixed);
+ return media_tablet_10_6_inch_rdesc_fixed;
}
break;
case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH:
if (*rsize == MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE) {
- rdesc = media_tablet_14_1_inch_rdesc_fixed;
*rsize = sizeof(media_tablet_14_1_inch_rdesc_fixed);
+ return media_tablet_14_1_inch_rdesc_fixed;
}
break;
case USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET:
if (*rsize == SIRIUS_BATTERY_FREE_TABLET_RDESC_ORIG_SIZE) {
- rdesc = sirius_battery_free_tablet_rdesc_fixed;
*rsize = sizeof(sirius_battery_free_tablet_rdesc_fixed);
+ return sirius_battery_free_tablet_rdesc_fixed;
}
break;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 13/14] HID: lg: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
` (11 preceding siblings ...)
2024-08-28 7:33 ` [PATCH 12/14] HID: waltop: " Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-09-05 14:51 ` Benjamin Tissoires
2024-08-28 7:33 ` [PATCH 14/14] HID: uclogic: " Thomas Weißschuh
2024-09-05 14:49 ` (subset) [PATCH 00/14] HID: constify fixed up report descriptors Benjamin Tissoires
14 siblings, 1 reply; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-lg.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index a9be918e2b5c..c1feeb1dd077 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -58,7 +58,7 @@
* These descriptors remove the combined Y axis and instead report
* separate throttle (Y) and brake (RZ).
*/
-static __u8 df_rdesc_fixed[] = {
+static const __u8 df_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -124,7 +124,7 @@ static __u8 df_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-static __u8 dfp_rdesc_fixed[] = {
+static const __u8 dfp_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -172,7 +172,7 @@ static __u8 dfp_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-static __u8 fv_rdesc_fixed[] = {
+static const __u8 fv_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -239,7 +239,7 @@ static __u8 fv_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-static __u8 momo_rdesc_fixed[] = {
+static const __u8 momo_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -285,7 +285,7 @@ static __u8 momo_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-static __u8 momo2_rdesc_fixed[] = {
+static const __u8 momo2_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -333,7 +333,7 @@ static __u8 momo2_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-static __u8 ffg_rdesc_fixed[] = {
+static const __u8 ffg_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystik), */
0xA1, 0x01, /* Collection (Application), */
@@ -379,7 +379,7 @@ static __u8 ffg_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-static __u8 fg_rdesc_fixed[] = {
+static const __u8 fg_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystik), */
0xA1, 0x01, /* Collection (Application), */
@@ -431,6 +431,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize)
{
struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
+ const __u8 *ret = NULL;
if ((drv_data->quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 &&
rdesc[84] == 0x8c && rdesc[85] == 0x02) {
@@ -453,7 +454,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == FG_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Wingman Formula GP report descriptor\n");
- rdesc = fg_rdesc_fixed;
+ ret = fg_rdesc_fixed;
*rsize = sizeof(fg_rdesc_fixed);
} else {
hid_info(hdev,
@@ -466,7 +467,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == FFG_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Wingman Formula Force GP report descriptor\n");
- rdesc = ffg_rdesc_fixed;
+ ret = ffg_rdesc_fixed;
*rsize = sizeof(ffg_rdesc_fixed);
}
break;
@@ -476,7 +477,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == DF_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Driving Force report descriptor\n");
- rdesc = df_rdesc_fixed;
+ ret = df_rdesc_fixed;
*rsize = sizeof(df_rdesc_fixed);
}
break;
@@ -485,7 +486,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == MOMO_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Momo Force (Red) report descriptor\n");
- rdesc = momo_rdesc_fixed;
+ ret = momo_rdesc_fixed;
*rsize = sizeof(momo_rdesc_fixed);
}
break;
@@ -494,7 +495,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == MOMO2_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Momo Racing Force (Black) report descriptor\n");
- rdesc = momo2_rdesc_fixed;
+ ret = momo2_rdesc_fixed;
*rsize = sizeof(momo2_rdesc_fixed);
}
break;
@@ -503,7 +504,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == FV_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Formula Vibration report descriptor\n");
- rdesc = fv_rdesc_fixed;
+ ret = fv_rdesc_fixed;
*rsize = sizeof(fv_rdesc_fixed);
}
break;
@@ -512,7 +513,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == DFP_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Driving Force Pro report descriptor\n");
- rdesc = dfp_rdesc_fixed;
+ ret = dfp_rdesc_fixed;
*rsize = sizeof(dfp_rdesc_fixed);
}
break;
@@ -529,6 +530,8 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
break;
}
+ if (ret)
+ return ret;
return rdesc;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 14/14] HID: uclogic: constify fixed up report descriptor
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
` (12 preceding siblings ...)
2024-08-28 7:33 ` [PATCH 13/14] HID: lg: " Thomas Weißschuh
@ 2024-08-28 7:33 ` Thomas Weißschuh
2024-09-05 14:49 ` (subset) [PATCH 00/14] HID: constify fixed up report descriptors Benjamin Tissoires
14 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-uclogic-core.c | 2 +-
drivers/hid/hid-uclogic-params.c | 4 ++--
drivers/hid/hid-uclogic-params.h | 10 +++++-----
drivers/hid/hid-uclogic-rdesc.c | 20 ++++++++++----------
drivers/hid/hid-uclogic-rdesc.h | 20 ++++++++++----------
5 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
index f6a1572b3728..d8008933c052 100644
--- a/drivers/hid/hid-uclogic-core.c
+++ b/drivers/hid/hid-uclogic-core.c
@@ -56,8 +56,8 @@ static const __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
if (drvdata->desc_ptr != NULL) {
- rdesc = drvdata->desc_ptr;
*rsize = drvdata->desc_size;
+ return drvdata->desc_ptr;
}
return rdesc;
}
diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c
index 5bab006ec165..87fd4eb76c70 100644
--- a/drivers/hid/hid-uclogic-params.c
+++ b/drivers/hid/hid-uclogic-params.c
@@ -681,7 +681,7 @@ void uclogic_params_cleanup(struct uclogic_params *params)
* -ENOMEM, if failed to allocate memory.
*/
int uclogic_params_get_desc(const struct uclogic_params *params,
- __u8 **pdesc,
+ const __u8 **pdesc,
unsigned int *psize)
{
int rc = -ENOMEM;
@@ -769,7 +769,7 @@ static void uclogic_params_init_invalid(struct uclogic_params *params)
static int uclogic_params_init_with_opt_desc(struct uclogic_params *params,
struct hid_device *hdev,
unsigned int orig_desc_size,
- __u8 *desc_ptr,
+ const __u8 *desc_ptr,
unsigned int desc_size)
{
__u8 *desc_copy_ptr = NULL;
diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h
index d6ffadb2f601..35ff062d09b5 100644
--- a/drivers/hid/hid-uclogic-params.h
+++ b/drivers/hid/hid-uclogic-params.h
@@ -79,7 +79,7 @@ struct uclogic_params_pen {
* Pointer to report descriptor part describing the pen inputs.
* Allocated with kmalloc. NULL if the part is not specified.
*/
- __u8 *desc_ptr;
+ const __u8 *desc_ptr;
/*
* Size of the report descriptor.
* Only valid, if "desc_ptr" is not NULL.
@@ -118,7 +118,7 @@ struct uclogic_params_frame {
* Pointer to report descriptor part describing the frame inputs.
* Allocated with kmalloc. NULL if the part is not specified.
*/
- __u8 *desc_ptr;
+ const __u8 *desc_ptr;
/*
* Size of the report descriptor.
* Only valid, if "desc_ptr" is not NULL.
@@ -212,7 +212,7 @@ struct uclogic_params {
* allocated with kmalloc. NULL if no common part is needed.
* Only valid, if "invalid" is false.
*/
- __u8 *desc_ptr;
+ const __u8 *desc_ptr;
/*
* Size of the common part of the replacement report descriptor.
* Only valid, if "desc_ptr" is valid and not NULL.
@@ -239,7 +239,7 @@ struct uclogic_drvdata {
/* Interface parameters */
struct uclogic_params params;
/* Pointer to the replacement report descriptor. NULL if none. */
- __u8 *desc_ptr;
+ const __u8 *desc_ptr;
/*
* Size of the replacement report descriptor.
* Only valid if desc_ptr is not NULL
@@ -261,7 +261,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
/* Get a replacement report descriptor for a tablet's interface. */
extern int uclogic_params_get_desc(const struct uclogic_params *params,
- __u8 **pdesc,
+ const __u8 **pdesc,
unsigned int *psize);
/* Free resources used by tablet interface's parameters */
diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c
index acfa591ab52f..964d17e08f26 100644
--- a/drivers/hid/hid-uclogic-rdesc.c
+++ b/drivers/hid/hid-uclogic-rdesc.c
@@ -20,7 +20,7 @@
#include <kunit/visibility.h>
/* Fixed WP4030U report descriptor */
-__u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
+const __u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -65,7 +65,7 @@ const size_t uclogic_rdesc_wp4030u_fixed_size =
sizeof(uclogic_rdesc_wp4030u_fixed_arr);
/* Fixed WP5540U report descriptor */
-__u8 uclogic_rdesc_wp5540u_fixed_arr[] = {
+const __u8 uclogic_rdesc_wp5540u_fixed_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -142,7 +142,7 @@ const size_t uclogic_rdesc_wp5540u_fixed_size =
sizeof(uclogic_rdesc_wp5540u_fixed_arr);
/* Fixed WP8060U report descriptor */
-__u8 uclogic_rdesc_wp8060u_fixed_arr[] = {
+const __u8 uclogic_rdesc_wp8060u_fixed_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -219,7 +219,7 @@ const size_t uclogic_rdesc_wp8060u_fixed_size =
sizeof(uclogic_rdesc_wp8060u_fixed_arr);
/* Fixed WP1062 report descriptor */
-__u8 uclogic_rdesc_wp1062_fixed_arr[] = {
+const __u8 uclogic_rdesc_wp1062_fixed_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -267,7 +267,7 @@ const size_t uclogic_rdesc_wp1062_fixed_size =
sizeof(uclogic_rdesc_wp1062_fixed_arr);
/* Fixed PF1209 report descriptor */
-__u8 uclogic_rdesc_pf1209_fixed_arr[] = {
+const __u8 uclogic_rdesc_pf1209_fixed_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -344,7 +344,7 @@ const size_t uclogic_rdesc_pf1209_fixed_size =
sizeof(uclogic_rdesc_pf1209_fixed_arr);
/* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
-__u8 uclogic_rdesc_twhl850_fixed0_arr[] = {
+const __u8 uclogic_rdesc_twhl850_fixed0_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -390,7 +390,7 @@ const size_t uclogic_rdesc_twhl850_fixed0_size =
sizeof(uclogic_rdesc_twhl850_fixed0_arr);
/* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
-__u8 uclogic_rdesc_twhl850_fixed1_arr[] = {
+const __u8 uclogic_rdesc_twhl850_fixed1_arr[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x02, /* Usage (Mouse), */
0xA1, 0x01, /* Collection (Application), */
@@ -430,7 +430,7 @@ const size_t uclogic_rdesc_twhl850_fixed1_size =
sizeof(uclogic_rdesc_twhl850_fixed1_arr);
/* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
-__u8 uclogic_rdesc_twhl850_fixed2_arr[] = {
+const __u8 uclogic_rdesc_twhl850_fixed2_arr[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x06, /* Usage (Keyboard), */
0xA1, 0x01, /* Collection (Application), */
@@ -456,7 +456,7 @@ const size_t uclogic_rdesc_twhl850_fixed2_size =
sizeof(uclogic_rdesc_twhl850_fixed2_arr);
/* Fixed TWHA60 report descriptor, interface 0 (stylus) */
-__u8 uclogic_rdesc_twha60_fixed0_arr[] = {
+const __u8 uclogic_rdesc_twha60_fixed0_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -505,7 +505,7 @@ const size_t uclogic_rdesc_twha60_fixed0_size =
sizeof(uclogic_rdesc_twha60_fixed0_arr);
/* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
-__u8 uclogic_rdesc_twha60_fixed1_arr[] = {
+const __u8 uclogic_rdesc_twha60_fixed1_arr[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x06, /* Usage (Keyboard), */
0xA1, 0x01, /* Collection (Application), */
diff --git a/drivers/hid/hid-uclogic-rdesc.h b/drivers/hid/hid-uclogic-rdesc.h
index 906d068f50a9..3878a0e8c464 100644
--- a/drivers/hid/hid-uclogic-rdesc.h
+++ b/drivers/hid/hid-uclogic-rdesc.h
@@ -23,15 +23,15 @@
#define UCLOGIC_RDESC_WPXXXXU_ORIG_SIZE 212
/* Fixed WP4030U report descriptor */
-extern __u8 uclogic_rdesc_wp4030u_fixed_arr[];
+extern const __u8 uclogic_rdesc_wp4030u_fixed_arr[];
extern const size_t uclogic_rdesc_wp4030u_fixed_size;
/* Fixed WP5540U report descriptor */
-extern __u8 uclogic_rdesc_wp5540u_fixed_arr[];
+extern const __u8 uclogic_rdesc_wp5540u_fixed_arr[];
extern const size_t uclogic_rdesc_wp5540u_fixed_size;
/* Fixed WP8060U report descriptor */
-extern __u8 uclogic_rdesc_wp8060u_fixed_arr[];
+extern const __u8 uclogic_rdesc_wp8060u_fixed_arr[];
extern const size_t uclogic_rdesc_wp8060u_fixed_size;
/* Size of the original descriptor of the new WP5540U tablet */
@@ -41,14 +41,14 @@ extern const size_t uclogic_rdesc_wp8060u_fixed_size;
#define UCLOGIC_RDESC_WP1062_ORIG_SIZE 254
/* Fixed WP1062 report descriptor */
-extern __u8 uclogic_rdesc_wp1062_fixed_arr[];
+extern const __u8 uclogic_rdesc_wp1062_fixed_arr[];
extern const size_t uclogic_rdesc_wp1062_fixed_size;
/* Size of the original descriptor of PF1209 tablet */
#define UCLOGIC_RDESC_PF1209_ORIG_SIZE 234
/* Fixed PF1209 report descriptor */
-extern __u8 uclogic_rdesc_pf1209_fixed_arr[];
+extern const __u8 uclogic_rdesc_pf1209_fixed_arr[];
extern const size_t uclogic_rdesc_pf1209_fixed_size;
/* Size of the original descriptors of TWHL850 tablet */
@@ -57,15 +57,15 @@ extern const size_t uclogic_rdesc_pf1209_fixed_size;
#define UCLOGIC_RDESC_TWHL850_ORIG2_SIZE 92
/* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
-extern __u8 uclogic_rdesc_twhl850_fixed0_arr[];
+extern const __u8 uclogic_rdesc_twhl850_fixed0_arr[];
extern const size_t uclogic_rdesc_twhl850_fixed0_size;
/* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
-extern __u8 uclogic_rdesc_twhl850_fixed1_arr[];
+extern const __u8 uclogic_rdesc_twhl850_fixed1_arr[];
extern const size_t uclogic_rdesc_twhl850_fixed1_size;
/* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
-extern __u8 uclogic_rdesc_twhl850_fixed2_arr[];
+extern const __u8 uclogic_rdesc_twhl850_fixed2_arr[];
extern const size_t uclogic_rdesc_twhl850_fixed2_size;
/* Size of the original descriptors of TWHA60 tablet */
@@ -73,11 +73,11 @@ extern const size_t uclogic_rdesc_twhl850_fixed2_size;
#define UCLOGIC_RDESC_TWHA60_ORIG1_SIZE 139
/* Fixed TWHA60 report descriptor, interface 0 (stylus) */
-extern __u8 uclogic_rdesc_twha60_fixed0_arr[];
+extern const __u8 uclogic_rdesc_twha60_fixed0_arr[];
extern const size_t uclogic_rdesc_twha60_fixed0_size;
/* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
-extern __u8 uclogic_rdesc_twha60_fixed1_arr[];
+extern const __u8 uclogic_rdesc_twha60_fixed1_arr[];
extern const size_t uclogic_rdesc_twha60_fixed1_size;
/* Report descriptor template placeholder head */
--
2.46.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: (subset) [PATCH 00/14] HID: constify fixed up report descriptors
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
` (13 preceding siblings ...)
2024-08-28 7:33 ` [PATCH 14/14] HID: uclogic: " Thomas Weißschuh
@ 2024-09-05 14:49 ` Benjamin Tissoires
14 siblings, 0 replies; 19+ messages in thread
From: Benjamin Tissoires @ 2024-09-05 14:49 UTC (permalink / raw)
To: Jiri Kosina, Marcus Folkesson, Thomas Weißschuh
Cc: linux-input, linux-kernel
On Wed, 28 Aug 2024 09:33:19 +0200, Thomas Weißschuh wrote:
> Now that the HID core can handle const report descriptors,
> constify them where possible.
>
> This is based upon hid/for-6.12/constify-rdesc.
>
>
Applied to hid/hid.git (for-6.12/constify-rdesc), thanks!
[01/14] HID: bigbenff: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/00f6f65bd116
[02/14] HID: dr: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/49e00b5ca0bb
[03/14] HID: holtek-kbd: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/3ce7edfa4f09
[04/14] HID: keytouch: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/b299944af770
[05/14] HID: maltron: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/d8b21af66601
[06/14] HID: xiaomi: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/c06df4c57af8
[07/14] HID: vrc2: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/49cf20b878fa
[08/14] HID: viewsonic: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/4f3ff3a275f9
[09/14] HID: steelseries: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/88ae9ffc7c85
[10/14] HID: pxrc: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/4211f9b11216
[11/14] HID: sony: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/d4781a27add1
[12/14] HID: waltop: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/24b3c515c69b
[14/14] HID: uclogic: constify fixed up report descriptor
https://git.kernel.org/hid/hid/c/03f8dc1d0a38
Cheers,
--
Benjamin Tissoires <bentiss@kernel.org>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 13/14] HID: lg: constify fixed up report descriptor
2024-08-28 7:33 ` [PATCH 13/14] HID: lg: " Thomas Weißschuh
@ 2024-09-05 14:51 ` Benjamin Tissoires
2024-09-05 14:59 ` Thomas Weißschuh
0 siblings, 1 reply; 19+ messages in thread
From: Benjamin Tissoires @ 2024-09-05 14:51 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Jiri Kosina, Marcus Folkesson, linux-input, linux-kernel
As you can see in the b4 reply, I've now applied all of the patches but
this one. Please see below.
On Aug 28 2024, Thomas Weißschuh wrote:
> Now that the HID core can handle const report descriptors,
> constify them where possible.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> drivers/hid/hid-lg.c | 31 +++++++++++++++++--------------
> 1 file changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
> index a9be918e2b5c..c1feeb1dd077 100644
> --- a/drivers/hid/hid-lg.c
> +++ b/drivers/hid/hid-lg.c
> @@ -58,7 +58,7 @@
> * These descriptors remove the combined Y axis and instead report
> * separate throttle (Y) and brake (RZ).
> */
> -static __u8 df_rdesc_fixed[] = {
> +static const __u8 df_rdesc_fixed[] = {
> 0x05, 0x01, /* Usage Page (Desktop), */
> 0x09, 0x04, /* Usage (Joystick), */
> 0xA1, 0x01, /* Collection (Application), */
> @@ -124,7 +124,7 @@ static __u8 df_rdesc_fixed[] = {
> 0xC0 /* End Collection */
> };
>
> -static __u8 dfp_rdesc_fixed[] = {
> +static const __u8 dfp_rdesc_fixed[] = {
> 0x05, 0x01, /* Usage Page (Desktop), */
> 0x09, 0x04, /* Usage (Joystick), */
> 0xA1, 0x01, /* Collection (Application), */
> @@ -172,7 +172,7 @@ static __u8 dfp_rdesc_fixed[] = {
> 0xC0 /* End Collection */
> };
>
> -static __u8 fv_rdesc_fixed[] = {
> +static const __u8 fv_rdesc_fixed[] = {
> 0x05, 0x01, /* Usage Page (Desktop), */
> 0x09, 0x04, /* Usage (Joystick), */
> 0xA1, 0x01, /* Collection (Application), */
> @@ -239,7 +239,7 @@ static __u8 fv_rdesc_fixed[] = {
> 0xC0 /* End Collection */
> };
>
> -static __u8 momo_rdesc_fixed[] = {
> +static const __u8 momo_rdesc_fixed[] = {
> 0x05, 0x01, /* Usage Page (Desktop), */
> 0x09, 0x04, /* Usage (Joystick), */
> 0xA1, 0x01, /* Collection (Application), */
> @@ -285,7 +285,7 @@ static __u8 momo_rdesc_fixed[] = {
> 0xC0 /* End Collection */
> };
>
> -static __u8 momo2_rdesc_fixed[] = {
> +static const __u8 momo2_rdesc_fixed[] = {
> 0x05, 0x01, /* Usage Page (Desktop), */
> 0x09, 0x04, /* Usage (Joystick), */
> 0xA1, 0x01, /* Collection (Application), */
> @@ -333,7 +333,7 @@ static __u8 momo2_rdesc_fixed[] = {
> 0xC0 /* End Collection */
> };
>
> -static __u8 ffg_rdesc_fixed[] = {
> +static const __u8 ffg_rdesc_fixed[] = {
> 0x05, 0x01, /* Usage Page (Desktop), */
> 0x09, 0x04, /* Usage (Joystik), */
> 0xA1, 0x01, /* Collection (Application), */
> @@ -379,7 +379,7 @@ static __u8 ffg_rdesc_fixed[] = {
> 0xC0 /* End Collection */
> };
>
> -static __u8 fg_rdesc_fixed[] = {
> +static const __u8 fg_rdesc_fixed[] = {
> 0x05, 0x01, /* Usage Page (Desktop), */
> 0x09, 0x04, /* Usage (Joystik), */
> 0xA1, 0x01, /* Collection (Application), */
> @@ -431,6 +431,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> unsigned int *rsize)
> {
> struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
> + const __u8 *ret = NULL;
Not really happy about this, usually "ret" is an int, and this makes
things slightly harder to read.
>
> if ((drv_data->quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 &&
> rdesc[84] == 0x8c && rdesc[85] == 0x02) {
> @@ -453,7 +454,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> if (*rsize == FG_RDESC_ORIG_SIZE) {
> hid_info(hdev,
> "fixing up Logitech Wingman Formula GP report descriptor\n");
> - rdesc = fg_rdesc_fixed;
> + ret = fg_rdesc_fixed;
can't you just return fg_rdesc_fixed after setting *rsize, like you did
in the other patches?
(same for all of the other branches)
> *rsize = sizeof(fg_rdesc_fixed);
> } else {
> hid_info(hdev,
> @@ -466,7 +467,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> if (*rsize == FFG_RDESC_ORIG_SIZE) {
> hid_info(hdev,
> "fixing up Logitech Wingman Formula Force GP report descriptor\n");
> - rdesc = ffg_rdesc_fixed;
> + ret = ffg_rdesc_fixed;
> *rsize = sizeof(ffg_rdesc_fixed);
> }
> break;
> @@ -476,7 +477,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> if (*rsize == DF_RDESC_ORIG_SIZE) {
> hid_info(hdev,
> "fixing up Logitech Driving Force report descriptor\n");
> - rdesc = df_rdesc_fixed;
> + ret = df_rdesc_fixed;
> *rsize = sizeof(df_rdesc_fixed);
> }
> break;
> @@ -485,7 +486,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> if (*rsize == MOMO_RDESC_ORIG_SIZE) {
> hid_info(hdev,
> "fixing up Logitech Momo Force (Red) report descriptor\n");
> - rdesc = momo_rdesc_fixed;
> + ret = momo_rdesc_fixed;
> *rsize = sizeof(momo_rdesc_fixed);
> }
> break;
> @@ -494,7 +495,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> if (*rsize == MOMO2_RDESC_ORIG_SIZE) {
> hid_info(hdev,
> "fixing up Logitech Momo Racing Force (Black) report descriptor\n");
> - rdesc = momo2_rdesc_fixed;
> + ret = momo2_rdesc_fixed;
> *rsize = sizeof(momo2_rdesc_fixed);
> }
> break;
> @@ -503,7 +504,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> if (*rsize == FV_RDESC_ORIG_SIZE) {
> hid_info(hdev,
> "fixing up Logitech Formula Vibration report descriptor\n");
> - rdesc = fv_rdesc_fixed;
> + ret = fv_rdesc_fixed;
> *rsize = sizeof(fv_rdesc_fixed);
> }
> break;
> @@ -512,7 +513,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> if (*rsize == DFP_RDESC_ORIG_SIZE) {
> hid_info(hdev,
> "fixing up Logitech Driving Force Pro report descriptor\n");
> - rdesc = dfp_rdesc_fixed;
> + ret = dfp_rdesc_fixed;
> *rsize = sizeof(dfp_rdesc_fixed);
> }
> break;
> @@ -529,6 +530,8 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> break;
> }
>
> + if (ret)
> + return ret;
> return rdesc;
> }
>
>
> --
> 2.46.0
>
Cheers,
Benjamin
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 13/14] HID: lg: constify fixed up report descriptor
2024-09-05 14:51 ` Benjamin Tissoires
@ 2024-09-05 14:59 ` Thomas Weißschuh
0 siblings, 0 replies; 19+ messages in thread
From: Thomas Weißschuh @ 2024-09-05 14:59 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Jiri Kosina, Marcus Folkesson, linux-input, linux-kernel
On 2024-09-05 16:51:48+0000, Benjamin Tissoires wrote:
> As you can see in the b4 reply, I've now applied all of the patches but
> this one. Please see below.
Thanks!
> On Aug 28 2024, Thomas Weißschuh wrote:
> > Now that the HID core can handle const report descriptors,
> > constify them where possible.
> >
> > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> > ---
> > drivers/hid/hid-lg.c | 31 +++++++++++++++++--------------
> > 1 file changed, 17 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
> > index a9be918e2b5c..c1feeb1dd077 100644
> > --- a/drivers/hid/hid-lg.c
> > +++ b/drivers/hid/hid-lg.c
> > @@ -58,7 +58,7 @@
> > * These descriptors remove the combined Y axis and instead report
> > * separate throttle (Y) and brake (RZ).
> > */
> > -static __u8 df_rdesc_fixed[] = {
> > +static const __u8 df_rdesc_fixed[] = {
> > 0x05, 0x01, /* Usage Page (Desktop), */
> > 0x09, 0x04, /* Usage (Joystick), */
> > 0xA1, 0x01, /* Collection (Application), */
> > @@ -124,7 +124,7 @@ static __u8 df_rdesc_fixed[] = {
> > 0xC0 /* End Collection */
> > };
> >
> > -static __u8 dfp_rdesc_fixed[] = {
> > +static const __u8 dfp_rdesc_fixed[] = {
> > 0x05, 0x01, /* Usage Page (Desktop), */
> > 0x09, 0x04, /* Usage (Joystick), */
> > 0xA1, 0x01, /* Collection (Application), */
> > @@ -172,7 +172,7 @@ static __u8 dfp_rdesc_fixed[] = {
> > 0xC0 /* End Collection */
> > };
> >
> > -static __u8 fv_rdesc_fixed[] = {
> > +static const __u8 fv_rdesc_fixed[] = {
> > 0x05, 0x01, /* Usage Page (Desktop), */
> > 0x09, 0x04, /* Usage (Joystick), */
> > 0xA1, 0x01, /* Collection (Application), */
> > @@ -239,7 +239,7 @@ static __u8 fv_rdesc_fixed[] = {
> > 0xC0 /* End Collection */
> > };
> >
> > -static __u8 momo_rdesc_fixed[] = {
> > +static const __u8 momo_rdesc_fixed[] = {
> > 0x05, 0x01, /* Usage Page (Desktop), */
> > 0x09, 0x04, /* Usage (Joystick), */
> > 0xA1, 0x01, /* Collection (Application), */
> > @@ -285,7 +285,7 @@ static __u8 momo_rdesc_fixed[] = {
> > 0xC0 /* End Collection */
> > };
> >
> > -static __u8 momo2_rdesc_fixed[] = {
> > +static const __u8 momo2_rdesc_fixed[] = {
> > 0x05, 0x01, /* Usage Page (Desktop), */
> > 0x09, 0x04, /* Usage (Joystick), */
> > 0xA1, 0x01, /* Collection (Application), */
> > @@ -333,7 +333,7 @@ static __u8 momo2_rdesc_fixed[] = {
> > 0xC0 /* End Collection */
> > };
> >
> > -static __u8 ffg_rdesc_fixed[] = {
> > +static const __u8 ffg_rdesc_fixed[] = {
> > 0x05, 0x01, /* Usage Page (Desktop), */
> > 0x09, 0x04, /* Usage (Joystik), */
> > 0xA1, 0x01, /* Collection (Application), */
> > @@ -379,7 +379,7 @@ static __u8 ffg_rdesc_fixed[] = {
> > 0xC0 /* End Collection */
> > };
> >
> > -static __u8 fg_rdesc_fixed[] = {
> > +static const __u8 fg_rdesc_fixed[] = {
> > 0x05, 0x01, /* Usage Page (Desktop), */
> > 0x09, 0x04, /* Usage (Joystik), */
> > 0xA1, 0x01, /* Collection (Application), */
> > @@ -431,6 +431,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> > unsigned int *rsize)
> > {
> > struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
> > + const __u8 *ret = NULL;
>
> Not really happy about this, usually "ret" is an int, and this makes
> things slightly harder to read.
Ack.
>
> >
> > if ((drv_data->quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 &&
> > rdesc[84] == 0x8c && rdesc[85] == 0x02) {
> > @@ -453,7 +454,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> > if (*rsize == FG_RDESC_ORIG_SIZE) {
> > hid_info(hdev,
> > "fixing up Logitech Wingman Formula GP report descriptor\n");
> > - rdesc = fg_rdesc_fixed;
> > + ret = fg_rdesc_fixed;
>
> can't you just return fg_rdesc_fixed after setting *rsize, like you did
> in the other patches?
The code looked like it wanted to avoid multiple return sites.
I tried to preserve that style, but indeed it looks wonky.
I'll resend it with the changes.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 07/14] HID: vrc2: constify fixed up report descriptor
2024-08-28 7:33 ` [PATCH 07/14] HID: vrc2: " Thomas Weißschuh
@ 2024-09-18 9:17 ` Marcus Folkesson
0 siblings, 0 replies; 19+ messages in thread
From: Marcus Folkesson @ 2024-09-18 9:17 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Jiri Kosina, Benjamin Tissoires, linux-input, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 284 bytes --]
On Wed, Aug 28, 2024 at 09:33:26AM +0200, Thomas Weißschuh wrote:
> Now that the HID core can handle const report descriptors,
> constify them where possible.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2024-09-18 9:17 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-28 7:33 [PATCH 00/14] HID: constify fixed up report descriptors Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 01/14] HID: bigbenff: constify fixed up report descriptor Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 02/14] HID: dr: " Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 03/14] HID: holtek-kbd: " Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 04/14] HID: keytouch: " Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 05/14] HID: maltron: " Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 06/14] HID: xiaomi: " Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 07/14] HID: vrc2: " Thomas Weißschuh
2024-09-18 9:17 ` Marcus Folkesson
2024-08-28 7:33 ` [PATCH 08/14] HID: viewsonic: " Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 09/14] HID: steelseries: " Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 10/14] HID: pxrc: " Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 11/14] HID: sony: " Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 12/14] HID: waltop: " Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 13/14] HID: lg: " Thomas Weißschuh
2024-09-05 14:51 ` Benjamin Tissoires
2024-09-05 14:59 ` Thomas Weißschuh
2024-08-28 7:33 ` [PATCH 14/14] HID: uclogic: " Thomas Weißschuh
2024-09-05 14:49 ` (subset) [PATCH 00/14] HID: constify fixed up report descriptors Benjamin Tissoires
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox