summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2017-10-20 10:31:15 -0600
committerAaron Durbin <adurbin@chromium.org>2017-10-20 22:49:27 +0000
commitbd885c5bac425c589582a610bd2dc92dd3809e06 (patch)
treedfad052957c4e2d805c7be1ca3d306997c45bd17
parente8e72bd0ca3ea84ba21db4318589e5c903085419 (diff)
downloadcoreboot-bd885c5bac425c589582a610bd2dc92dd3809e06.tar.xz
lib/gpio: constify array inputs
The arrays of gpio_t are not manipulated in any way within the gpio library. Add const to indicate that. Change-Id: Ie32ab9de967ece22317e2b97b62e85b0757b910d Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/22121 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
-rw-r--r--src/include/gpio.h13
-rw-r--r--src/lib/gpio.c10
2 files changed, 12 insertions, 11 deletions
diff --git a/src/include/gpio.h b/src/include/gpio.h
index 3a8951ca73..3160242562 100644
--- a/src/include/gpio.h
+++ b/src/include/gpio.h
@@ -29,7 +29,7 @@ void gpio_input_pulldown(gpio_t gpio);
void gpio_input_pullup(gpio_t gpio);
void gpio_input(gpio_t gpio);
void gpio_output(gpio_t gpio, int value);
-int _gpio_base3_value(gpio_t gpio[], int num_gpio, int binary_first);
+int _gpio_base3_value(const gpio_t gpio[], int num_gpio, int binary_first);
/*
* This function may be implemented by SoC/board code to provide
@@ -60,9 +60,9 @@ uint16_t gpio_acpi_pin(gpio_t gpio);
* There are also pulldown and pullup variants which default each gpio to
* be configured with an internal pulldown and pullup, respectively.
*/
-int gpio_base2_value(gpio_t gpio[], int num_gpio);
-int gpio_pulldown_base2_value(gpio_t gpio[], int num_gpio);
-int gpio_pullup_base2_value(gpio_t gpio[], int num_gpio);
+int gpio_base2_value(const gpio_t gpio[], int num_gpio);
+int gpio_pulldown_base2_value(const gpio_t gpio[], int num_gpio);
+int gpio_pullup_base2_value(const gpio_t gpio[], int num_gpio);
/*
* Read the value presented by the set of GPIOs, when each pin is interpreted
@@ -73,7 +73,7 @@ int gpio_pullup_base2_value(gpio_t gpio[], int num_gpio);
* gpio[]: pin positions to read. gpio[0] is less significant than gpio[1].
* num_gpio: number of pins to read.
*/
-static inline int gpio_base3_value(gpio_t gpio[], int num_gpio)
+static inline int gpio_base3_value(const gpio_t gpio[], int num_gpio)
{
return _gpio_base3_value(gpio, num_gpio, 0);
}
@@ -103,7 +103,8 @@ static inline int gpio_base3_value(gpio_t gpio[], int num_gpio)
* gpio[]: pin positions to read. gpio[0] is less significant than gpio[1].
* num_gpio: number of pins to read.
*/
-static inline int gpio_binary_first_base3_value(gpio_t gpio[], int num_gpio)
+static inline int gpio_binary_first_base3_value(const gpio_t gpio[],
+ int num_gpio)
{
return _gpio_base3_value(gpio, num_gpio, 1);
}
diff --git a/src/lib/gpio.c b/src/lib/gpio.c
index ca0aebedf5..48db262a11 100644
--- a/src/lib/gpio.c
+++ b/src/lib/gpio.c
@@ -19,7 +19,7 @@
#include <delay.h>
#include <gpio.h>
-static int _gpio_base2_value(gpio_t gpio[], int num_gpio)
+static int _gpio_base2_value(const gpio_t gpio[], int num_gpio)
{
int i, result = 0;
@@ -32,7 +32,7 @@ static int _gpio_base2_value(gpio_t gpio[], int num_gpio)
return result;
}
-int gpio_base2_value(gpio_t gpio[], int num_gpio)
+int gpio_base2_value(const gpio_t gpio[], int num_gpio)
{
int i;
@@ -42,7 +42,7 @@ int gpio_base2_value(gpio_t gpio[], int num_gpio)
return _gpio_base2_value(gpio, num_gpio);
}
-int gpio_pulldown_base2_value(gpio_t gpio[], int num_gpio)
+int gpio_pulldown_base2_value(const gpio_t gpio[], int num_gpio)
{
int i;
@@ -52,7 +52,7 @@ int gpio_pulldown_base2_value(gpio_t gpio[], int num_gpio)
return _gpio_base2_value(gpio, num_gpio);
}
-int gpio_pullup_base2_value(gpio_t gpio[], int num_gpio)
+int gpio_pullup_base2_value(const gpio_t gpio[], int num_gpio)
{
int i;
@@ -62,7 +62,7 @@ int gpio_pullup_base2_value(gpio_t gpio[], int num_gpio)
return _gpio_base2_value(gpio, num_gpio);
}
-int _gpio_base3_value(gpio_t gpio[], int num_gpio, int binary_first)
+int _gpio_base3_value(const gpio_t gpio[], int num_gpio, int binary_first)
{
/*
* GPIOs which are tied to stronger external pull up or pull down