lkml.org 
[lkml]   [2020]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] tty: st-asc: switch to using devm_fwnode_gpiod_get()
Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on v5.5-rc4 next-20191220]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Dmitry-Torokhov/tty-st-asc-switch-to-using-devm_fwnode_gpiod_get/20200104-090945
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: x86_64-randconfig-a002-20200102 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

drivers/tty/serial/st-asc.c: In function 'asc_set_termios':
>> drivers/tty/serial/st-asc.c:570:13: error: implicit declaration of function 'of_fwhandle_node'; did you mean 'of_match_node'? [-Werror=implicit-function-declaration]
of_fwhandle_node(np),
^~~~~~~~~~~~~~~~
of_match_node
drivers/tty/serial/st-asc.c:570:13: warning: passing argument 2 of 'devm_fwnode_gpiod_get' makes pointer from integer without a cast [-Wint-conversion]
In file included from drivers/tty/serial/st-asc.c:25:0:
include/linux/gpio/consumer.h:560:19: note: expected 'struct fwnode_handle *' but argument is of type 'int'
struct gpio_desc *devm_fwnode_gpiod_get(struct device *dev,
^~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +570 drivers/tty/serial/st-asc.c

502
503 static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
504 struct ktermios *old)
505 {
506 struct asc_port *ascport = to_asc_port(port);
507 struct device_node *np = port->dev->of_node;
508 struct gpio_desc *gpiod;
509 unsigned int baud;
510 u32 ctrl_val;
511 tcflag_t cflag;
512 unsigned long flags;
513
514 /* Update termios to reflect hardware capabilities */
515 termios->c_cflag &= ~(CMSPAR |
516 (ascport->hw_flow_control ? 0 : CRTSCTS));
517
518 port->uartclk = clk_get_rate(ascport->clk);
519
520 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
521 cflag = termios->c_cflag;
522
523 spin_lock_irqsave(&port->lock, flags);
524
525 /* read control register */
526 ctrl_val = asc_in(port, ASC_CTL);
527
528 /* stop serial port and reset value */
529 asc_out(port, ASC_CTL, (ctrl_val & ~ASC_CTL_RUN));
530 ctrl_val = ASC_CTL_RXENABLE | ASC_CTL_FIFOENABLE;
531
532 /* reset fifo rx & tx */
533 asc_out(port, ASC_TXRESET, 1);
534 asc_out(port, ASC_RXRESET, 1);
535
536 /* set character length */
537 if ((cflag & CSIZE) == CS7) {
538 ctrl_val |= ASC_CTL_MODE_7BIT_PAR;
539 } else {
540 ctrl_val |= (cflag & PARENB) ? ASC_CTL_MODE_8BIT_PAR :
541 ASC_CTL_MODE_8BIT;
542 }
543
544 /* set stop bit */
545 ctrl_val |= (cflag & CSTOPB) ? ASC_CTL_STOP_2BIT : ASC_CTL_STOP_1BIT;
546
547 /* odd parity */
548 if (cflag & PARODD)
549 ctrl_val |= ASC_CTL_PARITYODD;
550
551 /* hardware flow control */
552 if ((cflag & CRTSCTS)) {
553 ctrl_val |= ASC_CTL_CTSENABLE;
554
555 /* If flow-control selected, stop handling RTS manually */
556 if (ascport->rts) {
557 devm_gpiod_put(port->dev, ascport->rts);
558 ascport->rts = NULL;
559
560 pinctrl_select_state(ascport->pinctrl,
561 ascport->states[DEFAULT]);
562 }
563 } else {
564 /* If flow-control disabled, it's safe to handle RTS manually */
565 if (!ascport->rts && ascport->states[NO_HW_FLOWCTRL]) {
566 pinctrl_select_state(ascport->pinctrl,
567 ascport->states[NO_HW_FLOWCTRL]);
568
569 gpiod = devm_fwnode_gpiod_get(port->dev,
> 570 of_fwhandle_node(np),
571 "rts",
572 GPIOD_OUT_LOW,
573 np->name);
574 if (!IS_ERR(gpiod))
575 ascport->rts = gpiod;
576 }
577 }
578
579 if ((baud < 19200) && !ascport->force_m1) {
580 asc_out(port, ASC_BAUDRATE, (port->uartclk / (16 * baud)));
581 } else {
582 /*
583 * MODE 1: recommended for high bit rates (above 19.2K)
584 *
585 * baudrate * 16 * 2^16
586 * ASCBaudRate = ------------------------
587 * inputclock
588 *
589 * To keep maths inside 64bits, we divide inputclock by 16.
590 */
591 u64 dividend = (u64)baud * (1 << 16);
592
593 do_div(dividend, port->uartclk / 16);
594 asc_out(port, ASC_BAUDRATE, dividend);
595 ctrl_val |= ASC_CTL_BAUDMODE;
596 }
597
598 uart_update_timeout(port, cflag, baud);
599
600 ascport->port.read_status_mask = ASC_RXBUF_DUMMY_OE;
601 if (termios->c_iflag & INPCK)
602 ascport->port.read_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE;
603 if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
604 ascport->port.read_status_mask |= ASC_RXBUF_DUMMY_BE;
605
606 /*
607 * Characters to ignore
608 */
609 ascport->port.ignore_status_mask = 0;
610 if (termios->c_iflag & IGNPAR)
611 ascport->port.ignore_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE;
612 if (termios->c_iflag & IGNBRK) {
613 ascport->port.ignore_status_mask |= ASC_RXBUF_DUMMY_BE;
614 /*
615 * If we're ignoring parity and break indicators,
616 * ignore overruns too (for real raw support).
617 */
618 if (termios->c_iflag & IGNPAR)
619 ascport->port.ignore_status_mask |= ASC_RXBUF_DUMMY_OE;
620 }
621
622 /*
623 * Ignore all characters if CREAD is not set.
624 */
625 if (!(termios->c_cflag & CREAD))
626 ascport->port.ignore_status_mask |= ASC_RXBUF_DUMMY_RX;
627
628 /* Set the timeout */
629 asc_out(port, ASC_TIMEOUT, 20);
630
631 /* write final value and enable port */
632 asc_out(port, ASC_CTL, (ctrl_val | ASC_CTL_RUN));
633
634 spin_unlock_irqrestore(&port->lock, flags);
635 }
636

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2020-01-04 05:53    [W:0.096 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site