summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-uclass.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-02-05 07:21:56 +0300
committerTom Rini <trini@konsulko.com>2021-03-03 22:51:06 +0300
commit9648789e2634e30fc58ad7180a7c7815e6227061 (patch)
tree1533178802a6fa29f12ce021b903d26477adee81 /drivers/gpio/gpio-uclass.c
parent13979fc44667cbc577f3c4d07b6692de104a3174 (diff)
downloadu-boot-9648789e2634e30fc58ad7180a7c7815e6227061.tar.xz
dm: gpio: Rename get_dir_flags() method to get_flags()
It is more useful to be able to read all the flags, not just the direction ones. In fact this is what the STM32 driver does. Update the method name to reflect this. Tweak the docs a little and use 'flagsp' as the return argument, as is common in driver model, to indicate it returns a value. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Diffstat (limited to 'drivers/gpio/gpio-uclass.c')
-rw-r--r--drivers/gpio/gpio-uclass.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index d42e778ed8..4d15162bc4 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -683,39 +683,39 @@ int dm_gpio_set_dir(struct gpio_desc *desc)
return _dm_gpio_set_flags(desc, desc->flags);
}
-int dm_gpio_get_dir_flags(struct gpio_desc *desc, ulong *flags)
+int dm_gpio_get_dir_flags(struct gpio_desc *desc, ulong *flagsp)
{
struct udevice *dev = desc->dev;
int ret, value;
struct dm_gpio_ops *ops = gpio_get_ops(dev);
- ulong dir_flags;
+ ulong flags;
- ret = check_reserved(desc, "get_dir_flags");
+ ret = check_reserved(desc, "get_flags");
if (ret)
return ret;
/* GPIOD_ are directly provided by driver except GPIOD_ACTIVE_LOW */
- if (ops->get_dir_flags) {
- ret = ops->get_dir_flags(dev, desc->offset, &dir_flags);
+ if (ops->get_flags) {
+ ret = ops->get_flags(dev, desc->offset, &flags);
if (ret)
return ret;
/* GPIOD_ACTIVE_LOW is saved in desc->flags */
- value = dir_flags & GPIOD_IS_OUT_ACTIVE ? 1 : 0;
+ value = flags & GPIOD_IS_OUT_ACTIVE ? 1 : 0;
if (desc->flags & GPIOD_ACTIVE_LOW)
value = !value;
- dir_flags &= ~(GPIOD_ACTIVE_LOW | GPIOD_IS_OUT_ACTIVE);
- dir_flags |= (desc->flags & GPIOD_ACTIVE_LOW);
+ flags &= ~(GPIOD_ACTIVE_LOW | GPIOD_IS_OUT_ACTIVE);
+ flags |= (desc->flags & GPIOD_ACTIVE_LOW);
if (value)
- dir_flags |= GPIOD_IS_OUT_ACTIVE;
+ flags |= GPIOD_IS_OUT_ACTIVE;
} else {
- dir_flags = desc->flags;
+ flags = desc->flags;
/* only GPIOD_IS_OUT_ACTIVE is provided by uclass */
- dir_flags &= ~GPIOD_IS_OUT_ACTIVE;
+ flags &= ~GPIOD_IS_OUT_ACTIVE;
if ((desc->flags & GPIOD_IS_OUT) && _gpio_get_value(desc))
- dir_flags |= GPIOD_IS_OUT_ACTIVE;
+ flags |= GPIOD_IS_OUT_ACTIVE;
}
- *flags = dir_flags;
+ *flagsp = flags;
return 0;
}
@@ -1310,8 +1310,8 @@ static int gpio_post_bind(struct udevice *dev)
ops->xlate += gd->reloc_off;
if (ops->set_flags)
ops->set_flags += gd->reloc_off;
- if (ops->get_dir_flags)
- ops->get_dir_flags += gd->reloc_off;
+ if (ops->get_flags)
+ ops->get_flags += gd->reloc_off;
reloc_done++;
}