linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Fee <anthony.fee@emutex.com>
To: linus.walleij@linaro.org, gnurou@gmail.com, linux-gpio@vger.kernel.org
Cc: Anthony Fee <anthony.fee@emutex.com>
Subject: [PATCH v2] gpio: generic: add request function pointer
Date: Mon, 19 May 2014 18:49:14 +0100	[thread overview]
Message-ID: <1400521754-4480-1-git-send-email-anthony.fee@emutex.com> (raw)

gpiolib will require all gpio drivers to expicitly set the request function pointer
in future. To encourage gpio driver developers to adhere to this standard
gpio-generic.c now sets this function pointer.

Signed-off-by: Anthony Fee <anthony.fee@emutex.com>
---
 drivers/gpio/gpio-generic.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index b5dff9e..fea8c82 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -388,6 +388,14 @@ static int bgpio_setup_direction(struct bgpio_chip *bgc,
 	return 0;
 }
 
+static int bgpio_request(struct gpio_chip *chip, unsigned gpio_pin)
+{
+	if (gpio_pin < chip->ngpio)
+		return 0;
+
+	return -EINVAL;
+}
+
 int bgpio_remove(struct bgpio_chip *bgc)
 {
 	return gpiochip_remove(&bgc->gc);
@@ -413,6 +421,7 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev,
 	bgc->gc.label = dev_name(dev);
 	bgc->gc.base = -1;
 	bgc->gc.ngpio = bgc->bits;
+	bgc->gc.request = bgpio_request;
 
 	ret = bgpio_setup_io(bgc, dat, set, clr);
 	if (ret)
-- 
1.9.0


             reply	other threads:[~2014-05-19 17:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19 17:49 Anthony Fee [this message]
2014-05-20  6:49 ` [PATCH v2] gpio: generic: add request function pointer Alexandre Courbot
2014-05-20  7:41   ` Anthony Fee
2014-05-23 12:33 ` Linus Walleij

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=1400521754-4480-1-git-send-email-anthony.fee@emutex.com \
    --to=anthony.fee@emutex.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.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).