Commit 342a8c08 authored by Michael Welling's avatar Michael Welling
Browse files

Use ARRAY_SIZE macro and see if it works.


Signed-off-by: default avatarMichael Welling <mwelling@emacinc.com>
parent 6f091d47
......@@ -263,7 +263,7 @@
#size-cells = <0>;
sdsw-gpio = <&pioD 10 0>;
sdsw-gpio-dir = <0x1>;
sdsw-gpio-val = <0x1>;
sdsw-gpio-val = <0x0>;
physw-gpio = <&pioA 6 0>;
physw-gpio-dir = <0x1>;
......
......@@ -49,7 +49,7 @@ static gpio_data gpio_data_read(struct gpio_s *gpio)
int i;
value = 0;
for(i = 0; i < (sizeof(gpio->gpio_set)/sizeof(gpio->gpio_set[0])); i++)
for(i = 0; i < ARRAY_SIZE(gpio->gpio_set); i++)
value |= (gpio_get_value(gpio->gpio_set[i]) << i);
return value;
......@@ -59,7 +59,7 @@ static int gpio_data_write(struct gpio_s *gpio, gpio_data data)
{
int i;
for(i = 0; i < (sizeof(gpio->gpio_set)/sizeof(gpio->gpio_set[0])); i++)
for(i = 0; i < ARRAY_SIZE(gpio->gpio_set); i++)
gpio_set_value(gpio->gpio_set[i], (data >> i) & 1);
return 0;
......@@ -76,7 +76,7 @@ static int gpio_ddr_write(struct gpio_s *gpio, gpio_data data)
gpio->ddr_shadow = data;
for(i = 0; i < (sizeof(gpio->gpio_set)/sizeof(gpio->gpio_set[0])); i++)
for(i = 0; i < ARRAY_SIZE(gpio->gpio_set); i++)
{
if (data & (1 << i))
gpio_direction_output(gpio->gpio_set[i], 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment