Content-Type: multipart/mixed; boundary="===============2619475171550330543==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH v6 2/2] serial:sunplus-uart:Add Sunplus SoC UART Driver Date: Wed, 12 Jan 2022 18:51:13 +0800 Message-ID: <202201121800.PmWf0zhj-lkp@intel.com> In-Reply-To: <1641979444-11661-3-git-send-email-hammerh0314@gmail.com> List-Id: --===============2619475171550330543== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Hammer, I love your patch! Yet something to improve: [auto build test ERROR on tty/tty-testing] [also build test ERROR on robh/for-next linux/master linus/master v5.16] [cannot apply to next-20220112] [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/20220112-172542 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-= testing config: nios2-randconfig-m031-20220112 (https://download.01.org/0day-ci/arc= hive/20220112/202201121800.PmWf0zhj-lkp(a)intel.com/config) compiler: nios2-linux-gcc (GCC) 11.2.0 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 # https://github.com/0day-ci/linux/commit/359e5930a7804fbe8d313226c= fec1ff484c16d11 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/20220112-172542 git checkout 359e5930a7804fbe8d313226cfec1ff484c16d11 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-11.2.0 make.cross= O=3Dbuild_dir ARCH=3Dnios2 SHELL=3D/bin/bash drivers/tty/serial/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All error/warnings (new ones prefixed by >>): drivers/tty/serial/sunplus-uart.c: In function 'sunplus_poll_put_char': >> drivers/tty/serial/sunplus-uart.c:430:9: error: implicit declaration of = function 'wait_for_xmitr'; did you mean 'wait_on_bit'? [-Werror=3Dimplicit-= function-declaration] 430 | wait_for_xmitr(port); | ^~~~~~~~~~~~~~ | wait_on_bit drivers/tty/serial/sunplus-uart.c: In function 'sunplus_uart_probe': >> drivers/tty/serial/sunplus-uart.c:624:40: warning: cast between incompat= ible function types from 'int (*)(struct reset_control *)' to 'void (*)(voi= d *)' [-Wcast-function-type] 624 | (void(*)(void *))reset_co= ntrol_assert, | ^ At top level: drivers/tty/serial/sunplus-uart.c:663:12: warning: 'sunplus_uart_resume'= defined but not used [-Wunused-function] 663 | static int sunplus_uart_resume(struct device *dev) | ^~~~~~~~~~~~~~~~~~~ drivers/tty/serial/sunplus-uart.c:653:12: warning: 'sunplus_uart_suspend= ' defined but not used [-Wunused-function] 653 | static int sunplus_uart_suspend(struct device *dev) | ^~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +430 drivers/tty/serial/sunplus-uart.c 426 = 427 #ifdef CONFIG_CONSOLE_POLL 428 static void sunplus_poll_put_char(struct uart_port *port, unsigned c= har data) 429 { > 430 wait_for_xmitr(port); 431 sp_uart_put_char(port, data); 432 } 433 = 434 static int sunplus_poll_get_char(struct uart_port *port) 435 { 436 unsigned int lsr =3D readl(port->membase + SUP_UART_LSR); 437 = 438 if (!(lsr & SUP_UART_LSR_RX)) 439 return NO_POLL_CHAR; 440 = 441 return readl(port->membase + SUP_UART_DATA); 442 } 443 #endif 444 = 445 static const struct uart_ops sunplus_uart_ops =3D { 446 .tx_empty =3D sunplus_tx_empty, 447 .set_mctrl =3D sunplus_set_mctrl, 448 .get_mctrl =3D sunplus_get_mctrl, 449 .stop_tx =3D sunplus_stop_tx, 450 .start_tx =3D sunplus_start_tx, 451 .stop_rx =3D sunplus_stop_rx, 452 .break_ctl =3D sunplus_break_ctl, 453 .startup =3D sunplus_startup, 454 .shutdown =3D sunplus_shutdown, 455 .set_termios =3D sunplus_set_termios, 456 .set_ldisc =3D sunplus_set_ldisc, 457 .type =3D sunplus_type, 458 .config_port =3D sunplus_config_port, 459 .verify_port =3D sunplus_verify_port, 460 #ifdef CONFIG_CONSOLE_POLL 461 .poll_put_char =3D sunplus_poll_put_char, 462 .poll_get_char =3D sunplus_poll_get_char, 463 #endif 464 }; 465 = 466 #ifdef CONFIG_SERIAL_SUNPLUS_CONSOLE 467 struct sunplus_uart_port *sunplus_console_ports[SUP_UART_NR]; 468 = 469 static void wait_for_xmitr(struct uart_port *port) 470 { 471 unsigned int val; 472 int ret; 473 = 474 /* Wait while FIFO is full or timeout */ 475 ret =3D readl_poll_timeout_atomic(port->membase + SUP_UART_LSR, val, 476 (val & SUP_UART_LSR_TX), 1, 10000); 477 = 478 if (ret =3D=3D -ETIMEDOUT) { 479 dev_err(port->dev, "Timeout waiting while UART TX FULL\n"); 480 return; 481 } 482 } 483 = 484 static void sunplus_uart_console_putchar(struct uart_port *port, int= ch) 485 { 486 wait_for_xmitr(port); 487 sp_uart_put_char(port, ch); 488 } 489 = 490 static void sunplus_console_write(struct console *co, 491 const char *s, 492 unsigned int count) 493 { 494 unsigned long flags; 495 int locked =3D 1; 496 = 497 local_irq_save(flags); 498 = 499 if (sunplus_console_ports[co->index]->port.sysrq) 500 locked =3D 0; 501 else if (oops_in_progress) 502 locked =3D spin_trylock(&sunplus_console_ports[co->index]->port.lo= ck); 503 else 504 spin_lock(&sunplus_console_ports[co->index]->port.lock); 505 = 506 uart_console_write(&sunplus_console_ports[co->index]->port, s, coun= t, 507 sunplus_uart_console_putchar); 508 = 509 if (locked) 510 spin_unlock(&sunplus_console_ports[co->index]->port.lock); 511 = 512 local_irq_restore(flags); 513 } 514 = 515 static int __init sunplus_console_setup(struct console *co, char *op= tions) 516 { 517 struct sunplus_uart_port *sup; 518 int baud =3D 115200; 519 int bits =3D 8; 520 int parity =3D 'n'; 521 int flow =3D 'n'; 522 = 523 if (co->index < 0 || co->index >=3D SUP_UART_NR) 524 return -EINVAL; 525 = 526 sup =3D sunplus_console_ports[co->index]; 527 if (!sup) 528 return -ENODEV; 529 = 530 if (options) 531 uart_parse_options(options, &baud, &parity, &bits, &flow); 532 = 533 return uart_set_options(&sup->port, co, baud, parity, bits, flow); 534 } 535 = 536 static struct uart_driver sunplus_uart_driver; 537 static struct console sunplus_uart_console =3D { 538 .name =3D "ttySUP", 539 .write =3D sunplus_console_write, 540 .device =3D uart_console_device, 541 .setup =3D sunplus_console_setup, 542 .flags =3D CON_PRINTBUFFER, 543 .index =3D -1, 544 .data =3D &sunplus_uart_driver 545 }; 546 = 547 static int __init sunplus_console_init(void) 548 { 549 register_console(&sunplus_uart_console); 550 return 0; 551 } 552 console_initcall(sunplus_console_init); 553 #endif 554 = 555 static struct uart_driver sunplus_uart_driver =3D { 556 .owner =3D THIS_MODULE, 557 .driver_name =3D "sunplus_uart", 558 .dev_name =3D "ttySUP", 559 .major =3D TTY_MAJOR, 560 .minor =3D 64, 561 .nr =3D SUP_UART_NR, 562 .cons =3D NULL, 563 }; 564 = 565 static int sunplus_uart_probe(struct platform_device *pdev) 566 { 567 struct sunplus_uart_port *sup; 568 struct uart_port *port; 569 struct resource *res; 570 int ret, irq; 571 = 572 pdev->id =3D of_alias_get_id(pdev->dev.of_node, "serial"); 573 = 574 if (pdev->id < 0 || pdev->id >=3D SUP_UART_NR) 575 return -EINVAL; 576 = 577 sup =3D devm_kzalloc(&pdev->dev, sizeof(*sup), GFP_KERNEL); 578 if (!sup) 579 return -ENOMEM; 580 = 581 sup->clk =3D devm_clk_get_optional(&pdev->dev, NULL); 582 if (IS_ERR(sup->clk)) 583 return dev_err_probe(&pdev->dev, PTR_ERR(sup->clk), "clk not found= \n"); 584 = 585 ret =3D clk_prepare_enable(sup->clk); 586 if (ret) 587 return ret; 588 = 589 ret =3D devm_add_action_or_reset(&pdev->dev, 590 (void(*)(void *))clk_disable_unprepare, 591 sup->clk); 592 if (ret) 593 return ret; 594 = 595 sup->rstc =3D devm_reset_control_get_exclusive(&pdev->dev, NULL); 596 if (IS_ERR(sup->rstc)) 597 return dev_err_probe(&pdev->dev, PTR_ERR(sup->rstc), "rstc not fou= nd\n"); 598 = 599 port =3D &sup->port; 600 = 601 port->membase =3D devm_platform_get_and_ioremap_resource(pdev, 0, &= res); 602 if (IS_ERR(port->membase)) 603 return dev_err_probe(&pdev->dev, PTR_ERR(port->membase), "membase = not found\n"); 604 = 605 irq =3D platform_get_irq(pdev, 0); 606 if (irq < 0) 607 return irq; 608 = 609 port->mapbase =3D res->start; 610 port->uartclk =3D clk_get_rate(sup->clk); 611 port->line =3D pdev->id; 612 port->irq =3D irq; 613 port->dev =3D &pdev->dev; 614 port->iotype =3D UPIO_MEM; 615 port->ops =3D &sunplus_uart_ops; 616 port->flags =3D UPF_BOOT_AUTOCONF; 617 port->fifosize =3D 128; 618 = 619 ret =3D reset_control_deassert(sup->rstc); 620 if (ret) 621 return ret; 622 = 623 ret =3D devm_add_action_or_reset(&pdev->dev, > 624 (void(*)(void *))reset_control_assert, 625 sup->rstc); 626 if (ret) 627 return ret; 628 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============2619475171550330543==--