linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] Make MMCI driver compile without gpiolib
Date: Mon, 28 Sep 2009 21:03:26 +0100	[thread overview]
Message-ID: <20090928200326.GI10671@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <63386a3d0909281200m1da30d22h4ea4fb72278941de@mail.gmail.com>

On Mon, Sep 28, 2009 at 09:00:01PM +0200, Linus Walleij wrote:
> Hm thinking back at this:
> 
> 2009/9/27 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> 
> > The real problem is that U300 doesn't implement gpio_is_valid() -
> > which is part of the GPIO API and not specific to GPIOLIB.
> 
> None of the GPIO drivers in drivers/gpio implement gpio_is_valid()
> though they all select GPIOLIB which in turn selects GENERIC_GPIO.

include/asm-generic/gpio.h:

#ifdef CONFIG_GPIOLIB
...
/* Platforms may implement their GPIO interface with library code,
 * at a small performance cost for non-inlined operations and some
 * extra memory (for code and for per-GPIO table entries).
 *
 * While the GPIO programming interface defines valid GPIO numbers
 * to be in the range 0..MAX_INT, this library restricts them to the
 * smaller range 0..ARCH_NR_GPIOS-1.
 */

#ifndef ARCH_NR_GPIOS
#define ARCH_NR_GPIOS           256
#endif

static inline int gpio_is_valid(int number)
{
        /* only some non-negative numbers are valid */
        return ((unsigned)number) < ARCH_NR_GPIOS;
}

So, with gpiolib enabled, gpio_is_valid() is predefined assuming that
GPIOs between 0..ARCH_NR_GPIOS are valid.

      parent reply	other threads:[~2009-09-28 20:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26  8:56 [PATCH] Make MMCI driver compile without gpiolib Linus Walleij
2009-09-27 15:31 ` Russell King - ARM Linux
2009-09-27 19:11   ` Linus Walleij
2009-09-28 19:00   ` Linus Walleij
2009-09-28 19:18     ` Baruch Siach
2009-09-28 20:03     ` Russell King - ARM Linux [this message]

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=20090928200326.GI10671@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --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 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).