* [U-Boot] [PATCH] gpio: pca953x: Use ARRAY_SIZE instead of reinventing it
@ 2013-06-22 10:22 Axel Lin
2013-06-22 11:05 ` Thierry Reding
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Axel Lin @ 2013-06-22 10:22 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] gpio: pca953x: Use ARRAY_SIZE instead of reinventing it
2013-06-22 10:22 [U-Boot] [PATCH] gpio: pca953x: Use ARRAY_SIZE instead of reinventing it Axel Lin
@ 2013-06-22 11:05 ` Thierry Reding
2013-06-22 13:21 ` Marek Vasut
2013-08-18 21:49 ` [U-Boot] " Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2013-06-22 11:05 UTC (permalink / raw)
To: u-boot
On Sat, Jun 22, 2013 at 06:22:48PM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/gpio/pca953x.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130622/a71889f5/attachment.pgp>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] gpio: pca953x: Use ARRAY_SIZE instead of reinventing it
2013-06-22 10:22 [U-Boot] [PATCH] gpio: pca953x: Use ARRAY_SIZE instead of reinventing it Axel Lin
2013-06-22 11:05 ` Thierry Reding
@ 2013-06-22 13:21 ` Marek Vasut
2013-08-18 21:49 ` [U-Boot] " Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2013-06-22 13:21 UTC (permalink / raw)
To: u-boot
Dear Axel Lin,
> 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;
Absolutelly
Acked-by: Marek Vasut <marex@denx.de>
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] gpio: pca953x: Use ARRAY_SIZE instead of reinventing it
2013-06-22 10:22 [U-Boot] [PATCH] gpio: pca953x: Use ARRAY_SIZE instead of reinventing it Axel Lin
2013-06-22 11:05 ` Thierry Reding
2013-06-22 13:21 ` Marek Vasut
@ 2013-08-18 21:49 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2013-08-18 21:49 UTC (permalink / raw)
To: u-boot
On Sat, Jun 22, 2013 at 06:22:48PM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
> Acked-by: Marek Vasut <marex@denx.de>
>
> ---
> drivers/gpio/pca953x.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130818/a0cc4409/attachment.pgp>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-18 21:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-22 10:22 [U-Boot] [PATCH] gpio: pca953x: Use ARRAY_SIZE instead of reinventing it Axel Lin
2013-06-22 11:05 ` Thierry Reding
2013-06-22 13:21 ` Marek Vasut
2013-08-18 21:49 ` [U-Boot] " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox