From: Axel Lin <axel.lin@ingics.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] gpio: pca953x: Use ARRAY_SIZE instead of reinventing it
Date: Sat, 22 Jun 2013 18:22:48 +0800 [thread overview]
Message-ID: <1371896568.12449.1.camel@phoenix> (raw)
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/gpio/pca953x.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index be13745..7371cd4 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -47,9 +47,6 @@ struct pca953x_chip_ngpio {
static struct pca953x_chip_ngpio pca953x_chip_ngpios[] =
CONFIG_SYS_I2C_PCA953X_WIDTH;
-#define NUM_CHIP_GPIOS (sizeof(pca953x_chip_ngpios) / \
- sizeof(struct pca953x_chip_ngpio))
-
/*
* Determine the number of GPIO pins supported. If we don't know we assume
* 8 pins.
@@ -58,7 +55,7 @@ static int pca953x_ngpio(uint8_t chip)
{
int i;
- for (i = 0; i < NUM_CHIP_GPIOS; i++)
+ for (i = 0; i < ARRAY_SIZE(pca953x_chip_ngpios); i++)
if (pca953x_chip_ngpios[i].chip == chip)
return pca953x_chip_ngpios[i].ngpio;
--
1.8.1.2
next reply other threads:[~2013-06-22 10:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-22 10:22 Axel Lin [this message]
2013-06-22 11:05 ` [U-Boot] [PATCH] gpio: pca953x: Use ARRAY_SIZE instead of reinventing it Thierry Reding
2013-06-22 13:21 ` Marek Vasut
2013-08-18 21:49 ` [U-Boot] " Tom Rini
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=1371896568.12449.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 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.