summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-uclass.c
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-01-13 13:35:02 +0300
committerTom Rini <trini@konsulko.com>2020-04-17 06:06:54 +0300
commit8a9140cd38c5571fc23d1e7b293ca22325d41afc (patch)
tree3e3d650af27de8c34aca8bbf3b42cb7a2ceede56 /drivers/gpio/gpio-uclass.c
parent9f2b066cda3dd0b4bf583c40610eba347f2c03cd (diff)
downloadu-boot-8a9140cd38c5571fc23d1e7b293ca22325d41afc.tar.xz
gpio: add function _gpio_get_value
Introduce the function _gpio_get_value to get the GPIO value without check if it is reserved. This patch prepare new ops introduction. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/gpio/gpio-uclass.c')
-rw-r--r--drivers/gpio/gpio-uclass.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 32fdc5bfe5..5c82a4a7db 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -476,18 +476,24 @@ int gpio_direction_output(unsigned gpio, int value)
desc.offset, value);
}
-int dm_gpio_get_value(const struct gpio_desc *desc)
+static int _gpio_get_value(const struct gpio_desc *desc)
{
int value;
+
+ value = gpio_get_ops(desc->dev)->get_value(desc->dev, desc->offset);
+
+ return desc->flags & GPIOD_ACTIVE_LOW ? !value : value;
+}
+
+int dm_gpio_get_value(const struct gpio_desc *desc)
+{
int ret;
ret = check_reserved(desc, "get_value");
if (ret)
return ret;
- value = gpio_get_ops(desc->dev)->get_value(desc->dev, desc->offset);
-
- return desc->flags & GPIOD_ACTIVE_LOW ? !value : value;
+ return _gpio_get_value(desc);
}
int dm_gpio_set_value(const struct gpio_desc *desc, int value)