All of lore.kernel.org
 help / color / mirror / Atom feed
From: dan.carpenter@oracle.com (Dan Carpenter)
To: linux-arm-kernel@lists.infradead.org
Subject: [bug report] ARM: pxa: use generic gpio operation instead of gpio register
Date: Wed, 13 Jul 2016 17:54:05 +0300	[thread overview]
Message-ID: <20160713145405.GA28563@mwanda> (raw)

Hello Haojian Zhuang,

The patch 9bf448c66d4b: "ARM: pxa: use generic gpio operation instead
of gpio register" from Oct 17, 2011, leads to the following static
checker warning:

  arch/arm/mach-pxa/spitz_pm.c:172 spitz_charger_wakeup()
  warn: double left shift '!gpio_get_value(SPITZ_GPIO_KEY_INT) << (1 << ((SPITZ_GPIO_KEY_INT) & 31))'

  arch/arm/mach-pxa/corgi_pm.c:138 corgi_charger_wakeup()
  warn: double left shift '!gpio_get_value(CORGI_GPIO_AC_IN) << (1 << ((CORGI_GPIO_AC_IN) & 31))'

  arch/arm/mach-pxa/corgi_pm.c:140 corgi_charger_wakeup()
  warn: double left shift '!gpio_get_value(CORGI_GPIO_KEY_INT) << (1 << ((CORGI_GPIO_KEY_INT) & 31))'

  arch/arm/mach-pxa/corgi_pm.c:142 corgi_charger_wakeup()
  warn: double left shift '!gpio_get_value(CORGI_GPIO_WAKEUP) << (1 << ((CORGI_GPIO_WAKEUP) & 31))'

arch/arm/mach-pxa/spitz_pm.c
   168  static unsigned long spitz_charger_wakeup(void)
   169  {
   170          unsigned long ret;
   171          ret = ((!gpio_get_value(SPITZ_GPIO_KEY_INT)
   172                  << GPIO_bit(SPITZ_GPIO_KEY_INT))
                           ^^^^^^^^
We're double shifting here.  It's clearly wrong, but I'm not sure what
the correct thing would be.

   173                  | gpio_get_value(SPITZ_GPIO_SYNC));
   174          return ret;
   175  }

arch/arm/mach-pxa/corgi_pm.c
   134  static unsigned long corgi_charger_wakeup(void)
   135  {
   136          unsigned long ret;
   137  
   138          ret = (!gpio_get_value(CORGI_GPIO_AC_IN) << GPIO_bit(CORGI_GPIO_AC_IN))
                                                            ^^^^^^^^
   139                  | (!gpio_get_value(CORGI_GPIO_KEY_INT)
   140                  << GPIO_bit(CORGI_GPIO_KEY_INT))
                           ^^^^^^^^
   141                  | (!gpio_get_value(CORGI_GPIO_WAKEUP)
   142                  << GPIO_bit(CORGI_GPIO_WAKEUP));
                           ^^^^^^^^^
   143          return ret;
   144  }

regards,
dan carpenter

             reply	other threads:[~2016-07-13 14:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13 14:54 Dan Carpenter [this message]
2016-07-13 18:15 ` [bug report] ARM: pxa: use generic gpio operation instead of gpio register Robert Jarzmik

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=20160713145405.GA28563@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.