Content-Type: multipart/mixed; boundary="===============7981660785882860847==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH v8 2/2] serial:sunplus-uart:Add Sunplus SoC UART Driver Date: Wed, 16 Feb 2022 11:59:18 +0800 Message-ID: <202202161113.516ledjy-lkp@intel.com> In-Reply-To: <1644917065-23168-3-git-send-email-hammerh0314@gmail.com> List-Id: --===============7981660785882860847== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Hammer, I love your patch! Perhaps something to improve: [auto build test WARNING on linux/master] [cannot apply to tty/tty-testing robh/for-next linus/master v5.17-rc4 next-= 20220215] [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/Hammer-Hsieh/Add-UART-driv= er-for-Suplus-SP7021-SoC/20220215-172535 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = 2c271fe77d52a0555161926c232cd5bc07178b39 config: arm64-buildonly-randconfig-r003-20220216 (https://download.01.org/0= day-ci/archive/20220216/202202161113.516ledjy-lkp(a)intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0e628a= 783b935c70c80815db6c061ec84f884af5) reproduce (this is a W=3D1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/= make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/0day-ci/linux/commit/acb196db041b9bf489d6378ff= b63751070deea90 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Hammer-Hsieh/Add-UART-driver-for-S= uplus-SP7021-SoC/20220215-172535 git checkout acb196db041b9bf489d6378ffb63751070deea90 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dclang make.cross W=3D= 1 O=3Dbuild_dir ARCH=3Darm64 SHELL=3D/bin/bash drivers/tty/serial/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> drivers/tty/serial/sunplus-uart.c:139:3: warning: variable 'ret' is unin= itialized when used here [-Wuninitialized] ret |=3D TIOCM_DTR; ^~~ drivers/tty/serial/sunplus-uart.c:134:18: note: initialize the variable = 'ret' to silence this warning unsigned int ret, mcr; ^ =3D 0 >> drivers/tty/serial/sunplus-uart.c:310:2: warning: variable 'isc' is unin= itialized when used here [-Wuninitialized] isc |=3D SUP_UART_ISC_RXM; ^~~ drivers/tty/serial/sunplus-uart.c:301:18: note: initialize the variable = 'isc' to silence this warning unsigned int isc; ^ =3D 0 2 warnings generated. vim +/ret +139 drivers/tty/serial/sunplus-uart.c 131 = 132 static unsigned int sunplus_get_mctrl(struct uart_port *port) 133 { 134 unsigned int ret, mcr; 135 = 136 mcr =3D readl(port->membase + SUP_UART_MCR); 137 = 138 if (mcr & UART_MCR_DTR) > 139 ret |=3D TIOCM_DTR; 140 = 141 if (mcr & UART_MCR_RTS) 142 ret |=3D TIOCM_RTS; 143 = 144 if (mcr & SUP_UART_MCR_DCD) 145 ret |=3D TIOCM_CAR; 146 = 147 if (mcr & SUP_UART_MCR_RI) 148 ret |=3D TIOCM_RI; 149 = 150 if (mcr & UART_MCR_LOOP) 151 ret |=3D TIOCM_LOOP; 152 = 153 return ret; 154 } 155 = 156 static void sunplus_stop_tx(struct uart_port *port) 157 { 158 unsigned int isc; 159 = 160 isc =3D readl(port->membase + SUP_UART_ISC); 161 isc &=3D ~SUP_UART_ISC_TXM; 162 writel(isc, port->membase + SUP_UART_ISC); 163 } 164 = 165 static void sunplus_start_tx(struct uart_port *port) 166 { 167 unsigned int isc; 168 = 169 isc =3D readl(port->membase + SUP_UART_ISC); 170 isc |=3D SUP_UART_ISC_TXM; 171 writel(isc, port->membase + SUP_UART_ISC); 172 } 173 = 174 static void sunplus_stop_rx(struct uart_port *port) 175 { 176 unsigned int isc; 177 = 178 isc =3D readl(port->membase + SUP_UART_ISC); 179 isc &=3D ~SUP_UART_ISC_RXM; 180 writel(isc, port->membase + SUP_UART_ISC); 181 } 182 = 183 static void sunplus_break_ctl(struct uart_port *port, int ctl) 184 { 185 unsigned long flags; 186 unsigned int lcr; 187 = 188 spin_lock_irqsave(&port->lock, flags); 189 = 190 lcr =3D readl(port->membase + SUP_UART_LCR); 191 = 192 if (ctl) 193 lcr |=3D SUP_UART_LCR_SBC; /* start break */ 194 else 195 lcr &=3D ~SUP_UART_LCR_SBC; /* stop break */ 196 = 197 writel(lcr, port->membase + SUP_UART_LCR); 198 = 199 spin_unlock_irqrestore(&port->lock, flags); 200 } 201 = 202 static void transmit_chars(struct uart_port *port) 203 { 204 struct circ_buf *xmit =3D &port->state->xmit; 205 = 206 if (port->x_char) { 207 sp_uart_put_char(port, port->x_char); 208 port->icount.tx++; 209 port->x_char =3D 0; 210 return; 211 } 212 = 213 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { 214 sunplus_stop_tx(port); 215 return; 216 } 217 = 218 do { 219 sp_uart_put_char(port, xmit->buf[xmit->tail]); 220 xmit->tail =3D (xmit->tail + 1) % UART_XMIT_SIZE; 221 port->icount.tx++; 222 = 223 if (uart_circ_empty(xmit)) 224 break; 225 } while (sunplus_tx_buf_not_full(port)); 226 = 227 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 228 uart_write_wakeup(port); 229 = 230 if (uart_circ_empty(xmit)) 231 sunplus_stop_tx(port); 232 } 233 = 234 static void receive_chars(struct uart_port *port) 235 { 236 unsigned int lsr =3D readl(port->membase + SUP_UART_LSR); 237 unsigned int ch, flag; 238 = 239 do { 240 ch =3D readl(port->membase + SUP_UART_DATA); 241 flag =3D TTY_NORMAL; 242 port->icount.rx++; 243 = 244 if (unlikely(lsr & SUP_UART_LSR_BRK_ERROR_BITS)) { 245 if (lsr & SUP_UART_LSR_BC) { 246 lsr &=3D ~(SUP_UART_LSR_FE | SUP_UART_LSR_PE); 247 port->icount.brk++; 248 flag =3D TTY_BREAK; 249 if (uart_handle_break(port)) 250 goto ignore_char; 251 } else if (lsr & SUP_UART_LSR_PE) { 252 port->icount.parity++; 253 flag =3D TTY_PARITY; 254 } else if (lsr & SUP_UART_LSR_FE) { 255 port->icount.frame++; 256 flag =3D TTY_FRAME; 257 } 258 = 259 if (lsr & SUP_UART_LSR_OE) 260 port->icount.overrun++; 261 } 262 = 263 if (port->ignore_status_mask & SUP_DUMMY_READ) 264 goto ignore_char; 265 = 266 if (uart_handle_sysrq_char(port, ch)) 267 goto ignore_char; 268 = 269 uart_insert_char(port, lsr, SUP_UART_LSR_OE, ch, flag); 270 = 271 ignore_char: 272 lsr =3D readl(port->membase + SUP_UART_LSR); 273 } while (lsr & SUP_UART_LSR_RX); 274 = 275 tty_flip_buffer_push(&port->state->port); 276 } 277 = 278 static irqreturn_t sunplus_uart_irq(int irq, void *args) 279 { 280 struct uart_port *port =3D args; 281 unsigned int isc; 282 = 283 spin_lock(&port->lock); 284 = 285 isc =3D readl(port->membase + SUP_UART_ISC); 286 = 287 if (isc & SUP_UART_ISC_RX) 288 receive_chars(port); 289 = 290 if (isc & SUP_UART_ISC_TX) 291 transmit_chars(port); 292 = 293 spin_unlock(&port->lock); 294 = 295 return IRQ_HANDLED; 296 } 297 = 298 static int sunplus_startup(struct uart_port *port) 299 { 300 unsigned long flags; 301 unsigned int isc; 302 int ret; 303 = 304 ret =3D request_irq(port->irq, sunplus_uart_irq, 0, "sunplus_uart",= port); 305 if (ret) 306 return ret; 307 = 308 spin_lock_irqsave(&port->lock, flags); 309 = > 310 isc |=3D SUP_UART_ISC_RXM; 311 writel(isc, port->membase + SUP_UART_ISC); 312 = 313 spin_unlock_irqrestore(&port->lock, flags); 314 = 315 return 0; 316 } 317 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============7981660785882860847==--