linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/tty/serial/8250/8250_dwlib.c:45:17: sparse: sparse: incorrect type in argument 1 (different base types)
@ 2020-06-18 12:10 kernel test robot
  2020-06-22 11:42 ` [PATCH] fix annotation of io{read,write}{16,32}be() Luc Van Oostenryck
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2020-06-18 12:10 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kbuild-all, linux-kernel, Greg Kroah-Hartman, Heikki Krogerus

[-- Attachment #1: Type: text/plain, Size: 3199 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   1b5044021070efa3259f3e9548dc35d1eb6aa844
commit: 4d5675c3b10b7bfa56447c26c29930e35b6d41ee serial: 8250_dw: switch to use 8250_dwlib library
date:   10 months ago
config: alpha-randconfig-s032-20200618 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-rc1-10-gc17b1b06-dirty
        git checkout 4d5675c3b10b7bfa56447c26c29930e35b6d41ee
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=alpha CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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


sparse warnings: (new ones prefixed by >>)

>> drivers/tty/serial/8250/8250_dwlib.c:45:17: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] @@     got restricted __be32 [usertype] @@
>> drivers/tty/serial/8250/8250_dwlib.c:45:17: sparse:     expected unsigned int [usertype]
   drivers/tty/serial/8250/8250_dwlib.c:45:17: sparse:     got restricted __be32 [usertype]
   arch/alpha/include/uapi/asm/swab.h:29:14: sparse: sparse: undefined identifier '__builtin_alpha_inslh'
   arch/alpha/include/uapi/asm/swab.h:30:14: sparse: sparse: undefined identifier '__builtin_alpha_inswl'
   arch/alpha/include/uapi/asm/swab.h:29:14: sparse: sparse: not a function <noident>
   arch/alpha/include/uapi/asm/swab.h:30:14: sparse: sparse: not a function <noident>
   arch/alpha/include/uapi/asm/swab.h:29:14: sparse: sparse: not a function <noident>
   arch/alpha/include/uapi/asm/swab.h:30:14: sparse: sparse: not a function <noident>
   arch/alpha/include/asm/bitops.h:380:13: sparse: sparse: undefined identifier '__builtin_alpha_cmpbge'
   arch/alpha/include/asm/bitops.h:382:13: sparse: sparse: undefined identifier '__builtin_alpha_extbl'
   arch/alpha/include/uapi/asm/swab.h:29:14: sparse: sparse: not a function <noident>
   arch/alpha/include/uapi/asm/swab.h:30:14: sparse: sparse: not a function <noident>

vim +45 drivers/tty/serial/8250/8250_dwlib.c

136e0ab99b2237 Andy Shevchenko 2019-08-06  41  
136e0ab99b2237 Andy Shevchenko 2019-08-06  42  static inline void dw8250_writel_ext(struct uart_port *p, int offset, u32 reg)
136e0ab99b2237 Andy Shevchenko 2019-08-06  43  {
136e0ab99b2237 Andy Shevchenko 2019-08-06  44  	if (p->iotype == UPIO_MEM32BE)
136e0ab99b2237 Andy Shevchenko 2019-08-06 @45  		iowrite32be(reg, p->membase + offset);
136e0ab99b2237 Andy Shevchenko 2019-08-06  46  	else
136e0ab99b2237 Andy Shevchenko 2019-08-06  47  		writel(reg, p->membase + offset);
136e0ab99b2237 Andy Shevchenko 2019-08-06  48  }
136e0ab99b2237 Andy Shevchenko 2019-08-06  49  

:::::: The code at line 45 was first introduced by commit
:::::: 136e0ab99b22378e3ff7d54f799a3a329316e869 serial: 8250_dw: split Synopsys DesignWare 8250 common functions

:::::: TO: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 24520 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] fix annotation of io{read,write}{16,32}be()
  2020-06-18 12:10 drivers/tty/serial/8250/8250_dwlib.c:45:17: sparse: sparse: incorrect type in argument 1 (different base types) kernel test robot
@ 2020-06-22 11:42 ` Luc Van Oostenryck
  0 siblings, 0 replies; 2+ messages in thread
From: Luc Van Oostenryck @ 2020-06-22 11:42 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Stephen Boyd,
	Arnd Bergmann, Luc Van Oostenryck, kernel test robot

These accessors must be used to read/write a big-endian bus.
The value returned or written is native-endian.

However, these accessors are defined using be{16,32}_to_cpu()
or cpu_to_be{16,32}() to make the endian conversion but these
expect a __be{16,32} when none is present. Keeping them would
need a force cast that would solve nothing at all.

So, do the conversion using swab{16,32}, like done in asm-generic
for similar situations.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 arch/alpha/include/asm/io.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
index a4d0c19f1e79..640e1a2f57b4 100644
--- a/arch/alpha/include/asm/io.h
+++ b/arch/alpha/include/asm/io.h
@@ -489,10 +489,10 @@ extern inline void writeq(u64 b, volatile void __iomem *addr)
 }
 #endif
 
-#define ioread16be(p) be16_to_cpu(ioread16(p))
-#define ioread32be(p) be32_to_cpu(ioread32(p))
-#define iowrite16be(v,p) iowrite16(cpu_to_be16(v), (p))
-#define iowrite32be(v,p) iowrite32(cpu_to_be32(v), (p))
+#define ioread16be(p) swab16(ioread16(p))
+#define ioread32be(p) swab32(ioread32(p))
+#define iowrite16be(v,p) iowrite16(swab16(v), (p))
+#define iowrite32be(v,p) iowrite32(swab32(v), (p))
 
 #define inb_p		inb
 #define inw_p		inw
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-22 11:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 12:10 drivers/tty/serial/8250/8250_dwlib.c:45:17: sparse: sparse: incorrect type in argument 1 (different base types) kernel test robot
2020-06-22 11:42 ` [PATCH] fix annotation of io{read,write}{16,32}be() Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).