HID: change return type of report_fixup() to const

By allowing the drivers to return a "const *" they can constify their
static report arrays.
This makes it clear to driver authors that the HID core will not modify
those reports and they can be reused for multiple devices.
Furthermore security is slightly improved as those reports are protected
against accidental or malicious modifications.

[bentiss: fixup hid-cougar.c and hid-multitouch.c for latest version of
the master branch]

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240803-hid-const-fixup-v2-6-f53d7a7b29d8@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
This commit is contained in:
Thomas Weißschuh 2024-08-03 14:34:22 +02:00 committed by Benjamin Tissoires
parent 3593630c89
commit fe73965d07
51 changed files with 68 additions and 68 deletions

View File

@ -620,7 +620,7 @@ static void apple_battery_timer_tick(struct timer_list *t)
* MacBook JIS keyboard has wrong logical maximum * MacBook JIS keyboard has wrong logical maximum
* Magic Keyboard JIS has wrong logical maximum * Magic Keyboard JIS has wrong logical maximum
*/ */
static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
struct apple_sc *asc = hid_get_drvdata(hdev); struct apple_sc *asc = hid_get_drvdata(hdev);

View File

@ -1119,7 +1119,7 @@ static const __u8 asus_g752_fixed_rdesc[] = {
0x2A, 0xFF, 0x00, /* Usage Maximum (0xFF) */ 0x2A, 0xFF, 0x00, /* Usage Maximum (0xFF) */
}; };
static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
struct asus_drvdata *drvdata = hid_get_drvdata(hdev); struct asus_drvdata *drvdata = hid_get_drvdata(hdev);

View File

@ -18,7 +18,7 @@
#include "hid-ids.h" #include "hid-ids.h"
static __u8 *aureal_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *aureal_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) { if (*rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) {

View File

@ -464,7 +464,7 @@ error_hw_stop:
return error; return error;
} }
static __u8 *bigben_report_fixup(struct hid_device *hid, __u8 *rdesc, static const __u8 *bigben_report_fixup(struct hid_device *hid, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize == PID0902_RDESC_ORIG_SIZE) { if (*rsize == PID0902_RDESC_ORIG_SIZE) {

View File

@ -22,7 +22,7 @@
* Cherry Cymotion keyboard have an invalid HID report descriptor, * Cherry Cymotion keyboard have an invalid HID report descriptor,
* that needs fixing before we can parse it. * that needs fixing before we can parse it.
*/ */
static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize >= 18 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { if (*rsize >= 18 && rdesc[11] == 0x3c && rdesc[12] == 0x02) {

View File

@ -88,8 +88,8 @@ static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
return 1; return 1;
} }
static __u8 *ch_switch12_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *ch_switch12_report_fixup(struct hid_device *hdev,
unsigned int *rsize) __u8 *rdesc, unsigned int *rsize)
{ {
struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_interface *intf = to_usb_interface(hdev->dev.parent);

View File

@ -199,7 +199,7 @@ static struct hid_driver cmhid_driver = {
.input_mapping = cmhid_input_mapping, .input_mapping = cmhid_input_mapping,
}; };
static __u8 *cmhid_hs100b_report_fixup(struct hid_device *hid, __u8 *rdesc, static const __u8 *cmhid_hs100b_report_fixup(struct hid_device *hid, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize == HS100B_RDESC_ORIG_SIZE) { if (*rsize == HS100B_RDESC_ORIG_SIZE) {

View File

@ -690,8 +690,8 @@ static int corsair_input_mapping(struct hid_device *dev,
* - USB ID 1b1c:1b3e, sold as Scimitar RGB Pro Gaming mouse * - USB ID 1b1c:1b3e, sold as Scimitar RGB Pro Gaming mouse
*/ */
static __u8 *corsair_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *corsair_mouse_report_fixup(struct hid_device *hdev,
unsigned int *rsize) __u8 *rdesc, unsigned int *rsize)
{ {
struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_interface *intf = to_usb_interface(hdev->dev.parent);

View File

@ -103,8 +103,8 @@ static void cougar_fix_g6_mapping(void)
/* /*
* Constant-friendly rdesc fixup for mouse interface * Constant-friendly rdesc fixup for mouse interface
*/ */
static __u8 *cougar_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *cougar_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize >= 117 && rdesc[2] == 0x09 && rdesc[3] == 0x02 && if (*rsize >= 117 && rdesc[2] == 0x09 && rdesc[3] == 0x02 &&
(rdesc[115] | rdesc[116] << 8) >= HID_MAX_USAGES) { (rdesc[115] | rdesc[116] << 8) >= HID_MAX_USAGES) {

View File

@ -67,7 +67,7 @@ static __u8 *va_logical_boundary_fixup(struct hid_device *hdev, __u8 *rdesc,
return rdesc; return rdesc;
} }
static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);

View File

@ -228,8 +228,8 @@ static __u8 pid0011_rdesc_fixed[] = {
0xC0 /* End Collection */ 0xC0 /* End Collection */
}; };
static __u8 *dr_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *dr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
switch (hdev->product) { switch (hdev->product) {
case 0x0011: case 0x0011:

View File

@ -53,7 +53,7 @@ static void mouse_button_fixup(struct hid_device *hdev,
rdesc[padding_bit + 1] = MOUSE_BUTTONS_MAX - nbuttons; rdesc[padding_bit + 1] = MOUSE_BUTTONS_MAX - nbuttons;
} }
static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
switch (hdev->product) { switch (hdev->product) {

View File

@ -57,7 +57,7 @@ static const __u8 gembird_jpd_fixed_rdesc[] = {
0x81, 0x02, /* Input (Data,Var,Abs) */ 0x81, 0x02, /* Input (Data,Var,Abs) */
}; };
static __u8 *gembird_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *gembird_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
__u8 *new_rdesc; __u8 *new_rdesc;

View File

@ -26,7 +26,7 @@ MODULE_DESCRIPTION("HID driver for Glorious PC Gaming Race mice");
* keyboard HID report, causing keycodes to be misinterpreted. * keyboard HID report, causing keycodes to be misinterpreted.
* Fix this by setting Usage Minimum to 0 in that report. * Fix this by setting Usage Minimum to 0 in that report.
*/ */
static __u8 *glorious_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *glorious_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize == 213 && if (*rsize == 213 &&

View File

@ -102,7 +102,7 @@ static __u8 holtek_kbd_rdesc_fixed[] = {
0xC0, /* End Collection */ 0xC0, /* End Collection */
}; };
static __u8 *holtek_kbd_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *holtek_kbd_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_interface *intf = to_usb_interface(hdev->dev.parent);

View File

@ -29,8 +29,8 @@
* - USB ID 04d9:a0c2, sold as ETEKCITY Scroll T-140 Gaming Mouse * - USB ID 04d9:a0c2, sold as ETEKCITY Scroll T-140 Gaming Mouse
*/ */
static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *holtek_mouse_report_fixup(struct hid_device *hdev,
unsigned int *rsize) __u8 *rdesc, unsigned int *rsize)
{ {
struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_interface *intf = to_usb_interface(hdev->dev.parent);

View File

@ -13,7 +13,7 @@
#define QUIRK_TOUCHPAD_ON_OFF_REPORT BIT(0) #define QUIRK_TOUCHPAD_ON_OFF_REPORT BIT(0)
static __u8 *ite_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) static const __u8 *ite_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize)
{ {
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);

View File

@ -24,7 +24,7 @@ static __u8 keytouch_fixed_rdesc[] = {
0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00, 0xc0 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00, 0xc0
}; };
static __u8 *keytouch_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *keytouch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
hid_info(hdev, "fixing up Keytouch IEC report descriptor\n"); hid_info(hdev, "fixing up Keytouch IEC report descriptor\n");

View File

@ -466,7 +466,7 @@ static __u8 *kye_tablet_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int
return rdesc; return rdesc;
} }
static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
switch (hdev->product) { switch (hdev->product) {

View File

@ -133,7 +133,7 @@ static const __u8 lenovo_tpIIbtkbd_need_fixup_collection[] = {
0x81, 0x01, /* Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) */ 0x81, 0x01, /* Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) */
}; };
static __u8 *lenovo_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *lenovo_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
switch (hdev->product) { switch (hdev->product) {

View File

@ -427,7 +427,7 @@ static __u8 fg_rdesc_fixed[] = {
* above the logical maximum described in descriptor. This extends * above the logical maximum described in descriptor. This extends
* the original value of 0x28c of logical maximum to 0x104d * the original value of 0x28c of logical maximum to 0x104d
*/ */
static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
struct lg_drv_data *drv_data = hid_get_drvdata(hdev); struct lg_drv_data *drv_data = hid_get_drvdata(hdev);

View File

@ -3767,8 +3767,8 @@ static int hidpp_initialize_hires_scroll(struct hidpp_device *hidpp)
/* Generic HID++ devices */ /* Generic HID++ devices */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
static u8 *hidpp_report_fixup(struct hid_device *hdev, u8 *rdesc, static const u8 *hidpp_report_fixup(struct hid_device *hdev, u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
struct hidpp_device *hidpp = hid_get_drvdata(hdev); struct hidpp_device *hidpp = hid_get_drvdata(hdev);

View File

@ -18,8 +18,8 @@ MODULE_LICENSE("GPL");
* The Macally ikey keyboard says that its logical and usage maximums are both * The Macally ikey keyboard says that its logical and usage maximums are both
* 101, but the power key is 102 and the equals key is 103 * 101, but the power key is 102 and the equals key is 103
*/ */
static __u8 *macally_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *macally_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize >= 60 && rdesc[53] == 0x65 && rdesc[59] == 0x65) { if (*rsize >= 60 && rdesc[53] == 0x65 && rdesc[59] == 0x65) {
hid_info(hdev, hid_info(hdev,

View File

@ -907,8 +907,8 @@ static void magicmouse_remove(struct hid_device *hdev)
hid_hw_stop(hdev); hid_hw_stop(hdev);
} }
static __u8 *magicmouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *magicmouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
/* /*
* Change the usage from: * Change the usage from:

View File

@ -137,8 +137,8 @@ static u8 maltron_rdesc[] = {
0xC0 /* End Collection */ 0xC0 /* End Collection */
}; };
static __u8 *maltron_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *maltron_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize == sizeof(maltron_rdesc_o) && if (*rsize == sizeof(maltron_rdesc_o) &&
!memcmp(maltron_rdesc_o, rdesc, sizeof(maltron_rdesc_o))) { !memcmp(maltron_rdesc_o, rdesc, sizeof(maltron_rdesc_o))) {

View File

@ -56,7 +56,7 @@ struct xb1s_ff_report {
__u8 loop_count; __u8 loop_count;
} __packed; } __packed;
static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
struct ms_data *ms = hid_get_drvdata(hdev); struct ms_data *ms = hid_get_drvdata(hdev);

View File

@ -18,7 +18,7 @@
#include "hid-ids.h" #include "hid-ids.h"
static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize >= 31 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { if (*rsize >= 31 && rdesc[29] == 0x05 && rdesc[30] == 0x09) {

View File

@ -1441,7 +1441,7 @@ static int mt_event(struct hid_device *hid, struct hid_field *field,
return 0; return 0;
} }
static __u8 *mt_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *mt_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *size) unsigned int *size)
{ {
if (hdev->vendor == I2C_VENDOR_ID_GOODIX && if (hdev->vendor == I2C_VENDOR_ID_GOODIX &&

View File

@ -29,7 +29,7 @@ MODULE_DESCRIPTION("HID driver for Network Technologies USB-SUN keyboard adapter
/* /*
* NTI Sun keyboard adapter has wrong logical maximum in report descriptor * NTI Sun keyboard adapter has wrong logical maximum in report descriptor
*/ */
static __u8 *nti_usbsun_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *nti_usbsun_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize >= 60 && rdesc[53] == 0x65 && rdesc[59] == 0x65) { if (*rsize >= 60 && rdesc[53] == 0x65 && rdesc[59] == 0x65) {

View File

@ -22,7 +22,7 @@
#include "hid-ids.h" #include "hid-ids.h"
static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) { if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {

View File

@ -19,7 +19,7 @@
#include "hid-ids.h" #include "hid-ids.h"
/* Petalynx Maxter Remote has maximum for consumer page set too low */ /* Petalynx Maxter Remote has maximum for consumer page set too low */
static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize >= 62 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && if (*rsize >= 62 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 &&

View File

@ -728,7 +728,7 @@ static int pcmidi_snd_terminate(struct pcmidi_snd *pm)
/* /*
* PC-MIDI report descriptor for report id is wrong. * PC-MIDI report descriptor for report id is wrong.
*/ */
static __u8 *pk_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *pk_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize == 178 && if (*rsize == 178 &&

View File

@ -42,8 +42,8 @@ static __u8 pxrc_rdesc_fixed[] = {
0xC0, // End Collection 0xC0, // End Collection
}; };
static __u8 *pxrc_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *pxrc_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
hid_info(hdev, "fixing up PXRC report descriptor\n"); hid_info(hdev, "fixing up PXRC report descriptor\n");
*rsize = sizeof(pxrc_rdesc_fixed); *rsize = sizeof(pxrc_rdesc_fixed);

View File

@ -33,7 +33,7 @@
* key codes are generated. * key codes are generated.
*/ */
static __u8 *redragon_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *redragon_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize >= 102 && rdesc[100] == 0x81 && rdesc[101] == 0x00) { if (*rsize >= 102 && rdesc[100] == 0x81 && rdesc[101] == 0x00) {

View File

@ -66,7 +66,7 @@ static int saitek_probe(struct hid_device *hdev,
return 0; return 0;
} }
static __u8 *saitek_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *saitek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
struct saitek_sc *ssc = hid_get_drvdata(hdev); struct saitek_sc *ssc = hid_get_drvdata(hdev);

View File

@ -469,7 +469,7 @@ static int samsung_universal_kbd_input_mapping(struct hid_device *hdev,
return 1; return 1;
} }
static __u8 *samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (hdev->product == USB_DEVICE_ID_SAMSUNG_IR_REMOTE && hid_is_usb(hdev)) if (hdev->product == USB_DEVICE_ID_SAMSUNG_IR_REMOTE && hid_is_usb(hdev))

View File

@ -11,8 +11,8 @@
#include "hid-ids.h" #include "hid-ids.h"
static __u8 *semitek_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *semitek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
/* In the report descriptor for interface 2, fix the incorrect /* In the report descriptor for interface 2, fix the incorrect
description of report ID 0x04 (the report contains a description of report ID 0x04 (the report contains a

View File

@ -580,7 +580,7 @@ void sensor_hub_device_close(struct hid_sensor_hub_device *hsdev)
} }
EXPORT_SYMBOL_GPL(sensor_hub_device_close); EXPORT_SYMBOL_GPL(sensor_hub_device_close);
static __u8 *sensor_hub_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *sensor_hub_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
/* /*

View File

@ -99,8 +99,8 @@ static const __u8 sm_0059_rdesc[] = {
0xc0, /* End Collection 166 */ 0xc0, /* End Collection 166 */
}; };
static __u8 *sm_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *sm_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize == sizeof(sm_0059_rdesc) && if (*rsize == sizeof(sm_0059_rdesc) &&
!memcmp(sm_0059_rdesc, rdesc, *rsize)) { !memcmp(sm_0059_rdesc, rdesc, *rsize)) {

View File

@ -743,7 +743,7 @@ static int sixaxis_mapping(struct hid_device *hdev, struct hid_input *hi,
return -1; return -1;
} }
static u8 *sony_report_fixup(struct hid_device *hdev, u8 *rdesc, static const u8 *sony_report_fixup(struct hid_device *hdev, u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
struct sony_sc *sc = hid_get_drvdata(hdev); struct sony_sc *sc = hid_get_drvdata(hdev);

View File

@ -570,8 +570,8 @@ static void steelseries_remove(struct hid_device *hdev)
hid_hw_stop(hdev); hid_hw_stop(hdev);
} }
static __u8 *steelseries_srws1_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *steelseries_srws1_report_fixup(struct hid_device *hdev,
unsigned int *rsize) __u8 *rdesc, unsigned int *rsize)
{ {
if (hdev->vendor != USB_VENDOR_ID_STEELSERIES || if (hdev->vendor != USB_VENDOR_ID_STEELSERIES ||
hdev->product != USB_DEVICE_ID_STEELSERIES_SRWS1) hdev->product != USB_DEVICE_ID_STEELSERIES_SRWS1)

View File

@ -18,7 +18,7 @@
#include "hid-ids.h" #include "hid-ids.h"
static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize >= 112 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && if (*rsize >= 112 && rdesc[104] == 0x26 && rdesc[105] == 0x80 &&

View File

@ -21,8 +21,8 @@ MODULE_LICENSE("GPL");
* events it's actually sending. It claims to send array events but is instead * events it's actually sending. It claims to send array events but is instead
* sending variable events. * sending variable events.
*/ */
static __u8 *topre_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *topre_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize >= 119 && rdesc[69] == 0x29 && rdesc[70] == 0xe7 && if (*rsize >= 119 && rdesc[69] == 0x29 && rdesc[70] == 0xe7 &&
rdesc[71] == 0x81 && rdesc[72] == 0x00) { rdesc[71] == 0x81 && rdesc[72] == 0x00) {

View File

@ -50,7 +50,7 @@ static void uclogic_inrange_timeout(struct timer_list *t)
input_sync(input); input_sync(input);
} }
static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev); struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);

View File

@ -70,8 +70,8 @@ static __u8 pd1011_rdesc_fixed[] = {
0xC0 /* End Collection */ 0xC0 /* End Collection */
}; };
static __u8 *viewsonic_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *viewsonic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
switch (hdev->product) { switch (hdev->product) {
case USB_DEVICE_ID_VIEWSONIC_PD1011: case USB_DEVICE_ID_VIEWSONIC_PD1011:

View File

@ -38,8 +38,8 @@ static __u8 vrc2_rdesc_fixed[] = {
0xC0, // End Collection 0xC0, // End Collection
}; };
static __u8 *vrc2_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *vrc2_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
hid_info(hdev, "fixing up VRC-2 report descriptor\n"); hid_info(hdev, "fixing up VRC-2 report descriptor\n");
*rsize = sizeof(vrc2_rdesc_fixed); *rsize = sizeof(vrc2_rdesc_fixed);

View File

@ -599,7 +599,7 @@ static __u8 sirius_battery_free_tablet_rdesc_fixed[] = {
0xC0 /* End Collection */ 0xC0 /* End Collection */
}; };
static __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
switch (hdev->product) { switch (hdev->product) {

View File

@ -165,7 +165,7 @@ static __u8 original_rdesc_buttons[] = {
* This module skips numbers 32-63, unused on some throttle grips. * This module skips numbers 32-63, unused on some throttle grips.
*/ */
static __u8 *winwing_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *winwing_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
int sig_length = sizeof(original_rdesc_buttons); int sig_length = sizeof(original_rdesc_buttons);

View File

@ -61,8 +61,8 @@ static __u8 mi_silent_mouse_rdesc_fixed[] = {
0xC0 /* End Collection */ 0xC0 /* End Collection */
}; };
static __u8 *xiaomi_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *xiaomi_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
switch (hdev->product) { switch (hdev->product) {
case USB_DEVICE_ID_MI_SILENT_MOUSE: case USB_DEVICE_ID_MI_SILENT_MOUSE:

View File

@ -24,7 +24,7 @@ struct zc_device {
* Zydacron remote control has an invalid HID report descriptor, * Zydacron remote control has an invalid HID report descriptor,
* that needs fixing before we can parse it. * that needs fixing before we can parse it.
*/ */
static __u8 *zc_report_fixup(struct hid_device *hdev, __u8 *rdesc, static const __u8 *zc_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize) unsigned int *rsize)
{ {
if (*rsize >= 253 && if (*rsize >= 253 &&

View File

@ -822,7 +822,7 @@ struct hid_driver {
struct hid_usage *usage, __s32 value); struct hid_usage *usage, __s32 value);
void (*report)(struct hid_device *hdev, struct hid_report *report); void (*report)(struct hid_device *hdev, struct hid_report *report);
__u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf, const __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf,
unsigned int *size); unsigned int *size);
int (*input_mapping)(struct hid_device *hdev, int (*input_mapping)(struct hid_device *hdev,