summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-core.c
diff options
context:
space:
mode:
authorBenjamin Tissoires <bentiss@kernel.org>2024-09-13 15:14:56 +0200
committerBenjamin Tissoires <bentiss@kernel.org>2024-09-13 15:14:56 +0200
commit054e0bd3457735ee03879c49e36f15f649fe9c86 (patch)
tree48fd781e9da238825ad979203c2a9ea994e4024a /drivers/hid/hid-core.c
parent37c25a50313c4f11904c403dd55b06a539ba349f (diff)
parent9f5305ed80108a7849b3b27e1a889a7afff46a51 (diff)
downloadlwn-054e0bd3457735ee03879c49e36f15f649fe9c86.tar.gz
lwn-054e0bd3457735ee03879c49e36f15f649fe9c86.zip
Merge branch 'for-6.12/constify-rdesc' into for-linus
- Constification of report descriptors so drivers can use read-only memory when declaring report descriptors fixups (Thomas Weißschuh)
Diffstat (limited to 'drivers/hid/hid-core.c')
-rw-r--r--drivers/hid/hid-core.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index caeba5487b69..30de92d0bf0f 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -723,7 +723,7 @@ static void hid_device_release(struct device *dev)
* items, though they are not used yet.
*/
-static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item)
+static const u8 *fetch_item(const __u8 *start, const __u8 *end, struct hid_item *item)
{
u8 b;
@@ -880,8 +880,8 @@ static int hid_scan_report(struct hid_device *hid)
{
struct hid_parser *parser;
struct hid_item item;
- __u8 *start = hid->dev_rdesc;
- __u8 *end = start + hid->dev_rsize;
+ const __u8 *start = hid->dev_rdesc;
+ const __u8 *end = start + hid->dev_rsize;
static int (*dispatch_type[])(struct hid_parser *parser,
struct hid_item *item) = {
hid_scan_main,
@@ -946,7 +946,7 @@ static int hid_scan_report(struct hid_device *hid)
* Allocate the device report as read by the bus driver. This function should
* only be called from parse() in ll drivers.
*/
-int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size)
+int hid_parse_report(struct hid_device *hid, const __u8 *start, unsigned size)
{
hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL);
if (!hid->dev_rdesc)
@@ -1204,10 +1204,10 @@ int hid_open_report(struct hid_device *device)
struct hid_parser *parser;
struct hid_item item;
unsigned int size;
- __u8 *start;
+ const __u8 *start;
__u8 *buf;
- __u8 *end;
- __u8 *next;
+ const __u8 *end;
+ const __u8 *next;
int ret;
int i;
static int (*dispatch_type[])(struct hid_parser *parser,