From: Sergei Shtylyov <sshtylyov@mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] nios2: add gpio_is_valid
Date: Mon, 27 Dec 2010 14:35:54 +0300 [thread overview]
Message-ID: <4D187A1A.7080108@mvista.com> (raw)
In-Reply-To: <1293417961-8247-1-git-send-email-thomas@wytron.com.tw>
Hello.
On 27-12-2010 5:46, Thomas Chou wrote:
> Signed-off-by: Thomas Chou<thomas@wytron.com.tw>
[...]
> diff --git a/arch/nios2/include/asm/gpio.h b/arch/nios2/include/asm/gpio.h
> index 36a7132..4b21c8f 100644
> --- a/arch/nios2/include/asm/gpio.h
> +++ b/arch/nios2/include/asm/gpio.h
> @@ -52,6 +52,11 @@ static inline void gpio_set_value(unsigned gpio, int value)
> {
> writel(value ? 3 : 2, CONFIG_SYS_GPIO_BASE + (gpio<< 2));
> }
> +
> +static inline int gpio_is_valid(int number)
> +{
> + return ((unsigned)number) < CONFIG_SYS_GPIO_WIDTH;
No need to have parens around '(unsigned)number'.
> diff --git a/board/altera/nios2-generic/gpio.c b/board/altera/nios2-generic/gpio.c
> index 8c639ce..4a30564 100644
> --- a/board/altera/nios2-generic/gpio.c
> +++ b/board/altera/nios2-generic/gpio.c
[...]
> @@ -62,4 +63,9 @@ void gpio_set_value(unsigned gpio, int value)
> pio_data_reg&= ~mask;
> writel(pio_data_reg, ALTERA_PIO_DATA);
> }
> +
> +int gpio_is_valid(int number)
> +{
> + return ((unsigned)number) < ALTERA_PIO_WIDTH;
Same here...
WBR, Sergei
next prev parent reply other threads:[~2010-12-27 11:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-27 2:46 [U-Boot] [PATCH] nios2: add gpio_is_valid Thomas Chou
2010-12-27 11:35 ` Sergei Shtylyov [this message]
2010-12-27 14:51 ` Thomas Chou
2011-01-18 17:19 ` Scott McNutt
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=4D187A1A.7080108@mvista.com \
--to=sshtylyov@mvista.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 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.