Skip to contentSkip to conversation

drivers/pci/controller/pci-aardvark.c:350:2: error: implicit declaration of function 'gpiod_set_value_cansleep'

DISCUSSION kernel test robot 2 participants 2 messages Jun 21, 2020 – Jun 22, 2020

Subsystems (3)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8b6ddd10d678bebec32381f71b6b420bafc43ad0
commit: 5169a9851daaa2782a7bd2bb83d5b1bd224b2879 PCI: aardvark: Issue PERST via GPIO
date:   5 weeks ago
config: s390-randconfig-r001-20200621 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project ef455a55bcf2cfea04a99c361b182ad18b7f03f1)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390-linux-gnu
git checkout 5169a9851daaa2782a7bd2bb83d5b1bd224b2879
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:19:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x000000ffUL) << 24) |            \
                     ^
   In file included from drivers/pci/controller/pci-aardvark.c:14:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:492:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:20:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |            \
                     ^
   In file included from drivers/pci/controller/pci-aardvark.c:14:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:492:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:21:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |            \
                     ^
   In file included from drivers/pci/controller/pci-aardvark.c:14:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:492:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:22:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
                     ^
   In file included from drivers/pci/controller/pci-aardvark.c:14:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:492:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:120:12: note: expanded from macro '__swab32'
           __fswab32(x))
                     ^
   In file included from drivers/pci/controller/pci-aardvark.c:14:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:72:
   include/asm-generic/io.h:503:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:513:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
                                            ~~~~~~~~~~ ^
   include/asm-generic/io.h:523:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
                                            ~~~~~~~~~~ ^
   include/asm-generic/io.h:585:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:593:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:601:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:610:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:619:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:628:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> drivers/pci/controller/pci-aardvark.c:350:2: error: implicit declaration of function 'gpiod_set_value_cansleep' [-Werror,-Wimplicit-function-declaration]
           gpiod_set_value_cansleep(pcie->reset_gpio, 1);
           ^
   drivers/pci/controller/pci-aardvark.c:350:2: note: did you mean 'gpio_set_value_cansleep'?
   include/linux/gpio.h:188:20: note: 'gpio_set_value_cansleep' declared here
   static inline void gpio_set_value_cansleep(unsigned gpio, int value)
                      ^
>> drivers/pci/controller/pci-aardvark.c:1074:21: error: implicit declaration of function 'devm_gpiod_get_from_of_node' [-Werror,-Wimplicit-function-declaration]
           pcie->reset_gpio = devm_gpiod_get_from_of_node(dev, dev->of_node,
                              ^
>> drivers/pci/controller/pci-aardvark.c:1076:14: error: use of undeclared identifier 'GPIOD_OUT_LOW'
                                                          GPIOD_OUT_LOW,
                                                          ^

20 warnings and 3 errors generated.

vim +/gpiod_set_value_cansleep +350 drivers/pci/controller/pci-aardvark.c

335
336 static void advk_pcie_issue_perst(struct advk_pcie *pcie)
337 {
338 u32 reg;
339
340 if (!pcie->reset_gpio)
341 return;
342
343 /* PERST does not work for some cards when link training is enabled */
344 reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG);
345 reg &= ~LINK_TRAINING_EN;
346 advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG);
347
348 /* 10ms delay is needed for some cards */
349 dev_info(&pcie->pdev->dev, "issuing PERST via reset GPIO for 10ms\n");

 > 350		gpiod_set_value_cansleep(pcie->reset_gpio, 1);

351 usleep_range(10000, 11000);
352 gpiod_set_value_cansleep(pcie->reset_gpio, 0);
353 }
354

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

maintainer
#1 lore raw
Quoted 32 lines · On Sunday 21 June 2020 11:05:22 kernel test robot wrote:
Quoted 1 line
Quoted 1 line

drivers/pci/controller/pci-aardvark.c:350:2: error: implicit declaration of function 'gpiod_set_value_cansleep' [-Werror,-Wimplicit-function-declaration]

           gpiod_set_value_cansleep(pcie->reset_gpio, 1);
           ^
   drivers/pci/controller/pci-aardvark.c:350:2: note: did you mean 'gpio_set_value_cansleep'?
   include/linux/gpio.h:188:20: note: 'gpio_set_value_cansleep' declared here
   static inline void gpio_set_value_cansleep(unsigned gpio, int value)
                      ^
Quoted 1 line
Quoted 1 line

drivers/pci/controller/pci-aardvark.c:1074:21: error: implicit declaration of function 'devm_gpiod_get_from_of_node' [-Werror,-Wimplicit-function-declaration]

           pcie->reset_gpio = devm_gpiod_get_from_of_node(dev, dev->of_node,
                              ^
Quoted 1 line
Quoted 1 line

drivers/pci/controller/pci-aardvark.c:1076:14: error: use of undeclared identifier 'GPIOD_OUT_LOW'

                                                          GPIOD_OUT_LOW,
                                                          ^

20 warnings and 3 errors generated.

vim +/gpiod_set_value_cansleep +350 drivers/pci/controller/pci-aardvark.c

   335	
   336	static void advk_pcie_issue_perst(struct advk_pcie *pcie)
   337	{
   338		u32 reg;
   339	
   340		if (!pcie->reset_gpio)
   341			return;
   342	
   343		/* PERST does not work for some cards when link training is enabled */
   344		reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG);
   345		reg &= ~LINK_TRAINING_EN;
   346		advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG);
   347	
   348		/* 10ms delay is needed for some cards */
   349		dev_info(&pcie->pdev->dev, "issuing PERST via reset GPIO for 10ms\n");
Quoted 5 lines
Quoted 1 line

350 gpiod_set_value_cansleep(pcie->reset_gpio, 1);

   351		usleep_range(10000, 11000);
   352		gpiod_set_value_cansleep(pcie->reset_gpio, 0);
   353	}
   354	

Hello!

Could you try to test following patch if it fixes above problems?

drivers/pci/controller/pci-aardvark.c +1 -0
index 90ff291c24f0..01f1fcbb8770 100644
@@ -10,6 +10,7 @@
 
 #include <linux/delay.h>
 #include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/irqdomain.h>

Both GPIOD_OUT_LOW and gpiod_set_value_cansleep() are defined in linux/gpio/consumer.h header file.

I do not have s390 box nor s390 cross compiler to do verification.