Skip to content

Commit 9f5305e

Browse files
t-8chBenjamin Tissoires
authored andcommitted
HID: lg: constify fixed up report descriptor
Now that the HID core can handle const report descriptors, constify them where possible. Signed-off-by: Thomas Weißschuh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent 03f8dc1 commit 9f5305e

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

drivers/hid/hid-lg.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
* These descriptors remove the combined Y axis and instead report
5959
* separate throttle (Y) and brake (RZ).
6060
*/
61-
static __u8 df_rdesc_fixed[] = {
61+
static const __u8 df_rdesc_fixed[] = {
6262
0x05, 0x01, /* Usage Page (Desktop), */
6363
0x09, 0x04, /* Usage (Joystick), */
6464
0xA1, 0x01, /* Collection (Application), */
@@ -124,7 +124,7 @@ static __u8 df_rdesc_fixed[] = {
124124
0xC0 /* End Collection */
125125
};
126126

127-
static __u8 dfp_rdesc_fixed[] = {
127+
static const __u8 dfp_rdesc_fixed[] = {
128128
0x05, 0x01, /* Usage Page (Desktop), */
129129
0x09, 0x04, /* Usage (Joystick), */
130130
0xA1, 0x01, /* Collection (Application), */
@@ -172,7 +172,7 @@ static __u8 dfp_rdesc_fixed[] = {
172172
0xC0 /* End Collection */
173173
};
174174

175-
static __u8 fv_rdesc_fixed[] = {
175+
static const __u8 fv_rdesc_fixed[] = {
176176
0x05, 0x01, /* Usage Page (Desktop), */
177177
0x09, 0x04, /* Usage (Joystick), */
178178
0xA1, 0x01, /* Collection (Application), */
@@ -239,7 +239,7 @@ static __u8 fv_rdesc_fixed[] = {
239239
0xC0 /* End Collection */
240240
};
241241

242-
static __u8 momo_rdesc_fixed[] = {
242+
static const __u8 momo_rdesc_fixed[] = {
243243
0x05, 0x01, /* Usage Page (Desktop), */
244244
0x09, 0x04, /* Usage (Joystick), */
245245
0xA1, 0x01, /* Collection (Application), */
@@ -285,7 +285,7 @@ static __u8 momo_rdesc_fixed[] = {
285285
0xC0 /* End Collection */
286286
};
287287

288-
static __u8 momo2_rdesc_fixed[] = {
288+
static const __u8 momo2_rdesc_fixed[] = {
289289
0x05, 0x01, /* Usage Page (Desktop), */
290290
0x09, 0x04, /* Usage (Joystick), */
291291
0xA1, 0x01, /* Collection (Application), */
@@ -333,7 +333,7 @@ static __u8 momo2_rdesc_fixed[] = {
333333
0xC0 /* End Collection */
334334
};
335335

336-
static __u8 ffg_rdesc_fixed[] = {
336+
static const __u8 ffg_rdesc_fixed[] = {
337337
0x05, 0x01, /* Usage Page (Desktop), */
338338
0x09, 0x04, /* Usage (Joystik), */
339339
0xA1, 0x01, /* Collection (Application), */
@@ -379,7 +379,7 @@ static __u8 ffg_rdesc_fixed[] = {
379379
0xC0 /* End Collection */
380380
};
381381

382-
static __u8 fg_rdesc_fixed[] = {
382+
static const __u8 fg_rdesc_fixed[] = {
383383
0x05, 0x01, /* Usage Page (Desktop), */
384384
0x09, 0x04, /* Usage (Joystik), */
385385
0xA1, 0x01, /* Collection (Application), */
@@ -453,8 +453,8 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
453453
if (*rsize == FG_RDESC_ORIG_SIZE) {
454454
hid_info(hdev,
455455
"fixing up Logitech Wingman Formula GP report descriptor\n");
456-
rdesc = fg_rdesc_fixed;
457456
*rsize = sizeof(fg_rdesc_fixed);
457+
return fg_rdesc_fixed;
458458
} else {
459459
hid_info(hdev,
460460
"rdesc size test failed for formula gp\n");
@@ -466,8 +466,8 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
466466
if (*rsize == FFG_RDESC_ORIG_SIZE) {
467467
hid_info(hdev,
468468
"fixing up Logitech Wingman Formula Force GP report descriptor\n");
469-
rdesc = ffg_rdesc_fixed;
470469
*rsize = sizeof(ffg_rdesc_fixed);
470+
return ffg_rdesc_fixed;
471471
}
472472
break;
473473

@@ -476,44 +476,44 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
476476
if (*rsize == DF_RDESC_ORIG_SIZE) {
477477
hid_info(hdev,
478478
"fixing up Logitech Driving Force report descriptor\n");
479-
rdesc = df_rdesc_fixed;
480479
*rsize = sizeof(df_rdesc_fixed);
480+
return df_rdesc_fixed;
481481
}
482482
break;
483483

484484
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
485485
if (*rsize == MOMO_RDESC_ORIG_SIZE) {
486486
hid_info(hdev,
487487
"fixing up Logitech Momo Force (Red) report descriptor\n");
488-
rdesc = momo_rdesc_fixed;
489488
*rsize = sizeof(momo_rdesc_fixed);
489+
return momo_rdesc_fixed;
490490
}
491491
break;
492492

493493
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2:
494494
if (*rsize == MOMO2_RDESC_ORIG_SIZE) {
495495
hid_info(hdev,
496496
"fixing up Logitech Momo Racing Force (Black) report descriptor\n");
497-
rdesc = momo2_rdesc_fixed;
498497
*rsize = sizeof(momo2_rdesc_fixed);
498+
return momo2_rdesc_fixed;
499499
}
500500
break;
501501

502502
case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL:
503503
if (*rsize == FV_RDESC_ORIG_SIZE) {
504504
hid_info(hdev,
505505
"fixing up Logitech Formula Vibration report descriptor\n");
506-
rdesc = fv_rdesc_fixed;
507506
*rsize = sizeof(fv_rdesc_fixed);
507+
return fv_rdesc_fixed;
508508
}
509509
break;
510510

511511
case USB_DEVICE_ID_LOGITECH_DFP_WHEEL:
512512
if (*rsize == DFP_RDESC_ORIG_SIZE) {
513513
hid_info(hdev,
514514
"fixing up Logitech Driving Force Pro report descriptor\n");
515-
rdesc = dfp_rdesc_fixed;
516515
*rsize = sizeof(dfp_rdesc_fixed);
516+
return dfp_rdesc_fixed;
517517
}
518518
break;
519519

0 commit comments

Comments
 (0)