devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: spi-gpio: allow operation without CS signal
@ 2012-10-03 14:42 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2012-10-03 14:42 UTC (permalink / raw)
  To: mb-fseUSCV1ubazQB+pC5nmwQ
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

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


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-03 14:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-03 14:42 spi-gpio: allow operation without CS signal Dan Carpenter

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).