mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 22:24:11 +08:00
HID: constify params and return value of fetch_item()
fetch_item() does not modify the descriptor it operates on. As a prerequisite for the constification of hid_driver::dev_rdesc, mark the parameters and return value of fetch_item() as const. Also adapt the variable types in the callers to match this constification. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://patch.msgid.link/20240803-hid-const-fixup-v2-4-f53d7a7b29d8@weissschuh.net Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
This commit is contained in:
parent
24ddd0d7de
commit
80cfb508f3
@ -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,
|
||||
@ -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,
|
||||
|
@ -46,7 +46,7 @@ struct hid_item {
|
||||
__s16 s16;
|
||||
__u32 u32;
|
||||
__s32 s32;
|
||||
__u8 *longdata;
|
||||
const __u8 *longdata;
|
||||
} data;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user