Re: [PATCH 3/5] HID: Extract vivaldi hid feature mapping for use in hid-hammer

From: kernel test robot
Date: Fri Feb 04 2022 - 19:16:07 EST


Hi Stephen,

I love your patch! Yet something to improve:

[auto build test ERROR on 26291c54e111ff6ba87a164d85d4a4e134b7315c]

url: https://github.com/0day-ci/linux/commits/Stephen-Boyd/Input-HID-Consolidate-ChromeOS-Vivaldi-keyboard-logic/20220205-042211
base: 26291c54e111ff6ba87a164d85d4a4e134b7315c
config: x86_64-randconfig-a004-20220131 (https://download.01.org/0day-ci/archive/20220205/202202050807.BvUyitVE-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/83759eb892fd16fd0bb7ff4bb0c4baa4e7a0283e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Stephen-Boyd/Input-HID-Consolidate-ChromeOS-Vivaldi-keyboard-logic/20220205-042211
git checkout 83759eb892fd16fd0bb7ff4bb0c4baa4e7a0283e
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

vmlinux.o: warning: objtool: mce_start()+0x4e: call to clear_bit() leaves .noinstr.text section
vmlinux.o: warning: objtool: mce_read_aux()+0x41: call to mca_msr_reg() leaves .noinstr.text section
vmlinux.o: warning: objtool: do_machine_check()+0x39d: call to test_bit() leaves .noinstr.text section
vmlinux.o: warning: objtool: enter_from_user_mode()+0x4e: call to on_thread_stack() leaves .noinstr.text section
vmlinux.o: warning: objtool: syscall_enter_from_user_mode()+0x53: call to on_thread_stack() leaves .noinstr.text section
vmlinux.o: warning: objtool: syscall_enter_from_user_mode_prepare()+0x4e: call to on_thread_stack() leaves .noinstr.text section
vmlinux.o: warning: objtool: irqentry_enter_from_user_mode()+0x4e: call to on_thread_stack() leaves .noinstr.text section
ld: drivers/input/vivaldi-keymap.o: in function `vivaldi_hid_feature_mapping':
>> drivers/input/vivaldi-keymap.c:73: undefined reference to `hid_alloc_report_buf'
>> ld: drivers/input/vivaldi-keymap.c:90: undefined reference to `hid_hw_raw_request'
>> ld: drivers/input/vivaldi-keymap.c:108: undefined reference to `hid_report_raw_event'


vim +73 drivers/input/vivaldi-keymap.c

44
45 /**
46 * vivaldi_hid_feature_mapping - Fill out vivaldi keymap data exposed via HID
47 * @data: The vivaldi function keymap
48 * @hdev: HID device to parse
49 * @field: HID field to parse
50 * @usage: HID usage to parse
51 */
52 void vivaldi_hid_feature_mapping(struct vivaldi_data *data,
53 struct hid_device *hdev,
54 struct hid_field *field,
55 struct hid_usage *usage)
56 {
57 struct hid_report *report = field->report;
58 int fn_key;
59 int ret;
60 u32 report_len;
61 u8 *report_data, *buf;
62
63 if (field->logical != HID_USAGE_FN_ROW_PHYSMAP ||
64 (usage->hid & HID_USAGE_PAGE) != HID_UP_ORDINAL)
65 return;
66
67 fn_key = (usage->hid & HID_USAGE);
68 if (fn_key < VIVALDI_MIN_FN_ROW_KEY || fn_key > VIVALDI_MAX_FN_ROW_KEY)
69 return;
70 if (fn_key > data->num_function_row_keys)
71 data->num_function_row_keys = fn_key;
72
> 73 report_data = buf = hid_alloc_report_buf(report, GFP_KERNEL);
74 if (!report_data)
75 return;
76
77 report_len = hid_report_len(report);
78 if (!report->id) {
79 /*
80 * hid_hw_raw_request() will stuff report ID (which will be 0)
81 * into the first byte of the buffer even for unnumbered
82 * reports, so we need to account for this to avoid getting
83 * -EOVERFLOW in return.
84 * Note that hid_alloc_report_buf() adds 7 bytes to the size
85 * so we can safely say that we have space for an extra byte.
86 */
87 report_len++;
88 }
89
> 90 ret = hid_hw_raw_request(hdev, report->id, report_data,
91 report_len, HID_FEATURE_REPORT,
92 HID_REQ_GET_REPORT);
93 if (ret < 0) {
94 dev_warn(&hdev->dev, "failed to fetch feature %d\n",
95 field->report->id);
96 goto out;
97 }
98
99 if (!report->id) {
100 /*
101 * Undo the damage from hid_hw_raw_request() for unnumbered
102 * reports.
103 */
104 report_data++;
105 report_len--;
106 }
107
> 108 ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, report_data,
109 report_len, 0);
110 if (ret) {
111 dev_warn(&hdev->dev, "failed to report feature %d\n",
112 field->report->id);
113 goto out;
114 }
115
116 data->function_row_physmap[fn_key - VIVALDI_MIN_FN_ROW_KEY] =
117 field->value[usage->usage_index];
118
119 out:
120 kfree(buf);
121 }
122 EXPORT_SYMBOL_GPL(vivaldi_hid_feature_mapping);
123 #endif /* CONFIG_HID */
124

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx