Re: [PATCH SPI for-next 2/3] spi: mchp-pci1xxxx: DMA Read support for copying data into SPI Buf

From: kernel test robot
Date: Fri Dec 15 2023 - 20:18:11 EST


Hi Thangaraj,

kernel test robot noticed the following build warnings:

[auto build test WARNING on broonie-spi/for-next]
[also build test WARNING on linus/master v6.7-rc5 next-20231215]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Thangaraj-Samynathan/spi-mchp-pci1xxxx-Add-support-for-DMA-in-SPI/20231215-195133
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
patch link: https://lore.kernel.org/r/20231215114748.152319-3-thangaraj.s%40microchip.com
patch subject: [PATCH SPI for-next 2/3] spi: mchp-pci1xxxx: DMA Read support for copying data into SPI Buf
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20231216/202312160922.Eb2xnL8g-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231216/202312160922.Eb2xnL8g-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312160922.Eb2xnL8g-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/spi/spi-pci1xxxx.c: In function 'pci1xxxx_spi_transfer_one':
>> drivers/spi/spi-pci1xxxx.c:366:13: warning: variable 'mode' set but not used [-Wunused-but-set-variable]
366 | int mode, len, loop_iter, transfer_len;
| ^~~~


vim +/mode +366 drivers/spi/spi-pci1xxxx.c

bf37ce4603316bb Thangaraj Samynathan 2023-12-15 361
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 362 static int pci1xxxx_spi_transfer_one(struct spi_controller *spi_ctlr,
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 363 struct spi_device *spi, struct spi_transfer *xfer)
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 364 {
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 365 struct pci1xxxx_spi_internal *p = spi_controller_get_devdata(spi_ctlr);
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 @366 int mode, len, loop_iter, transfer_len;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 367 struct pci1xxxx_spi *par = p->parent;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 368 unsigned long bytes_transfered;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 369 unsigned long bytes_recvd;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 370 unsigned long loop_count;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 371 u8 *rx_buf, result;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 372 const u8 *tx_buf;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 373 u32 regval;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 374 u8 clkdiv;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 375
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 376 p->spi_xfer_in_progress = true;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 377 mode = spi->mode;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 378 clkdiv = pci1xxxx_get_clock_div(xfer->speed_hz);
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 379 tx_buf = xfer->tx_buf;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 380 rx_buf = xfer->rx_buf;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 381 transfer_len = xfer->len;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 382 regval = readl(par->reg_base + SPI_MST_EVENT_REG_OFFSET(p->hw_inst));
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 383 writel(regval, par->reg_base + SPI_MST_EVENT_REG_OFFSET(p->hw_inst));
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 384
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 385 if (tx_buf) {
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 386 bytes_transfered = 0;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 387 bytes_recvd = 0;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 388 loop_count = transfer_len / SPI_MAX_DATA_LEN;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 389 if (transfer_len % SPI_MAX_DATA_LEN != 0)
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 390 loop_count += 1;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 391
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 392 for (loop_iter = 0; loop_iter < loop_count; loop_iter++) {
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 393 len = SPI_MAX_DATA_LEN;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 394 if ((transfer_len % SPI_MAX_DATA_LEN != 0) &&
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 395 (loop_iter == loop_count - 1))
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 396 len = transfer_len % SPI_MAX_DATA_LEN;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 397
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 398 reinit_completion(&p->spi_xfer_done);
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 399 memcpy_toio(par->reg_base + SPI_MST_CMD_BUF_OFFSET(p->hw_inst),
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 400 &tx_buf[bytes_transfered], len);
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 401 bytes_transfered += len;
bf37ce4603316bb Thangaraj Samynathan 2023-12-15 402 pci1xxxx_spi_setup(par, p->hw_inst, spi->mode, clkdiv, len);
bf37ce4603316bb Thangaraj Samynathan 2023-12-15 403 pci1xxxx_start_spi_xfer(p, p->hw_inst);
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 404
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 405 /* Wait for DMA_TERM interrupt */
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 406 result = wait_for_completion_timeout(&p->spi_xfer_done,
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 407 PCI1XXXX_SPI_TIMEOUT);
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 408 if (!result)
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 409 return -ETIMEDOUT;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 410
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 411 if (rx_buf) {
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 412 memcpy_fromio(&rx_buf[bytes_recvd], par->reg_base +
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 413 SPI_MST_RSP_BUF_OFFSET(p->hw_inst), len);
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 414 bytes_recvd += len;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 415 }
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 416 }
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 417 }
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 418 p->spi_xfer_in_progress = false;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 419
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 420 return 0;
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 421 }
1cc0cbea7167af5 Tharun Kumar P 2022-10-06 422

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki