summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-uclogic-rdesc.c
diff options
context:
space:
mode:
authorJosé Expósito <jose.exposito89@gmail.com>2022-06-11 14:39:11 +0300
committerJiri Kosina <jkosina@suse.cz>2022-06-15 16:51:46 +0300
commit76e645be7ebecbf39ab2edd949ea7f1757f58900 (patch)
tree4c8f2288c251a0ab887e616444bf342bdf46f89a /drivers/hid/hid-uclogic-rdesc.c
parentaa051d36ce4ae23b488489f6b15abad68b59ca23 (diff)
downloadlinux-76e645be7ebecbf39ab2edd949ea7f1757f58900.tar.xz
HID: uclogic: Make template placeholder IDs generic
Up until now, the report descriptor template parameter IDs were only used with pen report descriptors and they were named accordingly. Rename the enum and the total number of IDs to make them interface agnostic. Refactor, no functional changes. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-uclogic-rdesc.c')
-rw-r--r--drivers/hid/hid-uclogic-rdesc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c
index 13f9ce73f1b1..7126fba80968 100644
--- a/drivers/hid/hid-uclogic-rdesc.c
+++ b/drivers/hid/hid-uclogic-rdesc.c
@@ -979,7 +979,7 @@ const size_t uclogic_rdesc_xppen_deco01_frame_size =
* uclogic_rdesc_template_apply() - apply report descriptor parameters to a
* report descriptor template, creating a report descriptor. Copies the
* template over to the new report descriptor and replaces every occurrence of
- * UCLOGIC_RDESC_PH_HEAD, followed by an index byte, with the value from the
+ * UCLOGIC_RDESC_PEN_PH_HEAD, followed by an index byte, with the value from the
* parameter list at that index.
*
* @template_ptr: Pointer to the template buffer.
@@ -996,7 +996,7 @@ __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
const s32 *param_list,
size_t param_num)
{
- static const __u8 head[] = {UCLOGIC_RDESC_PH_HEAD};
+ static const __u8 pen_head[] = {UCLOGIC_RDESC_PEN_PH_HEAD};
__u8 *rdesc_ptr;
__u8 *p;
s32 v;
@@ -1005,12 +1005,12 @@ __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
if (rdesc_ptr == NULL)
return NULL;
- for (p = rdesc_ptr; p + sizeof(head) < rdesc_ptr + template_size;) {
- if (memcmp(p, head, sizeof(head)) == 0 &&
- p[sizeof(head)] < param_num) {
- v = param_list[p[sizeof(head)]];
+ for (p = rdesc_ptr; p + sizeof(pen_head) < rdesc_ptr + template_size;) {
+ if (memcmp(p, pen_head, sizeof(pen_head)) == 0 &&
+ p[sizeof(pen_head)] < param_num) {
+ v = param_list[p[sizeof(pen_head)]];
put_unaligned(cpu_to_le32(v), (s32 *)p);
- p += sizeof(head) + 1;
+ p += sizeof(pen_head) + 1;
} else {
p++;
}