spi-gpio: allow operation without CS signal

Dan Carpenter dan.carpenter at oracle.com
Thu Oct 4 00:42:41 EST 2012


Hello Michael Buesch,

The patch bfb9bcdbda9a: "spi-gpio: allow operation without CS signal"
from Apr 2, 2009, leads to the following Clang warning:
drivers/spi/spi-gpio.c:229:9: warning: comparison of constant
18446744073709551615 with expression of type 'unsigned int' is always
true [-Wtautological-constant-out-of-range-compare]


#define SPI_GPIO_NO_CHIPSELECT          ((unsigned long)-1l)
                                         ^^^^^^^^^^^^^^^^^^

drivers/spi/spi-gpio.c
   223          unsigned int cs = spi_gpio->cs_gpios[spi->chip_select];
   224  
   225          /* set initial clock polarity */
   226          if (is_active)
   227                  setsck(spi, spi->mode & SPI_CPOL);
   228  
   229          if (cs != SPI_GPIO_NO_CHIPSELECT) {
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is always true.  SPI_GPIO_NO_CHIPSELECT is used like this through
out.  The comments say that it's supposed to be used as a void pointer
but that doesn't make a lot of sense either.

   230                  /* SPI is normally active-low */
   231                  gpio_set_value(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active);
   232          }

regards,
dan carpenter



More information about the devicetree-discuss mailing list