Hi Ryan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on v4.20-rc4 next-20181129]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:    
https://github.com/0day-ci/linux/commits/Ryan-Case/tty-serial-qcom_geni_serial-Fix-softlock/20181129-174407
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git 
tty-testing
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=mips 

All warnings (new ones prefixed by >>):

   In file included from include/linux/clk.h:16:0,
                    from drivers/tty/serial/qcom_geni_serial.c:8:
   drivers/tty/serial/qcom_geni_serial.c: In function 
'qcom_geni_serial_handle_tx':
   include/linux/kernel.h:845:29: warning: comparison of distinct pointer types 
lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:859:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:869:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:878:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
   include/linux/kernel.h:893:23: note: in expansion of macro 'min'
    #define min3(x, y, z) min((typeof(x))min(x, y), z)
                          ^~~
>> drivers/tty/serial/qcom_geni_serial.c:746:10: note: in expansion of macro 
>> 'min3'
     chunk = min3(avail, pending, (UART_XMIT_SIZE - tail));
             ^~~~

vim +/min3 +746 drivers/tty/serial/qcom_geni_serial.c

   714  
   715  static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool 
done,
   716                  bool active)
   717  {
   718          struct qcom_geni_serial_port *port = to_dev_port(uport, uport);
   719          struct circ_buf *xmit = &uport->state->xmit;
   720          size_t avail;
   721          size_t remaining;
   722          size_t pending;
   723          int i;
   724          u32 status;
   725          unsigned int chunk;
   726          int tail;
   727  
   728          status = readl_relaxed(uport->membase + SE_GENI_TX_FIFO_STATUS);
   729  
   730          /* Complete the current tx command before taking newly added 
data */
   731          if (active)
   732                  pending = port->tx_remaining;
   733          else
   734                  pending = uart_circ_chars_pending(xmit);
   735  
   736          /* All data has been transmitted and acknowledged as received */
   737          if (!pending && !status && done) {
   738                  qcom_geni_serial_stop_tx(uport);
   739                  goto out_write_wakeup;
   740          }
   741  
   742          avail = port->tx_fifo_depth - (status & TX_FIFO_WC);
   743          avail *= port->tx_bytes_pw;
   744  
   745          tail = xmit->tail;
 > 746          chunk = min3(avail, pending, (UART_XMIT_SIZE - tail));
   747          if (!chunk)
   748                  goto out_write_wakeup;
   749  
   750          if (!port->tx_remaining) {
   751                  qcom_geni_serial_setup_tx(uport, pending);
   752                  port->tx_remaining = pending;
   753          }
   754  
   755          remaining = chunk;
   756          for (i = 0; i < chunk; ) {
   757                  unsigned int tx_bytes;
   758                  u8 buf[sizeof(u32)];
   759                  int c;
   760  
   761                  memset(buf, 0, ARRAY_SIZE(buf));
   762                  tx_bytes = min_t(size_t, remaining, port->tx_bytes_pw);
   763                  for (c = 0; c < tx_bytes ; c++)
   764                          buf[c] = xmit->buf[tail + c];
   765  
   766                  iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 
1);
   767  
   768                  i += tx_bytes;
   769                  tail += tx_bytes;
   770                  uport->icount.tx += tx_bytes;
   771                  remaining -= tx_bytes;
   772                  port->tx_remaining -= tx_bytes;
   773          }
   774  
   775          xmit->tail = tail & (UART_XMIT_SIZE - 1);
   776  out_write_wakeup:
   777          if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
   778                  uart_write_wakeup(uport);
   779  }
   780  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to