Skip to content

Commit

Permalink
gpio: pca953x: Use ARRAY_SIZE instead of reinventing it
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Lin <[email protected]>
Reviewed-by: Thierry Reding <[email protected]>
Acked-by: Marek Vasut <[email protected]>
  • Loading branch information
AxelLin authored and trini committed Aug 16, 2013
1 parent 2db1c3f commit f218761
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/gpio/pca953x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;

Expand Down

0 comments on commit f218761

Please sign in to comment.