Hi Daniel, Thank you for the patch! Yet something to improve: [auto build test ERROR on hid/for-next] [also build test ERROR on next-20221202] [cannot apply to tty/tty-testing tty/tty-next tty/tty-linus linus/master v6.1-rc7] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Daniel-Beer/hid-ft260-add-UART-support/20221204-155402 base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next patch link: https://lore.kernel.org/r/638c51a2.170a0220.3af16.18f8%40mx.google.com patch subject: [PATCH] hid-ft260: add UART support. config: riscv-randconfig-r032-20221204 compiler: riscv64-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/c3d86c9c4c5c39a444e8f81204cef1abd9f05e8d git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Daniel-Beer/hid-ft260-add-UART-support/20221204-155402 git checkout c3d86c9c4c5c39a444e8f81204cef1abd9f05e8d # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): riscv64-linux-ld: drivers/hid/hid-ft260.o: in function `ft260_uart_receive_chars': >> drivers/hid/hid-ft260.c:1158: undefined reference to `uart_insert_char' >> riscv64-linux-ld: drivers/hid/hid-ft260.c:1161: undefined reference to `tty_flip_buffer_push' riscv64-linux-ld: drivers/hid/hid-ft260.o: in function `ft260_remove': >> drivers/hid/hid-ft260.c:1530: undefined reference to `uart_remove_one_port' riscv64-linux-ld: drivers/hid/hid-ft260.o: in function `ft260_uart_set_termios': >> drivers/hid/hid-ft260.c:1167: undefined reference to `tty_termios_baud_rate' >> riscv64-linux-ld: drivers/hid/hid-ft260.c:1180: undefined reference to `tty_termios_encode_baud_rate' riscv64-linux-ld: drivers/hid/hid-ft260.o: in function `ft260_uart_do_tx': >> drivers/hid/hid-ft260.c:1101: undefined reference to `uart_write_wakeup' riscv64-linux-ld: drivers/hid/hid-ft260.o: in function `alloc_port_number': >> drivers/hid/hid-ft260.c:1380: undefined reference to `uart_add_one_port' riscv64-linux-ld: drivers/hid/hid-ft260.o: in function `ft260_driver_exit': >> drivers/hid/hid-ft260.c:1607: undefined reference to `uart_unregister_driver' riscv64-linux-ld: drivers/hid/hid-ft260.o: in function `ft260_driver_init': >> drivers/hid/hid-ft260.c:1591: undefined reference to `uart_register_driver' >> riscv64-linux-ld: drivers/hid/hid-ft260.c:1598: undefined reference to `uart_unregister_driver' vim +1158 drivers/hid/hid-ft260.c 1097 1098 static void ft260_uart_do_tx(struct work_struct *work) 1099 { 1100 struct ft260_device *dev = > 1101 container_of(work, struct ft260_device, tx_work); 1102 struct uart_port *port = &dev->port; 1103 struct circ_buf *xmit = &port->state->xmit; 1104 int to_send; 1105 1106 if (port->x_char) { 1107 ft260_tx_data(dev, (u8 *)&port->x_char, 1); 1108 port->x_char = 0; 1109 } 1110 1111 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) 1112 return; 1113 1114 to_send = uart_circ_chars_pending(xmit); 1115 1116 if (to_send) { 1117 int until_end = CIRC_CNT_TO_END(xmit->head, 1118 xmit->tail, UART_XMIT_SIZE); 1119 1120 if (until_end < to_send) { 1121 ft260_tx_data(dev, xmit->buf + xmit->tail, until_end); 1122 ft260_tx_data(dev, xmit->buf, to_send - until_end); 1123 } else { 1124 ft260_tx_data(dev, xmit->buf + xmit->tail, to_send); 1125 } 1126 1127 port->icount.tx += to_send; 1128 xmit->tail = (xmit->tail + to_send) & (UART_XMIT_SIZE - 1); 1129 } 1130 1131 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 1132 uart_write_wakeup(port); 1133 } 1134 1135 static void ft260_uart_start_tx(struct uart_port *port) 1136 { 1137 struct ft260_device *dev = 1138 container_of(port, struct ft260_device, port); 1139 1140 schedule_work(&dev->tx_work); 1141 } 1142 1143 static void ft260_uart_stop_tx(struct uart_port *port) 1144 { 1145 struct ft260_device *dev = 1146 container_of(port, struct ft260_device, port); 1147 1148 cancel_work(&dev->tx_work); 1149 } 1150 1151 static void ft260_uart_receive_chars(struct ft260_device *dev, 1152 u8 *data, u8 length) 1153 { 1154 struct uart_port *port = &dev->port; 1155 int i; 1156 1157 for (i = 0; i < length; i++) > 1158 uart_insert_char(port, 0, 0, data[i], TTY_NORMAL); 1159 port->icount.rx += length; 1160 > 1161 tty_flip_buffer_push(&port->state->port); 1162 } 1163 1164 static void ft260_uart_set_termios(struct uart_port *port, 1165 struct ktermios *termios, 1166 const struct ktermios *old_termios) > 1167 { 1168 struct ft260_device *dev = container_of(port, struct ft260_device, port); 1169 struct hid_device *hdev = dev->hdev; 1170 unsigned int baud; 1171 struct ft260_configure_uart_request req; 1172 int ret; 1173 1174 ft260_dbg("%s uart\n", __func__); 1175 memset(&req, 0, sizeof(req)); 1176 1177 req.report = FT260_SYSTEM_SETTINGS; 1178 req.request = FT260_SET_UART_CONFIG; 1179 > 1180 switch (termios->c_cflag & CSIZE) { 1181 case CS7: 1182 req.data_bit = FT260_CFG_DATA_BITS_7; 1183 break; 1184 case CS5: 1185 case CS6: 1186 hid_err(hdev, 1187 "Invalid data bit size, setting to default (8 bit)\n"); 1188 termios->c_cflag &= ~CSIZE; 1189 termios->c_cflag |= CS8; 1190 fallthrough; 1191 default: 1192 case CS8: 1193 req.data_bit = 0x08; 1194 break; 1195 } 1196 1197 req.stop_bit = (termios->c_cflag & CSTOPB) ? 1198 FT260_CFG_STOP_TWO_BIT : FT260_CFG_STOP_ONE_BIT; 1199 1200 if (termios->c_cflag & PARENB) { 1201 req.parity = (termios->c_cflag & PARODD) ? 1202 FT260_CFG_PAR_ODD : FT260_CFG_PAR_EVEN; 1203 } else { 1204 req.parity = FT260_CFG_PAR_NO; 1205 } 1206 1207 baud = tty_termios_baud_rate(termios); 1208 if (baud == 0 || baud < FT260_CFG_BAUD_MIN || baud > FT260_CFG_BAUD_MAX) { 1209 hid_err(hdev, 1210 "Invalid baud rate %d, setting to default (9600)\n", 1211 baud); 1212 baud = 9600; 1213 tty_termios_encode_baud_rate(termios, baud, baud); 1214 } 1215 put_unaligned_le32(baud, &req.baudrate); 1216 1217 if (termios->c_cflag & CRTSCTS) 1218 req.flow_ctrl = FT260_CFG_FLOW_CTRL_RTS_CTS; 1219 else 1220 req.flow_ctrl = FT260_CFG_FLOW_CTRL_NONE; 1221 1222 ft260_dbg("Configured termios: flow control: %d, baudrate: %d, ", 1223 req.flow_ctrl, baud); 1224 ft260_dbg("data_bit: %d, parity: %d, stop_bit: %d, breaking: %d\n", 1225 req.data_bit, req.parity, 1226 req.stop_bit, req.breaking); 1227 1228 ret = ft260_hid_feature_report_set(hdev, (u8 *)&req, sizeof(req)); 1229 if (ret < 0) 1230 hid_err(hdev, "ft260_hid_feature_report_set failed: %d\n", ret); 1231 } 1232 -- 0-DAY CI Kernel Test Service https://01.org/lkp