Re: [PATCH v4] spi: spi-geni-qcom: Add support for GPI dma

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Vinod,

I love your patch! Perhaps something to improve:

[auto build test WARNING on broonie-spi/for-next]
[also build test WARNING on v5.15-rc6 next-20211019]
[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/Vinod-Koul/spi-spi-geni-qcom-Add-support-for-GPI-dma/20211019-140206
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: i386-buildonly-randconfig-r005-20211019 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b37efed957ed0a0193d80020aefd55cb587dfc1f)
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/0day-ci/linux/commit/4328916194e339d055a1d4c02170602b775ce334
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Vinod-Koul/spi-spi-geni-qcom-Add-support-for-GPI-dma/20211019-140206
        git checkout 4328916194e339d055a1d4c02170602b775ce334
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/spi/spi-geni-qcom.c:401:41: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
           peripheral.loopback_en = spi_slv->mode && SPI_LOOP;
                                                  ^  ~~~~~~~~
   drivers/spi/spi-geni-qcom.c:401:41: note: use '&' for a bitwise operation
           peripheral.loopback_en = spi_slv->mode && SPI_LOOP;
                                                  ^~
                                                  &
   drivers/spi/spi-geni-qcom.c:401:41: note: remove constant to silence this warning
           peripheral.loopback_en = spi_slv->mode && SPI_LOOP;
                                                 ~^~~~~~~~~~~
   drivers/spi/spi-geni-qcom.c:402:44: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
           peripheral.clock_pol_high = spi_slv->mode && SPI_CPOL;
                                                     ^  ~~~~~~~~
   drivers/spi/spi-geni-qcom.c:402:44: note: use '&' for a bitwise operation
           peripheral.clock_pol_high = spi_slv->mode && SPI_CPOL;
                                                     ^~
                                                     &
   drivers/spi/spi-geni-qcom.c:402:44: note: remove constant to silence this warning
           peripheral.clock_pol_high = spi_slv->mode && SPI_CPOL;
                                                    ~^~~~~~~~~~~
   2 warnings generated.


vim +401 drivers/spi/spi-geni-qcom.c

   365	
   366	static int setup_gsi_xfer(struct spi_transfer *xfer, struct spi_geni_master *mas,
   367				  struct spi_device *spi_slv, struct spi_master *spi)
   368	{
   369		unsigned long flags = DMA_PREP_INTERRUPT | DMA_CTRL_ACK;
   370		struct dma_slave_config config = {};
   371		struct gpi_spi_config peripheral = {};
   372		struct dma_async_tx_descriptor *tx_desc, *rx_desc;
   373		int ret;
   374	
   375		config.peripheral_config = &peripheral;
   376		config.peripheral_size = sizeof(peripheral);
   377		peripheral.set_config = true;
   378	
   379		if (xfer->bits_per_word != mas->cur_bits_per_word ||
   380		    xfer->speed_hz != mas->cur_speed_hz) {
   381			mas->cur_bits_per_word = xfer->bits_per_word;
   382			mas->cur_speed_hz = xfer->speed_hz;
   383		}
   384	
   385		if (xfer->tx_buf && xfer->rx_buf) {
   386			peripheral.cmd = SPI_DUPLEX;
   387		} else if (xfer->tx_buf) {
   388			peripheral.cmd = SPI_TX;
   389			peripheral.rx_len = 0;
   390		} else if (xfer->rx_buf) {
   391			peripheral.cmd = SPI_RX;
   392			if (!(mas->cur_bits_per_word % MIN_WORD_LEN)) {
   393				peripheral.rx_len = ((xfer->len << 3) / mas->cur_bits_per_word);
   394			} else {
   395				int bytes_per_word = (mas->cur_bits_per_word / BITS_PER_BYTE) + 1;
   396	
   397				peripheral.rx_len = (xfer->len / bytes_per_word);
   398			}
   399		}
   400	
 > 401		peripheral.loopback_en = spi_slv->mode && SPI_LOOP;
   402		peripheral.clock_pol_high = spi_slv->mode && SPI_CPOL;
   403		peripheral.data_pol_high = spi_slv->mode && SPI_CPHA;
   404		peripheral.cs = spi_slv->chip_select;
   405		peripheral.pack_en = true;
   406		peripheral.word_len = xfer->bits_per_word - MIN_WORD_LEN;
   407	
   408		ret = get_spi_clk_cfg(mas->cur_speed_hz, mas,
   409				      &peripheral.clk_src, &peripheral.clk_div);
   410		if (ret) {
   411			dev_err(mas->dev, "Err in get_spi_clk_cfg() :%d\n", ret);
   412			return ret;
   413		}
   414	
   415		if (!xfer->cs_change) {
   416			if (!list_is_last(&xfer->transfer_list, &spi->cur_msg->transfers))
   417				peripheral.fragmentation = FRAGMENTATION;
   418		}
   419	
   420		if (peripheral.cmd & SPI_RX) {
   421			dmaengine_slave_config(mas->rx, &config);
   422			rx_desc = dmaengine_prep_slave_sg(mas->rx, xfer->rx_sg.sgl, xfer->rx_sg.nents,
   423							  DMA_DEV_TO_MEM, flags);
   424			if (!rx_desc) {
   425				dev_err(mas->dev, "Err setting up rx desc\n");
   426				return -EIO;
   427			}
   428		}
   429	
   430		/*
   431		 * Prepare the TX always, even for RX or tx_buf being null, we would
   432		 * need TX to be prepared per GSI spec
   433		 */
   434		dmaengine_slave_config(mas->tx, &config);
   435		tx_desc = dmaengine_prep_slave_sg(mas->tx, xfer->tx_sg.sgl, xfer->tx_sg.nents,
   436						  DMA_MEM_TO_DEV, flags);
   437		if (!tx_desc) {
   438			dev_err(mas->dev, "Err setting up tx desc\n");
   439			return -EIO;
   440		}
   441	
   442		tx_desc->callback_result = spi_gsi_callback_result;
   443		tx_desc->callback_param = spi;
   444	
   445		if (peripheral.cmd & SPI_RX)
   446			dmaengine_submit(rx_desc);
   447		dmaengine_submit(tx_desc);
   448	
   449		if (peripheral.cmd & SPI_RX)
   450			dma_async_issue_pending(mas->rx);
   451	
   452		dma_async_issue_pending(mas->tx);
   453		return 1;
   454	}
   455	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux