Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags

From: kernel test robot
Date: Tue Nov 24 2020 - 06:41:50 EST


Hi Alexandru,

I love your patch! Perhaps something to improve:

[auto build test WARNING on spi/for-next]
[also build test WARNING on next-20201123]
[cannot apply to v5.10-rc5]
[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/Alexandru-Ardelean/spi-convert-to-BIT-all-spi_device-flags/20201124-181801
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: i386-randconfig-a016-20201124 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/1d45734a72568cc2118c14f912affda571a5f9dc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alexandru-Ardelean/spi-convert-to-BIT-all-spi_device-flags/20201124-181801
git checkout 1d45734a72568cc2118c14f912affda571a5f9dc
# save the attached .config to linux build tree
make 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 >>):

In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/spi/spi-stm32.c:11:
drivers/spi/spi-stm32.c: In function 'stm32_spi_prepare_msg':
>> drivers/spi/spi-stm32.c:1030:20: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/spi/spi-stm32.c:1030:2: note: in expansion of macro 'dev_dbg'
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~
drivers/spi/spi-stm32.c:1030:27: note: format string is defined here
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ~^
| |
| int
| %ld
In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/spi/spi-stm32.c:11:
drivers/spi/spi-stm32.c:1030:20: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long unsigned int' [-Wformat=]
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/spi/spi-stm32.c:1030:2: note: in expansion of macro 'dev_dbg'
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~
drivers/spi/spi-stm32.c:1030:35: note: format string is defined here
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ~^
| |
| int
| %ld
In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/spi/spi-stm32.c:11:
drivers/spi/spi-stm32.c:1030:20: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long unsigned int' [-Wformat=]
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/spi/spi-stm32.c:1030:2: note: in expansion of macro 'dev_dbg'
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~
drivers/spi/spi-stm32.c:1030:48: note: format string is defined here
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ~^
| |
| int
| %ld
In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/spi/spi-stm32.c:11:
drivers/spi/spi-stm32.c:1030:20: warning: format '%d' expects argument of type 'int', but argument 7 has type 'long unsigned int' [-Wformat=]
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/spi/spi-stm32.c:1030:2: note: in expansion of macro 'dev_dbg'
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~
drivers/spi/spi-stm32.c:1030:59: note: format string is defined here
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ~^
| |
| int
| %ld

vim +1030 drivers/spi/spi-stm32.c

dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 995
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 996 /**
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 997 * stm32_spi_prepare_msg - set up the controller to transfer a single message
1c52be8bed83e1a Alain Volmat 2020-03-20 998 * @master: controller master interface
1c52be8bed83e1a Alain Volmat 2020-03-20 999 * @msg: pointer to spi message
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1000 */
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1001 static int stm32_spi_prepare_msg(struct spi_master *master,
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1002 struct spi_message *msg)
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1003 {
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1004 struct stm32_spi *spi = spi_master_get_devdata(master);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1005 struct spi_device *spi_dev = msg->spi;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1006 struct device_node *np = spi_dev->dev.of_node;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1007 unsigned long flags;
55166853b2f56ce Cezary Gapinski 2018-12-24 1008 u32 clrb = 0, setb = 0;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1009
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1010 /* SPI slave device may need time between data frames */
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1011 spi->cur_midi = 0;
042c1c60df7b854 Amelie Delaunay 2017-06-27 1012 if (np && !of_property_read_u32(np, "st,spi-midi-ns", &spi->cur_midi))
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1013 dev_dbg(spi->dev, "%dns inter-data idleness\n", spi->cur_midi);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1014
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1015 if (spi_dev->mode & SPI_CPOL)
55166853b2f56ce Cezary Gapinski 2018-12-24 1016 setb |= spi->cfg->regs->cpol.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1017 else
55166853b2f56ce Cezary Gapinski 2018-12-24 1018 clrb |= spi->cfg->regs->cpol.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1019
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1020 if (spi_dev->mode & SPI_CPHA)
55166853b2f56ce Cezary Gapinski 2018-12-24 1021 setb |= spi->cfg->regs->cpha.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1022 else
55166853b2f56ce Cezary Gapinski 2018-12-24 1023 clrb |= spi->cfg->regs->cpha.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1024
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1025 if (spi_dev->mode & SPI_LSB_FIRST)
55166853b2f56ce Cezary Gapinski 2018-12-24 1026 setb |= spi->cfg->regs->lsb_first.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1027 else
55166853b2f56ce Cezary Gapinski 2018-12-24 1028 clrb |= spi->cfg->regs->lsb_first.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1029
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 @1030 dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1031 spi_dev->mode & SPI_CPOL,
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1032 spi_dev->mode & SPI_CPHA,
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1033 spi_dev->mode & SPI_LSB_FIRST,
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1034 spi_dev->mode & SPI_CS_HIGH);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1035
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1036 spin_lock_irqsave(&spi->lock, flags);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1037
55166853b2f56ce Cezary Gapinski 2018-12-24 1038 /* CPOL, CPHA and LSB FIRST bits have common register */
55166853b2f56ce Cezary Gapinski 2018-12-24 1039 if (clrb || setb)
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1040 writel_relaxed(
55166853b2f56ce Cezary Gapinski 2018-12-24 1041 (readl_relaxed(spi->base + spi->cfg->regs->cpol.reg) &
55166853b2f56ce Cezary Gapinski 2018-12-24 1042 ~clrb) | setb,
55166853b2f56ce Cezary Gapinski 2018-12-24 1043 spi->base + spi->cfg->regs->cpol.reg);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1044
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1045 spin_unlock_irqrestore(&spi->lock, flags);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1046
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1047 return 0;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1048 }
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1049

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

Attachment: .config.gz
Description: application/gzip