drivers/spi/spi-lp8841-rtc.c:63:28: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Mon May 10 2021 - 08:37:06 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6efb943b8616ec53a5e444193dccf1af9ad627b5
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date: 9 months ago
config: alpha-randconfig-s032-20210510 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=alpha

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


sparse warnings: (new ones prefixed by >>)
drivers/spi/spi-lp8841-rtc.c:112:41: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *iomem @@
drivers/spi/spi-lp8841-rtc.c:112:41: sparse: expected void volatile [noderef] __iomem *addr
drivers/spi/spi-lp8841-rtc.c:112:41: sparse: got void *iomem
drivers/spi/spi-lp8841-rtc.c:121:41: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *iomem @@
drivers/spi/spi-lp8841-rtc.c:121:41: sparse: expected void volatile [noderef] __iomem *addr
drivers/spi/spi-lp8841-rtc.c:121:41: sparse: got void *iomem
drivers/spi/spi-lp8841-rtc.c:143:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *iomem @@
drivers/spi/spi-lp8841-rtc.c:143:33: sparse: expected void volatile [noderef] __iomem *addr
drivers/spi/spi-lp8841-rtc.c:143:33: sparse: got void *iomem
drivers/spi/spi-lp8841-rtc.c:147:41: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *iomem @@
drivers/spi/spi-lp8841-rtc.c:147:41: sparse: expected void volatile [noderef] __iomem *addr
drivers/spi/spi-lp8841-rtc.c:147:41: sparse: got void *iomem
drivers/spi/spi-lp8841-rtc.c:209:21: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *iomem @@ got void [noderef] __iomem * @@
drivers/spi/spi-lp8841-rtc.c:209:21: sparse: expected void *iomem
drivers/spi/spi-lp8841-rtc.c:209:21: sparse: got void [noderef] __iomem *
drivers/spi/spi-lp8841-rtc.c:57:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *iomem @@
drivers/spi/spi-lp8841-rtc.c:57:33: sparse: expected void volatile [noderef] __iomem *addr
drivers/spi/spi-lp8841-rtc.c:57:33: sparse: got void *iomem
>> drivers/spi/spi-lp8841-rtc.c:63:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem *addr @@ got void *iomem @@
drivers/spi/spi-lp8841-rtc.c:63:28: sparse: expected void const [noderef] __iomem *addr
drivers/spi/spi-lp8841-rtc.c:63:28: sparse: got void *iomem
drivers/spi/spi-lp8841-rtc.c:47:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *iomem @@
drivers/spi/spi-lp8841-rtc.c:47:33: sparse: expected void volatile [noderef] __iomem *addr
drivers/spi/spi-lp8841-rtc.c:47:33: sparse: got void *iomem
drivers/spi/spi-lp8841-rtc.c:47:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *iomem @@
drivers/spi/spi-lp8841-rtc.c:47:33: sparse: expected void volatile [noderef] __iomem *addr
drivers/spi/spi-lp8841-rtc.c:47:33: sparse: got void *iomem
drivers/spi/spi-lp8841-rtc.c:57:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *iomem @@
drivers/spi/spi-lp8841-rtc.c:57:33: sparse: expected void volatile [noderef] __iomem *addr
drivers/spi/spi-lp8841-rtc.c:57:33: sparse: got void *iomem
>> drivers/spi/spi-lp8841-rtc.c:63:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem *addr @@ got void *iomem @@
drivers/spi/spi-lp8841-rtc.c:63:28: sparse: expected void const [noderef] __iomem *addr
drivers/spi/spi-lp8841-rtc.c:63:28: sparse: got void *iomem
drivers/spi/spi-lp8841-rtc.c:47:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *iomem @@
drivers/spi/spi-lp8841-rtc.c:47:33: sparse: expected void volatile [noderef] __iomem *addr
drivers/spi/spi-lp8841-rtc.c:47:33: sparse: got void *iomem
drivers/spi/spi-lp8841-rtc.c:47:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *iomem @@
drivers/spi/spi-lp8841-rtc.c:47:33: sparse: expected void volatile [noderef] __iomem *addr
drivers/spi/spi-lp8841-rtc.c:47:33: sparse: got void *iomem

vim +63 drivers/spi/spi-lp8841-rtc.c

7ecbfff6711fb3 Sergei Ianovich 2016-02-23 59
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 60 static inline int
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 61 getmiso(struct spi_lp8841_rtc *data)
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 62 {
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 @63 return ioread8(data->iomem) & SPI_LP8841_RTC_MISO;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 64 }
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 65
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 66 static inline u32
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 67 bitbang_txrx_be_cpha0_lsb(struct spi_lp8841_rtc *data,
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 68 unsigned usecs, unsigned cpol, unsigned flags,
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 69 u32 word, u8 bits)
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 70 {
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 71 /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 72
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 73 u32 shift = 32 - bits;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 74 /* clock starts at inactive polarity */
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 75 for (; likely(bits); bits--) {
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 76
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 77 /* setup LSB (to slave) on leading edge */
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 78 if ((flags & SPI_MASTER_NO_TX) == 0)
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 79 setmosi(data, (word & 1));
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 80
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 81 usleep_range(usecs, usecs + 1); /* T(setup) */
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 82
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 83 /* sample LSB (from slave) on trailing edge */
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 84 word >>= 1;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 85 if ((flags & SPI_MASTER_NO_RX) == 0)
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 86 word |= (getmiso(data) << 31);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 87
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 88 setsck(data, !cpol);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 89 usleep_range(usecs, usecs + 1);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 90
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 91 setsck(data, cpol);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 92 }
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 93
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 94 word >>= shift;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 95 return word;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 96 }
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 97
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 98 static int
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 99 spi_lp8841_rtc_transfer_one(struct spi_master *master,
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 100 struct spi_device *spi,
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 101 struct spi_transfer *t)
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 102 {
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 103 struct spi_lp8841_rtc *data = spi_master_get_devdata(master);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 104 unsigned count = t->len;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 105 const u8 *tx = t->tx_buf;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 106 u8 *rx = t->rx_buf;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 107 u8 word = 0;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 108 int ret = 0;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 109
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 110 if (tx) {
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 111 data->state &= ~SPI_LP8841_RTC_nWE;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 112 writeb(data->state, data->iomem);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 113 while (likely(count > 0)) {
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 114 word = *tx++;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 115 bitbang_txrx_be_cpha0_lsb(data, 1, 0,
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 116 SPI_MASTER_NO_RX, word, 8);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 117 count--;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 118 }
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 119 } else if (rx) {
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 120 data->state |= SPI_LP8841_RTC_nWE;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 121 writeb(data->state, data->iomem);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 122 while (likely(count > 0)) {
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 123 word = bitbang_txrx_be_cpha0_lsb(data, 1, 0,
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 124 SPI_MASTER_NO_TX, word, 8);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 125 *rx++ = word;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 126 count--;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 127 }
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 128 } else {
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 129 ret = -EINVAL;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 130 }
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 131
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 132 spi_finalize_current_transfer(master);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 133
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 134 return ret;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 135 }
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 136
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 137 static void
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 138 spi_lp8841_rtc_set_cs(struct spi_device *spi, bool enable)
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 139 {
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 140 struct spi_lp8841_rtc *data = spi_master_get_devdata(spi->master);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 141
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 142 data->state = 0;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 143 writeb(data->state, data->iomem);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 144 if (enable) {
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 145 usleep_range(4, 5);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 146 data->state |= SPI_LP8841_RTC_CE;
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 @147 writeb(data->state, data->iomem);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 148 usleep_range(4, 5);
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 149 }
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 150 }
7ecbfff6711fb3 Sergei Ianovich 2016-02-23 151

:::::: The code at line 63 was first introduced by commit
:::::: 7ecbfff6711fb331591003ac32c002ce55a0758f spi: master driver to enable RTC on ICPDAS LP-8841

:::::: TO: Sergei Ianovich <ynvich@xxxxxxxxx>
:::::: CC: Mark Brown <broonie@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip