Re: [PATCH] Input: psmouse - add support for FocalTech PS/2 Protocol v2

From: kernel test robot
Date: Thu Feb 11 2021 - 05:42:28 EST


Hi Hamza,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on input/next]
[also build test ERROR on linux/master hid/for-next linus/master v5.11-rc7 next-20210125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Hamza-Farooq/Input-psmouse-add-support-for-FocalTech-PS-2-Protocol-v2/20210211-074527
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: parisc-randconfig-r004-20210211 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/958fb71223bb82ea01edbcbf4970af1d888b1050
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Hamza-Farooq/Input-psmouse-add-support-for-FocalTech-PS-2-Protocol-v2/20210211-074527
git checkout 958fb71223bb82ea01edbcbf4970af1d888b1050
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc

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

All error/warnings (new ones prefixed by >>):

In file included from include/linux/build_bug.h:5,
from include/linux/bits.h:22,
from include/linux/bitops.h:5,
from drivers/input/mouse/psmouse-base.c:13:
drivers/input/mouse/psmouse-base.c: In function 'psmouse_extensions':
>> drivers/input/mouse/psmouse-base.c:1089:24: error: 'focaltech_v2_detect' undeclared (first use in this function); did you mean 'focaltech_detect'?
1089 | if (psmouse_do_detect(focaltech_v2_detect,
| ^~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/input/mouse/psmouse-base.c:1089:2: note: in expansion of macro 'if'
1089 | if (psmouse_do_detect(focaltech_v2_detect,
| ^~
drivers/input/mouse/psmouse-base.c:1089:24: note: each undeclared identifier is reported only once for each function it appears in
1089 | if (psmouse_do_detect(focaltech_v2_detect,
| ^~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/input/mouse/psmouse-base.c:1089:2: note: in expansion of macro 'if'
1089 | if (psmouse_do_detect(focaltech_v2_detect,
| ^~
--
>> drivers/input/mouse/focaltech_v2.c:27:5: warning: no previous prototype for 'focaltech_v2_detect' [-Wmissing-prototypes]
27 | int focaltech_v2_detect(struct psmouse *psmouse, bool set_properties)
| ^~~~~~~~~~~~~~~~~~~
drivers/input/mouse/focaltech_v2.c:17:33: warning: 'switch_protocol' defined but not used [-Wunused-const-variable=]
17 | static const struct fte_command switch_protocol[] = {
| ^~~~~~~~~~~~~~~


vim +1089 drivers/input/mouse/psmouse-base.c

1052
1053 /*
1054 * psmouse_extensions() probes for any extensions to the basic PS/2 protocol
1055 * the mouse may have.
1056 */
1057 static int psmouse_extensions(struct psmouse *psmouse,
1058 unsigned int max_proto, bool set_properties)
1059 {
1060 bool synaptics_hardware = false;
1061 int ret;
1062
1063 /*
1064 * Always check for focaltech, this is safe as it uses pnp-id
1065 * matching.
1066 */
1067 if (psmouse_do_detect(focaltech_detect,
1068 psmouse, false, set_properties)) {
1069 if (max_proto > PSMOUSE_IMEX &&
1070 IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH) &&
1071 (!set_properties || focaltech_init(psmouse) == 0)) {
1072 return PSMOUSE_FOCALTECH;
1073 }
1074 /*
1075 * Restrict psmouse_max_proto so that psmouse_initialize()
1076 * does not try to reset rate and resolution, because even
1077 * that upsets the device.
1078 * This also causes us to basically fall through to basic
1079 * protocol detection, where we fully reset the mouse,
1080 * and set it up as bare PS/2 protocol device.
1081 */
1082 psmouse_max_proto = max_proto = PSMOUSE_PS2;
1083 }
1084
1085 /*
1086 * Always check for focaltech-v2, this is safe as it uses pnp-id
1087 * matching.
1088 */
> 1089 if (psmouse_do_detect(focaltech_v2_detect,
1090 psmouse, false, set_properties)) {
1091 if (max_proto > PSMOUSE_IMEX &&
1092 IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH_V2) &&
1093 (!set_properties || focaltech_v2_init(psmouse) == 0)) {
1094 return PSMOUSE_FOCALTECH_V2;
1095 }
1096 /*
1097 * Restrict psmouse_max_proto so that psmouse_initialize()
1098 * does not try to reset rate and resolution, because even
1099 * that upsets the device.
1100 * This also causes us to basically fall through to basic
1101 * protocol detection, where we fully reset the mouse,
1102 * and set it up as bare PS/2 protocol device.
1103 */
1104 psmouse_max_proto = max_proto = PSMOUSE_PS2;
1105 }
1106
1107 /*
1108 * We always check for LifeBook because it does not disturb mouse
1109 * (it only checks DMI information).
1110 */
1111 if (psmouse_try_protocol(psmouse, PSMOUSE_LIFEBOOK, &max_proto,
1112 set_properties, max_proto > PSMOUSE_IMEX))
1113 return PSMOUSE_LIFEBOOK;
1114
1115 if (psmouse_try_protocol(psmouse, PSMOUSE_VMMOUSE, &max_proto,
1116 set_properties, max_proto > PSMOUSE_IMEX))
1117 return PSMOUSE_VMMOUSE;
1118
1119 /*
1120 * Try Kensington ThinkingMouse (we try first, because Synaptics
1121 * probe upsets the ThinkingMouse).
1122 */
1123 if (max_proto > PSMOUSE_IMEX &&
1124 psmouse_try_protocol(psmouse, PSMOUSE_THINKPS, &max_proto,
1125 set_properties, true)) {
1126 return PSMOUSE_THINKPS;
1127 }
1128
1129 /*
1130 * Try Synaptics TouchPad. Note that probing is done even if
1131 * Synaptics protocol support is disabled in config - we need to
1132 * know if it is Synaptics so we can reset it properly after
1133 * probing for IntelliMouse.
1134 */
1135 if (max_proto > PSMOUSE_PS2 &&
1136 psmouse_do_detect(synaptics_detect,
1137 psmouse, false, set_properties)) {
1138 synaptics_hardware = true;
1139
1140 if (max_proto > PSMOUSE_IMEX) {
1141 /*
1142 * Try activating protocol, but check if support is
1143 * enabled first, since we try detecting Synaptics
1144 * even when protocol is disabled.
1145 */
1146 if (IS_ENABLED(CONFIG_MOUSE_PS2_SYNAPTICS) ||
1147 IS_ENABLED(CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS)) {
1148 if (!set_properties)
1149 return PSMOUSE_SYNAPTICS;
1150
1151 ret = synaptics_init(psmouse);
1152 if (ret >= 0)
1153 return ret;
1154 }
1155
1156 /*
1157 * Some Synaptics touchpads can emulate extended
1158 * protocols (like IMPS/2). Unfortunately
1159 * Logitech/Genius probes confuse some firmware
1160 * versions so we'll have to skip them.
1161 */
1162 max_proto = PSMOUSE_IMEX;
1163 }
1164
1165 /*
1166 * Make sure that touchpad is in relative mode, gestures
1167 * (taps) are enabled.
1168 */
1169 synaptics_reset(psmouse);
1170 }
1171
1172 /*
1173 * Try Cypress Trackpad. We must try it before Finger Sensing Pad
1174 * because Finger Sensing Pad probe upsets some modules of Cypress
1175 * Trackpads.
1176 */
1177 if (max_proto > PSMOUSE_IMEX &&
1178 psmouse_try_protocol(psmouse, PSMOUSE_CYPRESS, &max_proto,
1179 set_properties, true)) {
1180 return PSMOUSE_CYPRESS;
1181 }
1182
1183 /* Try ALPS TouchPad */
1184 if (max_proto > PSMOUSE_IMEX) {
1185 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
1186 if (psmouse_try_protocol(psmouse, PSMOUSE_ALPS,
1187 &max_proto, set_properties, true))
1188 return PSMOUSE_ALPS;
1189 }
1190
1191 /* Try OLPC HGPK touchpad */
1192 if (max_proto > PSMOUSE_IMEX &&
1193 psmouse_try_protocol(psmouse, PSMOUSE_HGPK, &max_proto,
1194 set_properties, true)) {
1195 return PSMOUSE_HGPK;
1196 }
1197
1198 /* Try Elantech touchpad */
1199 if (max_proto > PSMOUSE_IMEX &&
1200 psmouse_try_protocol(psmouse, PSMOUSE_ELANTECH,
1201 &max_proto, set_properties, false)) {
1202 if (!set_properties)
1203 return PSMOUSE_ELANTECH;
1204
1205 ret = elantech_init(psmouse);
1206 if (ret >= 0)
1207 return ret;
1208 }
1209
1210 if (max_proto > PSMOUSE_IMEX) {
1211 if (psmouse_try_protocol(psmouse, PSMOUSE_GENPS,
1212 &max_proto, set_properties, true))
1213 return PSMOUSE_GENPS;
1214
1215 if (psmouse_try_protocol(psmouse, PSMOUSE_PS2PP,
1216 &max_proto, set_properties, true))
1217 return PSMOUSE_PS2PP;
1218
1219 if (psmouse_try_protocol(psmouse, PSMOUSE_TRACKPOINT,
1220 &max_proto, set_properties, true))
1221 return PSMOUSE_TRACKPOINT;
1222
1223 if (psmouse_try_protocol(psmouse, PSMOUSE_TOUCHKIT_PS2,
1224 &max_proto, set_properties, true))
1225 return PSMOUSE_TOUCHKIT_PS2;
1226 }
1227
1228 /*
1229 * Try Finger Sensing Pad. We do it here because its probe upsets
1230 * Trackpoint devices (causing TP_READ_ID command to time out).
1231 */
1232 if (max_proto > PSMOUSE_IMEX &&
1233 psmouse_try_protocol(psmouse, PSMOUSE_FSP,
1234 &max_proto, set_properties, true)) {
1235 return PSMOUSE_FSP;
1236 }
1237
1238 /*
1239 * Reset to defaults in case the device got confused by extended
1240 * protocol probes. Note that we follow up with full reset because
1241 * some mice put themselves to sleep when they see PSMOUSE_RESET_DIS.
1242 */
1243 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
1244 psmouse_reset(psmouse);
1245
1246 if (max_proto >= PSMOUSE_IMEX &&
1247 psmouse_try_protocol(psmouse, PSMOUSE_IMEX,
1248 &max_proto, set_properties, true)) {
1249 return PSMOUSE_IMEX;
1250 }
1251
1252 if (max_proto >= PSMOUSE_IMPS &&
1253 psmouse_try_protocol(psmouse, PSMOUSE_IMPS,
1254 &max_proto, set_properties, true)) {
1255 return PSMOUSE_IMPS;
1256 }
1257
1258 /*
1259 * Okay, all failed, we have a standard mouse here. The number of
1260 * the buttons is still a question, though. We assume 3.
1261 */
1262 psmouse_try_protocol(psmouse, PSMOUSE_PS2,
1263 &max_proto, set_properties, true);
1264
1265 if (synaptics_hardware) {
1266 /*
1267 * We detected Synaptics hardware but it did not respond to
1268 * IMPS/2 probes. We need to reset the touchpad because if
1269 * there is a track point on the pass through port it could
1270 * get disabled while probing for protocol extensions.
1271 */
1272 psmouse_reset(psmouse);
1273 }
1274
1275 return PSMOUSE_PS2;
1276 }
1277

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

Attachment: .config.gz
Description: application/gzip