* [asm-generic:master 4/6] lib/iomap.c:198:48: warning: passing argument 1 of 'mmio_insb' discards 'const' qualifier from pointer target type
@ 2019-02-18 18:20 kbuild test robot
2019-02-18 21:17 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2019-02-18 18:20 UTC (permalink / raw)
To: Hugo Lefeuvre; +Cc: kbuild-all, linux-arch, Arnd Bergmann
[-- Attachment #1: Type: text/plain, Size: 13962 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git master
head: 3c4fcc2648569c3fe573849f9254c8c3499ec648
commit: 6ce9e34a28174293927e0b51acc4d30a130a565a [4/6] iomap: add missing const to ioread*/iowrite addr arg
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 8.2.0-11) 8.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 6ce9e34a28174293927e0b51acc4d30a130a565a
# save the attached .config to linux build tree
GCC_VERSION=8.2.0 make.cross ARCH=mips
All warnings (new ones prefixed by >>):
lib/iomap.c: In function 'ioread8_rep':
>> lib/iomap.c:198:48: warning: passing argument 1 of 'mmio_insb' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
IO_COND(addr, insb(port,dst,count), mmio_insb(addr, dst, count));
^~~~
lib/iomap.c:54:3: note: in definition of macro 'IO_COND'
is_mmio; \
^~~~~~~
lib/iomap.c:146:44: note: expected 'void *' but argument is of type 'const void *'
static inline void mmio_insb(void __iomem *addr, u8 *dst, int count)
~~~~~~~~~~~~~~^~~~
lib/iomap.c: In function 'ioread16_rep':
>> lib/iomap.c:202:48: warning: passing argument 1 of 'mmio_insw' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
IO_COND(addr, insw(port,dst,count), mmio_insw(addr, dst, count));
^~~~
lib/iomap.c:54:3: note: in definition of macro 'IO_COND'
is_mmio; \
^~~~~~~
lib/iomap.c:154:44: note: expected 'void *' but argument is of type 'const void *'
static inline void mmio_insw(void __iomem *addr, u16 *dst, int count)
~~~~~~~~~~~~~~^~~~
lib/iomap.c: In function 'ioread32_rep':
>> lib/iomap.c:206:48: warning: passing argument 1 of 'mmio_insl' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
IO_COND(addr, insl(port,dst,count), mmio_insl(addr, dst, count));
^~~~
lib/iomap.c:54:3: note: in definition of macro 'IO_COND'
is_mmio; \
^~~~~~~
lib/iomap.c:162:44: note: expected 'void *' but argument is of type 'const void *'
static inline void mmio_insl(void __iomem *addr, u32 *dst, int count)
~~~~~~~~~~~~~~^~~~
vim +198 lib/iomap.c
6cbf0c70 Linus Torvalds 2007-05-04 47
^1da177e Linus Torvalds 2005-04-16 48 /*
^1da177e Linus Torvalds 2005-04-16 49 * Ugly macros are a way of life.
^1da177e Linus Torvalds 2005-04-16 50 */
^1da177e Linus Torvalds 2005-04-16 51 #define IO_COND(addr, is_pio, is_mmio) do { \
^1da177e Linus Torvalds 2005-04-16 52 unsigned long port = (unsigned long __force)addr; \
6cbf0c70 Linus Torvalds 2007-05-04 53 if (port >= PIO_RESERVED) { \
6cbf0c70 Linus Torvalds 2007-05-04 @54 is_mmio; \
6cbf0c70 Linus Torvalds 2007-05-04 55 } else if (port > PIO_OFFSET) { \
^1da177e Linus Torvalds 2005-04-16 56 port &= PIO_MASK; \
^1da177e Linus Torvalds 2005-04-16 57 is_pio; \
6cbf0c70 Linus Torvalds 2007-05-04 58 } else \
6cbf0c70 Linus Torvalds 2007-05-04 59 bad_io_access(port, #is_pio ); \
^1da177e Linus Torvalds 2005-04-16 60 } while (0)
^1da177e Linus Torvalds 2005-04-16 61
34ba8a5c Linus Torvalds 2006-11-11 62 #ifndef pio_read16be
34ba8a5c Linus Torvalds 2006-11-11 63 #define pio_read16be(port) swab16(inw(port))
34ba8a5c Linus Torvalds 2006-11-11 64 #define pio_read32be(port) swab32(inl(port))
34ba8a5c Linus Torvalds 2006-11-11 65 #endif
34ba8a5c Linus Torvalds 2006-11-11 66
34ba8a5c Linus Torvalds 2006-11-11 67 #ifndef mmio_read16be
34ba8a5c Linus Torvalds 2006-11-11 68 #define mmio_read16be(addr) be16_to_cpu(__raw_readw(addr))
34ba8a5c Linus Torvalds 2006-11-11 69 #define mmio_read32be(addr) be32_to_cpu(__raw_readl(addr))
34ba8a5c Linus Torvalds 2006-11-11 70 #endif
34ba8a5c Linus Torvalds 2006-11-11 71
6ce9e34a Hugo Lefeuvre 2019-02-18 72 unsigned int ioread8(const void __iomem *addr)
^1da177e Linus Torvalds 2005-04-16 73 {
^1da177e Linus Torvalds 2005-04-16 74 IO_COND(addr, return inb(port), return readb(addr));
6cbf0c70 Linus Torvalds 2007-05-04 75 return 0xff;
^1da177e Linus Torvalds 2005-04-16 76 }
6ce9e34a Hugo Lefeuvre 2019-02-18 77 unsigned int ioread16(const void __iomem *addr)
^1da177e Linus Torvalds 2005-04-16 78 {
^1da177e Linus Torvalds 2005-04-16 79 IO_COND(addr, return inw(port), return readw(addr));
6cbf0c70 Linus Torvalds 2007-05-04 80 return 0xffff;
^1da177e Linus Torvalds 2005-04-16 81 }
6ce9e34a Hugo Lefeuvre 2019-02-18 82 unsigned int ioread16be(const void __iomem *addr)
dae409a2 James Bottomley 2005-04-16 83 {
34ba8a5c Linus Torvalds 2006-11-11 84 IO_COND(addr, return pio_read16be(port), return mmio_read16be(addr));
6cbf0c70 Linus Torvalds 2007-05-04 85 return 0xffff;
dae409a2 James Bottomley 2005-04-16 86 }
6ce9e34a Hugo Lefeuvre 2019-02-18 87 unsigned int ioread32(const void __iomem *addr)
^1da177e Linus Torvalds 2005-04-16 88 {
^1da177e Linus Torvalds 2005-04-16 89 IO_COND(addr, return inl(port), return readl(addr));
6cbf0c70 Linus Torvalds 2007-05-04 90 return 0xffffffff;
^1da177e Linus Torvalds 2005-04-16 91 }
6ce9e34a Hugo Lefeuvre 2019-02-18 92 unsigned int ioread32be(const void __iomem *addr)
dae409a2 James Bottomley 2005-04-16 93 {
34ba8a5c Linus Torvalds 2006-11-11 94 IO_COND(addr, return pio_read32be(port), return mmio_read32be(addr));
6cbf0c70 Linus Torvalds 2007-05-04 95 return 0xffffffff;
dae409a2 James Bottomley 2005-04-16 96 }
^1da177e Linus Torvalds 2005-04-16 97 EXPORT_SYMBOL(ioread8);
^1da177e Linus Torvalds 2005-04-16 98 EXPORT_SYMBOL(ioread16);
dae409a2 James Bottomley 2005-04-16 99 EXPORT_SYMBOL(ioread16be);
^1da177e Linus Torvalds 2005-04-16 100 EXPORT_SYMBOL(ioread32);
dae409a2 James Bottomley 2005-04-16 101 EXPORT_SYMBOL(ioread32be);
^1da177e Linus Torvalds 2005-04-16 102
34ba8a5c Linus Torvalds 2006-11-11 103 #ifndef pio_write16be
34ba8a5c Linus Torvalds 2006-11-11 104 #define pio_write16be(val,port) outw(swab16(val),port)
34ba8a5c Linus Torvalds 2006-11-11 105 #define pio_write32be(val,port) outl(swab32(val),port)
34ba8a5c Linus Torvalds 2006-11-11 106 #endif
34ba8a5c Linus Torvalds 2006-11-11 107
34ba8a5c Linus Torvalds 2006-11-11 108 #ifndef mmio_write16be
34ba8a5c Linus Torvalds 2006-11-11 109 #define mmio_write16be(val,port) __raw_writew(be16_to_cpu(val),port)
34ba8a5c Linus Torvalds 2006-11-11 110 #define mmio_write32be(val,port) __raw_writel(be32_to_cpu(val),port)
34ba8a5c Linus Torvalds 2006-11-11 111 #endif
34ba8a5c Linus Torvalds 2006-11-11 112
9f741cb8 Harvey Harrison 2008-02-08 113 void iowrite8(u8 val, void __iomem *addr)
^1da177e Linus Torvalds 2005-04-16 114 {
^1da177e Linus Torvalds 2005-04-16 115 IO_COND(addr, outb(val,port), writeb(val, addr));
^1da177e Linus Torvalds 2005-04-16 116 }
9f741cb8 Harvey Harrison 2008-02-08 117 void iowrite16(u16 val, void __iomem *addr)
^1da177e Linus Torvalds 2005-04-16 118 {
^1da177e Linus Torvalds 2005-04-16 119 IO_COND(addr, outw(val,port), writew(val, addr));
^1da177e Linus Torvalds 2005-04-16 120 }
9f741cb8 Harvey Harrison 2008-02-08 121 void iowrite16be(u16 val, void __iomem *addr)
dae409a2 James Bottomley 2005-04-16 122 {
34ba8a5c Linus Torvalds 2006-11-11 123 IO_COND(addr, pio_write16be(val,port), mmio_write16be(val, addr));
dae409a2 James Bottomley 2005-04-16 124 }
9f741cb8 Harvey Harrison 2008-02-08 125 void iowrite32(u32 val, void __iomem *addr)
^1da177e Linus Torvalds 2005-04-16 126 {
^1da177e Linus Torvalds 2005-04-16 127 IO_COND(addr, outl(val,port), writel(val, addr));
^1da177e Linus Torvalds 2005-04-16 128 }
9f741cb8 Harvey Harrison 2008-02-08 129 void iowrite32be(u32 val, void __iomem *addr)
dae409a2 James Bottomley 2005-04-16 130 {
34ba8a5c Linus Torvalds 2006-11-11 131 IO_COND(addr, pio_write32be(val,port), mmio_write32be(val, addr));
dae409a2 James Bottomley 2005-04-16 132 }
^1da177e Linus Torvalds 2005-04-16 133 EXPORT_SYMBOL(iowrite8);
^1da177e Linus Torvalds 2005-04-16 134 EXPORT_SYMBOL(iowrite16);
dae409a2 James Bottomley 2005-04-16 135 EXPORT_SYMBOL(iowrite16be);
^1da177e Linus Torvalds 2005-04-16 136 EXPORT_SYMBOL(iowrite32);
dae409a2 James Bottomley 2005-04-16 137 EXPORT_SYMBOL(iowrite32be);
^1da177e Linus Torvalds 2005-04-16 138
^1da177e Linus Torvalds 2005-04-16 139 /*
^1da177e Linus Torvalds 2005-04-16 140 * These are the "repeat MMIO read/write" functions.
^1da177e Linus Torvalds 2005-04-16 141 * Note the "__raw" accesses, since we don't want to
^1da177e Linus Torvalds 2005-04-16 142 * convert to CPU byte order. We write in "IO byte
^1da177e Linus Torvalds 2005-04-16 143 * order" (we also don't have IO barriers).
^1da177e Linus Torvalds 2005-04-16 144 */
34ba8a5c Linus Torvalds 2006-11-11 145 #ifndef mmio_insb
^1da177e Linus Torvalds 2005-04-16 146 static inline void mmio_insb(void __iomem *addr, u8 *dst, int count)
^1da177e Linus Torvalds 2005-04-16 147 {
^1da177e Linus Torvalds 2005-04-16 148 while (--count >= 0) {
^1da177e Linus Torvalds 2005-04-16 149 u8 data = __raw_readb(addr);
^1da177e Linus Torvalds 2005-04-16 150 *dst = data;
^1da177e Linus Torvalds 2005-04-16 151 dst++;
^1da177e Linus Torvalds 2005-04-16 152 }
^1da177e Linus Torvalds 2005-04-16 153 }
^1da177e Linus Torvalds 2005-04-16 154 static inline void mmio_insw(void __iomem *addr, u16 *dst, int count)
^1da177e Linus Torvalds 2005-04-16 155 {
^1da177e Linus Torvalds 2005-04-16 156 while (--count >= 0) {
^1da177e Linus Torvalds 2005-04-16 157 u16 data = __raw_readw(addr);
^1da177e Linus Torvalds 2005-04-16 158 *dst = data;
^1da177e Linus Torvalds 2005-04-16 159 dst++;
^1da177e Linus Torvalds 2005-04-16 160 }
^1da177e Linus Torvalds 2005-04-16 161 }
^1da177e Linus Torvalds 2005-04-16 162 static inline void mmio_insl(void __iomem *addr, u32 *dst, int count)
^1da177e Linus Torvalds 2005-04-16 163 {
^1da177e Linus Torvalds 2005-04-16 164 while (--count >= 0) {
^1da177e Linus Torvalds 2005-04-16 165 u32 data = __raw_readl(addr);
^1da177e Linus Torvalds 2005-04-16 166 *dst = data;
^1da177e Linus Torvalds 2005-04-16 167 dst++;
^1da177e Linus Torvalds 2005-04-16 168 }
^1da177e Linus Torvalds 2005-04-16 169 }
34ba8a5c Linus Torvalds 2006-11-11 170 #endif
^1da177e Linus Torvalds 2005-04-16 171
34ba8a5c Linus Torvalds 2006-11-11 172 #ifndef mmio_outsb
^1da177e Linus Torvalds 2005-04-16 173 static inline void mmio_outsb(void __iomem *addr, const u8 *src, int count)
^1da177e Linus Torvalds 2005-04-16 174 {
^1da177e Linus Torvalds 2005-04-16 175 while (--count >= 0) {
^1da177e Linus Torvalds 2005-04-16 176 __raw_writeb(*src, addr);
^1da177e Linus Torvalds 2005-04-16 177 src++;
^1da177e Linus Torvalds 2005-04-16 178 }
^1da177e Linus Torvalds 2005-04-16 179 }
^1da177e Linus Torvalds 2005-04-16 180 static inline void mmio_outsw(void __iomem *addr, const u16 *src, int count)
^1da177e Linus Torvalds 2005-04-16 181 {
^1da177e Linus Torvalds 2005-04-16 182 while (--count >= 0) {
^1da177e Linus Torvalds 2005-04-16 183 __raw_writew(*src, addr);
^1da177e Linus Torvalds 2005-04-16 184 src++;
^1da177e Linus Torvalds 2005-04-16 185 }
^1da177e Linus Torvalds 2005-04-16 186 }
^1da177e Linus Torvalds 2005-04-16 187 static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count)
^1da177e Linus Torvalds 2005-04-16 188 {
^1da177e Linus Torvalds 2005-04-16 189 while (--count >= 0) {
^1da177e Linus Torvalds 2005-04-16 190 __raw_writel(*src, addr);
^1da177e Linus Torvalds 2005-04-16 191 src++;
^1da177e Linus Torvalds 2005-04-16 192 }
^1da177e Linus Torvalds 2005-04-16 193 }
34ba8a5c Linus Torvalds 2006-11-11 194 #endif
^1da177e Linus Torvalds 2005-04-16 195
6ce9e34a Hugo Lefeuvre 2019-02-18 196 void ioread8_rep(const void __iomem *addr, void *dst, unsigned long count)
^1da177e Linus Torvalds 2005-04-16 197 {
^1da177e Linus Torvalds 2005-04-16 @198 IO_COND(addr, insb(port,dst,count), mmio_insb(addr, dst, count));
^1da177e Linus Torvalds 2005-04-16 199 }
6ce9e34a Hugo Lefeuvre 2019-02-18 200 void ioread16_rep(const void __iomem *addr, void *dst, unsigned long count)
^1da177e Linus Torvalds 2005-04-16 201 {
^1da177e Linus Torvalds 2005-04-16 @202 IO_COND(addr, insw(port,dst,count), mmio_insw(addr, dst, count));
^1da177e Linus Torvalds 2005-04-16 203 }
6ce9e34a Hugo Lefeuvre 2019-02-18 204 void ioread32_rep(const void __iomem *addr, void *dst, unsigned long count)
^1da177e Linus Torvalds 2005-04-16 205 {
^1da177e Linus Torvalds 2005-04-16 @206 IO_COND(addr, insl(port,dst,count), mmio_insl(addr, dst, count));
^1da177e Linus Torvalds 2005-04-16 207 }
^1da177e Linus Torvalds 2005-04-16 208 EXPORT_SYMBOL(ioread8_rep);
^1da177e Linus Torvalds 2005-04-16 209 EXPORT_SYMBOL(ioread16_rep);
^1da177e Linus Torvalds 2005-04-16 210 EXPORT_SYMBOL(ioread32_rep);
^1da177e Linus Torvalds 2005-04-16 211
:::::: The code at line 198 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 58759 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [asm-generic:master 4/6] lib/iomap.c:198:48: warning: passing argument 1 of 'mmio_insb' discards 'const' qualifier from pointer target type
2019-02-18 18:20 [asm-generic:master 4/6] lib/iomap.c:198:48: warning: passing argument 1 of 'mmio_insb' discards 'const' qualifier from pointer target type kbuild test robot
@ 2019-02-18 21:17 ` Arnd Bergmann
2019-02-18 21:59 ` Hugo Lefeuvre
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2019-02-18 21:17 UTC (permalink / raw)
To: kbuild test robot; +Cc: Hugo Lefeuvre, kbuild-all, linux-arch
On Mon, Feb 18, 2019 at 7:20 PM kbuild test robot <lkp@intel.com> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git master
> head: 3c4fcc2648569c3fe573849f9254c8c3499ec648
> commit: 6ce9e34a28174293927e0b51acc4d30a130a565a [4/6] iomap: add missing const to ioread*/iowrite addr arg
> config: mips-allyesconfig (attached as .config)
> compiler: mips-linux-gnu-gcc (Debian 8.2.0-11) 8.2.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout 6ce9e34a28174293927e0b51acc4d30a130a565a
> # save the attached .config to linux build tree
> GCC_VERSION=8.2.0 make.cross ARCH=mips
>
> All warnings (new ones prefixed by >>):
>
> lib/iomap.c: In function 'ioread8_rep':
> >> lib/iomap.c:198:48: warning: passing argument 1 of 'mmio_insb' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
> IO_COND(addr, insb(port,dst,count), mmio_insb(addr, dst, count));
> ^~~~
> lib/iomap.c:54:3: note: in definition of macro 'IO_COND'
> is_mmio; \
> ^~~~~~~
> lib/iomap.c:146:44: note: expected 'void *' but argument is of type 'const void *'
> static inline void mmio_insb(void __iomem *addr, u8 *dst, int count)
> ~~~~~~~~~~~~~~^~~~
It seems to be a result of applying the patches in the wrong order, in
particular
'iomap: add missing const to ioread*/iowrite addr arg' before 'lib/iomap: add
missing const to mmio_ins* addr arg'. I've swapped them around now
and uploaded the new branch.
Hugo, could you check
git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git
that it still makes sense to you?
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [asm-generic:master 4/6] lib/iomap.c:198:48: warning: passing argument 1 of 'mmio_insb' discards 'const' qualifier from pointer target type
2019-02-18 21:17 ` Arnd Bergmann
@ 2019-02-18 21:59 ` Hugo Lefeuvre
0 siblings, 0 replies; 3+ messages in thread
From: Hugo Lefeuvre @ 2019-02-18 21:59 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: kbuild test robot, kbuild-all, linux-arch
> It seems to be a result of applying the patches in the wrong order, in
> particular
> 'iomap: add missing const to ioread*/iowrite addr arg' before 'lib/iomap: add
> missing const to mmio_ins* addr arg'. I've swapped them around now
> and uploaded the new branch.
>
> Hugo, could you check
> git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git
> that it still makes sense to you?
Agree. However the first error will require an additional patch. ioread()
definitions from arch/ almost always omit the const[0], leading to
conflicting types...
I guess we should just add the missing const to arch/ definitions. The
patch is very simple anyways... Should I submit it separately or update the
applied patch set?
[0] https://elixir.bootlin.com/linux/latest/ident/ioread32
--
Hugo Lefeuvre (hle) | www.owl.eu.com
RSA4096_ 360B 03B3 BF27 4F4D 7A3F D5E8 14AA 1EB8 A247 3DFD
ed25519_ 37B2 6D38 0B25 B8A2 6B9F 3A65 A36F 5357 5F2D DC4C
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-18 21:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-18 18:20 [asm-generic:master 4/6] lib/iomap.c:198:48: warning: passing argument 1 of 'mmio_insb' discards 'const' qualifier from pointer target type kbuild test robot
2019-02-18 21:17 ` Arnd Bergmann
2019-02-18 21:59 ` Hugo Lefeuvre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox