devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: re: spi-gpio: allow operation without CS signal
Date: Wed, 3 Oct 2012 17:42:41 +0300	[thread overview]
Message-ID: <20121003144241.GA18056@elgon.mountain> (raw)

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

                 reply	other threads:[~2012-10-03 14:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121003144241.GA18056@elgon.mountain \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).