[gpio:gpio-descriptors-spi 10/12] drivers//spi/spi-bcm2835.c:684:21: error: dereferencing pointer to incomplete type 'struct gpio_chip'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git gpio-descriptors-spi
head:   0150316e407fca7a2992be71c73054e4d1e9d1e4
commit: 43ec7fd6fbabdde336bb21cd09b940ad17e8a3ed [10/12] RFC: spi: bcm2835: Convert to use CS GPIO descriptors
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.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 43ec7fd6fbabdde336bb21cd09b940ad17e8a3ed
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=sh 

All error/warnings (new ones prefixed by >>):

>> drivers//spi/spi-bcm2835.c:682:35: warning: 'struct gpio_chip' declared inside parameter list will not be visible outside of this definition or declaration
    static int chip_match_name(struct gpio_chip *chip, void *data)
                                      ^~~~~~~~~
   drivers//spi/spi-bcm2835.c: In function 'chip_match_name':
>> drivers//spi/spi-bcm2835.c:684:21: error: dereferencing pointer to incomplete type 'struct gpio_chip'
     return !strcmp(chip->label, data);
                        ^~
   drivers//spi/spi-bcm2835.c: In function 'bcm2835_spi_setup':
>> drivers//spi/spi-bcm2835.c:723:9: error: implicit declaration of function 'gpiochip_find' [-Werror=implicit-function-declaration]
     chip = gpiochip_find("pinctrl-bcm2835", chip_match_name);
            ^~~~~~~~~~~~~
>> drivers//spi/spi-bcm2835.c:723:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     chip = gpiochip_find("pinctrl-bcm2835", chip_match_name);
          ^
>> drivers//spi/spi-bcm2835.c:728:68: error: expected ';' before ')' token
     flags = (spi->mode & SPI_CS_HIGH) ? GPIOD_OUT_LOW : GPIOD_OUT_HIGH);
                                                                       ^
>> drivers//spi/spi-bcm2835.c:728:68: error: expected statement before ')' token
>> drivers//spi/spi-bcm2835.c:729:18: error: implicit declaration of function 'gpiochip_request_own_desc' [-Werror=implicit-function-declaration]
     spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 + spi->chip_select,
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers//spi/spi-bcm2835.c:729:16: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 + spi->chip_select,
                   ^
   drivers//spi/spi-bcm2835.c:689:6: warning: unused variable 'err' [-Wunused-variable]
     int err;
         ^~~
   drivers//spi/spi-bcm2835.c: In function 'chip_match_name':
>> drivers//spi/spi-bcm2835.c:685:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^
   cc1: some warnings being treated as errors

vim +684 drivers//spi/spi-bcm2835.c

f8043872 Chris Boot    2013-03-11  681  
a30a555d Martin Sperl  2015-04-06 @682  static int chip_match_name(struct gpio_chip *chip, void *data)
a30a555d Martin Sperl  2015-04-06  683  {
a30a555d Martin Sperl  2015-04-06 @684  	return !strcmp(chip->label, data);
a30a555d Martin Sperl  2015-04-06 @685  }
a30a555d Martin Sperl  2015-04-06  686  
e34ff011 Martin Sperl  2015-03-26  687  static int bcm2835_spi_setup(struct spi_device *spi)
e34ff011 Martin Sperl  2015-03-26  688  {
a30a555d Martin Sperl  2015-04-06  689  	int err;
a30a555d Martin Sperl  2015-04-06  690  	struct gpio_chip *chip;
43ec7fd6 Linus Walleij 2018-12-14  691  	enum gpiod_flags flags;
e34ff011 Martin Sperl  2015-03-26  692  	/*
e34ff011 Martin Sperl  2015-03-26  693  	 * sanity checking the native-chipselects
e34ff011 Martin Sperl  2015-03-26  694  	 */
e34ff011 Martin Sperl  2015-03-26  695  	if (spi->mode & SPI_NO_CS)
e34ff011 Martin Sperl  2015-03-26  696  		return 0;
43ec7fd6 Linus Walleij 2018-12-14  697  	/*
43ec7fd6 Linus Walleij 2018-12-14  698  	 * The SPI core has successfully requested the CS GPIO line from the
43ec7fd6 Linus Walleij 2018-12-14  699  	 * device tree, so we are done.
43ec7fd6 Linus Walleij 2018-12-14  700  	 */
43ec7fd6 Linus Walleij 2018-12-14  701  	if (spi->cs_gpiod)
e34ff011 Martin Sperl  2015-03-26  702  		return 0;
a30a555d Martin Sperl  2015-04-06  703  	if (spi->chip_select > 1) {
a30a555d Martin Sperl  2015-04-06  704  		/* error in the case of native CS requested with CS > 1
a30a555d Martin Sperl  2015-04-06  705  		 * officially there is a CS2, but it is not documented
a30a555d Martin Sperl  2015-04-06  706  		 * which GPIO is connected with that...
a30a555d Martin Sperl  2015-04-06  707  		 */
a30a555d Martin Sperl  2015-04-06  708  		dev_err(&spi->dev,
a30a555d Martin Sperl  2015-04-06  709  			"setup: only two native chip-selects are supported\n");
a30a555d Martin Sperl  2015-04-06  710  		return -EINVAL;
a30a555d Martin Sperl  2015-04-06  711  	}
43ec7fd6 Linus Walleij 2018-12-14  712  
43ec7fd6 Linus Walleij 2018-12-14  713  	/*
43ec7fd6 Linus Walleij 2018-12-14  714  	 * Translate native CS to GPIO
43ec7fd6 Linus Walleij 2018-12-14  715  	 *
43ec7fd6 Linus Walleij 2018-12-14  716  	 * FIXME: poking around in the gpiolib internals like this is
43ec7fd6 Linus Walleij 2018-12-14  717  	 * not very good practice. Find a way to locate the real problem
43ec7fd6 Linus Walleij 2018-12-14  718  	 * and fix it. Why is the GPIO descriptor in spi->cs_gpiod
43ec7fd6 Linus Walleij 2018-12-14  719  	 * sometimes not assigned correctly? Erroneous device trees?
43ec7fd6 Linus Walleij 2018-12-14  720  	 */
a30a555d Martin Sperl  2015-04-06  721  
a30a555d Martin Sperl  2015-04-06  722  	/* get the gpio chip for the base */
a30a555d Martin Sperl  2015-04-06 @723  	chip = gpiochip_find("pinctrl-bcm2835", chip_match_name);
a30a555d Martin Sperl  2015-04-06  724  	if (!chip)
f8043872 Chris Boot    2013-03-11  725  		return 0;
e34ff011 Martin Sperl  2015-03-26  726  
a30a555d Martin Sperl  2015-04-06  727  	/* and calculate the real CS */
43ec7fd6 Linus Walleij 2018-12-14 @728  	flags = (spi->mode & SPI_CS_HIGH) ? GPIOD_OUT_LOW : GPIOD_OUT_HIGH);
43ec7fd6 Linus Walleij 2018-12-14 @729  	spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 + spi->chip_select,
43ec7fd6 Linus Walleij 2018-12-14  730  						  DRV_NAME,
43ec7fd6 Linus Walleij 2018-12-14  731  						  flags);
43ec7fd6 Linus Walleij 2018-12-14  732  	if (IS_ERR(spi->cs_gpiod))
43ec7fd6 Linus Walleij 2018-12-14  733  		return PTR_ERR(spi->cs_gpiod);
a30a555d Martin Sperl  2015-04-06  734  
a30a555d Martin Sperl  2015-04-06  735  	/* and set up the "mode" and level */
43ec7fd6 Linus Walleij 2018-12-14  736  	dev_info(&spi->dev, "FIXME: setting up native-CS%i as GPIO\n",
43ec7fd6 Linus Walleij 2018-12-14  737  		 spi->chip_select);
a30a555d Martin Sperl  2015-04-06  738  
a30a555d Martin Sperl  2015-04-06  739  	return 0;
f8043872 Chris Boot    2013-03-11  740  }
f8043872 Chris Boot    2013-03-11  741  

:::::: The code at line 684 was first introduced by commit
:::::: a30a555d7435a440fab06fe5960cf3448d8cedd3 spi: bcm2835: transform native-cs to gpio-cs on first spi_setup

:::::: TO: Martin Sperl <kernel@xxxxxxxxxxxxxxxx>
:::::: CC: Mark Brown <broonie@xxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux