mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [For next PATCH 1/1] gpio: move gpio_is_valid to gpio.h
@ 2012-10-27 20:10 Jean-Christophe PLAGNIOL-VILLARD
  2012-10-27 20:22 ` [PATCH 1/1 v2] " Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-27 20:10 UTC (permalink / raw)
  To: barebox

gpio < 0 means invalid too

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/gpio/gpio.c        |    2 --
 include/asm-generic/gpio.h |   11 +++++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio.c b/drivers/gpio/gpio.c
index 6ad8d27..cd14e93 100644
--- a/drivers/gpio/gpio.c
+++ b/drivers/gpio/gpio.c
@@ -4,8 +4,6 @@
 
 static LIST_HEAD(chip_list);
 
-#define ARCH_NR_GPIOS 256
-
 static struct gpio_chip *gpio_desc[ARCH_NR_GPIOS];
 
 static int gpio_is_valid(unsigned gpio)
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 1997888..c2e7a5d 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -1,6 +1,17 @@
 #ifndef __ASM_GENERIC_GPIO_H
 #define __ASM_GENERIC_GPIO_H
 
+#define ARCH_NR_GPIOS 256
+
+static inline int gpio_is_valid(int gpio)
+{
+	if (gpio < 0)
+		return 0;
+	if (gpio < ARCH_NR_GPIOS)
+		return 1;
+	return 0;
+}
+
 void gpio_set_value(unsigned gpio, int value);
 int gpio_get_value(unsigned gpio);
 int gpio_direction_output(unsigned gpio, int value);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1 v2] gpio: move gpio_is_valid to gpio.h
  2012-10-27 20:10 [For next PATCH 1/1] gpio: move gpio_is_valid to gpio.h Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-27 20:22 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-10-29  7:43   ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-27 20:22 UTC (permalink / raw)
  To: barebox

gpio < 0 means invalid too

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
send right version

Best Regards,
J.
 drivers/gpio/gpio.c        |    9 ---------
 include/asm-generic/gpio.h |   11 +++++++++++
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio.c b/drivers/gpio/gpio.c
index 6ad8d27..042a062 100644
--- a/drivers/gpio/gpio.c
+++ b/drivers/gpio/gpio.c
@@ -4,17 +4,8 @@
 
 static LIST_HEAD(chip_list);
 
-#define ARCH_NR_GPIOS 256
-
 static struct gpio_chip *gpio_desc[ARCH_NR_GPIOS];
 
-static int gpio_is_valid(unsigned gpio)
-{
-	if (gpio < ARCH_NR_GPIOS)
-		return 1;
-	return 0;
-}
-
 void gpio_set_value(unsigned gpio, int value)
 {
 	struct gpio_chip *chip = gpio_desc[gpio];
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 1997888..c2e7a5d 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -1,6 +1,17 @@
 #ifndef __ASM_GENERIC_GPIO_H
 #define __ASM_GENERIC_GPIO_H
 
+#define ARCH_NR_GPIOS 256
+
+static inline int gpio_is_valid(int gpio)
+{
+	if (gpio < 0)
+		return 0;
+	if (gpio < ARCH_NR_GPIOS)
+		return 1;
+	return 0;
+}
+
 void gpio_set_value(unsigned gpio, int value);
 int gpio_get_value(unsigned gpio);
 int gpio_direction_output(unsigned gpio, int value);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1 v2] gpio: move gpio_is_valid to gpio.h
  2012-10-27 20:22 ` [PATCH 1/1 v2] " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-29  7:43   ` Sascha Hauer
  0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2012-10-29  7:43 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sat, Oct 27, 2012 at 10:22:45PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> gpio < 0 means invalid too
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

What we really should do is to get rid of is the inclusion of
mach/gpio.h, asm/gpio.h from gpio.h. I began to prepare a patch for
this, but it has to wait some time due to other things to do.

Applied, thanks

Sascha

> ---
> send right version
> 
> Best Regards,
> J.
>  drivers/gpio/gpio.c        |    9 ---------
>  include/asm-generic/gpio.h |   11 +++++++++++
>  2 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpio/gpio.c b/drivers/gpio/gpio.c
> index 6ad8d27..042a062 100644
> --- a/drivers/gpio/gpio.c
> +++ b/drivers/gpio/gpio.c
> @@ -4,17 +4,8 @@
>  
>  static LIST_HEAD(chip_list);
>  
> -#define ARCH_NR_GPIOS 256
> -
>  static struct gpio_chip *gpio_desc[ARCH_NR_GPIOS];
>  
> -static int gpio_is_valid(unsigned gpio)
> -{
> -	if (gpio < ARCH_NR_GPIOS)
> -		return 1;
> -	return 0;
> -}
> -
>  void gpio_set_value(unsigned gpio, int value)
>  {
>  	struct gpio_chip *chip = gpio_desc[gpio];
> diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
> index 1997888..c2e7a5d 100644
> --- a/include/asm-generic/gpio.h
> +++ b/include/asm-generic/gpio.h
> @@ -1,6 +1,17 @@
>  #ifndef __ASM_GENERIC_GPIO_H
>  #define __ASM_GENERIC_GPIO_H
>  
> +#define ARCH_NR_GPIOS 256
> +
> +static inline int gpio_is_valid(int gpio)
> +{
> +	if (gpio < 0)
> +		return 0;
> +	if (gpio < ARCH_NR_GPIOS)
> +		return 1;
> +	return 0;
> +}
> +
>  void gpio_set_value(unsigned gpio, int value);
>  int gpio_get_value(unsigned gpio);
>  int gpio_direction_output(unsigned gpio, int value);
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-29  7:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-27 20:10 [For next PATCH 1/1] gpio: move gpio_is_valid to gpio.h Jean-Christophe PLAGNIOL-VILLARD
2012-10-27 20:22 ` [PATCH 1/1 v2] " Jean-Christophe PLAGNIOL-VILLARD
2012-10-29  7:43   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox