public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] gpio: omap_gpio: Remove check_gpio() function
Date: Thu, 20 Jun 2013 09:03:09 +0800	[thread overview]
Message-ID: <1371690189.3940.1.camel@phoenix> (raw)

check_gpio() and gpio_is_valid() are both used to check if a gpio is valid or
not. It looks pointless to have both function because we can just call
gpio_is_valid() instead of check_gpio(). Thus remove check_gpio() function.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/gpio/omap_gpio.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
index a30d7f0..221acc6 100644
--- a/drivers/gpio/omap_gpio.c
+++ b/drivers/gpio/omap_gpio.c
@@ -58,15 +58,6 @@ int gpio_is_valid(int gpio)
 	return (gpio >= 0) && (gpio < 192);
 }
 
-static int check_gpio(int gpio)
-{
-	if (!gpio_is_valid(gpio)) {
-		printf("ERROR : check_gpio: invalid GPIO %d\n", gpio);
-		return -1;
-	}
-	return 0;
-}
-
 static void _set_gpio_direction(const struct gpio_bank *bank, int gpio,
 				int is_input)
 {
@@ -142,7 +133,7 @@ int gpio_set_value(unsigned gpio, int value)
 {
 	const struct gpio_bank *bank;
 
-	if (check_gpio(gpio) < 0)
+	if (!gpio_is_valid(gpio))
 		return -1;
 	bank = get_gpio_bank(gpio);
 	_set_gpio_dataout(bank, get_gpio_index(gpio), value);
@@ -159,7 +150,7 @@ int gpio_get_value(unsigned gpio)
 	void *reg;
 	int input;
 
-	if (check_gpio(gpio) < 0)
+	if (!gpio_is_valid(gpio))
 		return -1;
 	bank = get_gpio_bank(gpio);
 	reg = bank->base;
@@ -191,7 +182,7 @@ int gpio_direction_input(unsigned gpio)
 {
 	const struct gpio_bank *bank;
 
-	if (check_gpio(gpio) < 0)
+	if (!gpio_is_valid(gpio))
 		return -1;
 
 	bank = get_gpio_bank(gpio);
@@ -207,7 +198,7 @@ int gpio_direction_output(unsigned gpio, int value)
 {
 	const struct gpio_bank *bank;
 
-	if (check_gpio(gpio) < 0)
+	if (!gpio_is_valid(gpio))
 		return -1;
 
 	bank = get_gpio_bank(gpio);
@@ -224,7 +215,7 @@ int gpio_direction_output(unsigned gpio, int value)
  */
 int gpio_request(unsigned gpio, const char *label)
 {
-	if (check_gpio(gpio) < 0)
+	if (!gpio_is_valid(gpio))
 		return -1;
 
 	return 0;
-- 
1.8.1.2

             reply	other threads:[~2013-06-20  1:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20  1:03 Axel Lin [this message]
2013-06-20  5:19 ` [U-Boot] [PATCH] gpio: omap_gpio: Remove check_gpio() function Nikita Kiryanov
2013-06-20  7:20   ` Axel Lin
2013-06-20  7:44     ` Nikita Kiryanov

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=1371690189.3940.1.camel@phoenix \
    --to=axel.lin@ingics.com \
    --cc=u-boot@lists.denx.de \
    /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