Re: [PATCH 04/15] gpio: Rename dm_gpio_get_dir_flags() to dm_gpio_get_flags()

2021-01-21 Thread Patrick DELAUNAY

Hi Simon,

On 1/15/21 3:04 PM, Simon Glass wrote:

This function can be used to get any flags, not just direction flags.
Rename it to avoid confusion.

Signed-off-by: Simon Glass 
---

  drivers/gpio/gpio-uclass.c |  2 +-
  include/asm-generic/gpio.h |  4 ++--
  test/dm/gpio.c | 12 ++--
  3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 83d3cf0a6b3..864a9003245 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -682,7 +682,7 @@ int dm_gpio_set_dir(struct gpio_desc *desc)
return _dm_gpio_update_flags(desc, desc->flags);
  }
  
-int dm_gpio_get_dir_flags(struct gpio_desc *desc, ulong *flagsp)

+int dm_gpio_get_flags(struct gpio_desc *desc, ulong *flagsp)
  {
struct udevice *dev = desc->dev;
int ret, value;
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 48e042dc44b..5ecb73c138d 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -685,7 +685,7 @@ int dm_gpio_set_dir(struct gpio_desc *desc);
  int dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags);
  
  /**

- * dm_gpio_get_dir_flags() - Get direction flags
+ * dm_gpio_get_flags() - Get direction flags


Get GPIO flags


   *
   * read the current direction flags


read the current flags of the GPIO


   *
@@ -694,7 +694,7 @@ int dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong 
flags);
   * @flags:place to put the used flags
   * @return 0 if OK, -ve on error, in which case desc->flags is not updated
   */
-int dm_gpio_get_dir_flags(struct gpio_desc *desc, ulong *flags);
+int dm_gpio_get_flags(struct gpio_desc *desc, ulong *flags);
  
  /**

   * gpio_get_number() - Get the global GPIO number of a GPIO
diff --git a/test/dm/gpio.c b/test/dm/gpio.c
index a08c3590d71..6b9ec88ca2b 100644
--- a/test/dm/gpio.c
+++ b/test/dm/gpio.c
@@ -397,22 +397,22 @@ static int dm_test_gpio_get_dir_flags(struct 
unit_test_state *uts)
ut_asserteq(6, gpio_request_list_by_name(dev, "test3-gpios", desc_list,
 ARRAY_SIZE(desc_list), 0));
  
-	ut_assertok(dm_gpio_get_dir_flags(_list[0], ));

+   ut_assertok(dm_gpio_get_flags(_list[0], ));
ut_asserteq(GPIOD_IS_OUT | GPIOD_OPEN_DRAIN, flags);
  
-	ut_assertok(dm_gpio_get_dir_flags(_list[1], ));

+   ut_assertok(dm_gpio_get_flags(_list[1], ));
ut_asserteq(GPIOD_IS_OUT | GPIOD_OPEN_SOURCE, flags);
  
-	ut_assertok(dm_gpio_get_dir_flags(_list[2], ));

+   ut_assertok(dm_gpio_get_flags(_list[2], ));
ut_asserteq(GPIOD_IS_OUT, flags);
  
-	ut_assertok(dm_gpio_get_dir_flags(_list[3], ));

+   ut_assertok(dm_gpio_get_flags(_list[3], ));
ut_asserteq(GPIOD_IS_IN | GPIOD_PULL_UP, flags);
  
-	ut_assertok(dm_gpio_get_dir_flags(_list[4], ));

+   ut_assertok(dm_gpio_get_flags(_list[4], ));
ut_asserteq(GPIOD_IS_IN | GPIOD_PULL_DOWN, flags);
  
-	ut_assertok(dm_gpio_get_dir_flags(_list[5], ));

+   ut_assertok(dm_gpio_get_flags(_list[5], ));
ut_asserteq(GPIOD_IS_IN, flags);
  
  	ut_assertok(gpio_free_list(dev, desc_list, 6));



With the 2 comments


Reviewed-by: Patrick Delaunay 

Thanks

Patrick



Re: [PATCH 04/15] gpio: Rename dm_gpio_get_dir_flags() to dm_gpio_get_flags()

2021-01-18 Thread Pratyush Yadav
On 15/01/21 07:04AM, Simon Glass wrote:
> This function can be used to get any flags, not just direction flags.
> Rename it to avoid confusion.
> 
> Signed-off-by: Simon Glass 
> ---
> 
>  drivers/gpio/gpio-uclass.c |  2 +-
>  include/asm-generic/gpio.h |  4 ++--
>  test/dm/gpio.c | 12 ++--
>  3 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
> index 83d3cf0a6b3..864a9003245 100644
> --- a/drivers/gpio/gpio-uclass.c
> +++ b/drivers/gpio/gpio-uclass.c
> @@ -682,7 +682,7 @@ int dm_gpio_set_dir(struct gpio_desc *desc)
>   return _dm_gpio_update_flags(desc, desc->flags);
>  }
>  
> -int dm_gpio_get_dir_flags(struct gpio_desc *desc, ulong *flagsp)
> +int dm_gpio_get_flags(struct gpio_desc *desc, ulong *flagsp)
>  {
>   struct udevice *dev = desc->dev;
>   int ret, value;
> diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
> index 48e042dc44b..5ecb73c138d 100644
> --- a/include/asm-generic/gpio.h
> +++ b/include/asm-generic/gpio.h
> @@ -685,7 +685,7 @@ int dm_gpio_set_dir(struct gpio_desc *desc);
>  int dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags);
>  
>  /**
> - * dm_gpio_get_dir_flags() - Get direction flags
> + * dm_gpio_get_flags() - Get direction flags

s/Get direction flags/Get flags/

With this fixed,

Reviewed-by: Pratyush Yadav 

-- 
Regards,
Pratyush Yadav
Texas Instruments India


[PATCH 04/15] gpio: Rename dm_gpio_get_dir_flags() to dm_gpio_get_flags()

2021-01-15 Thread Simon Glass
This function can be used to get any flags, not just direction flags.
Rename it to avoid confusion.

Signed-off-by: Simon Glass 
---

 drivers/gpio/gpio-uclass.c |  2 +-
 include/asm-generic/gpio.h |  4 ++--
 test/dm/gpio.c | 12 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 83d3cf0a6b3..864a9003245 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -682,7 +682,7 @@ int dm_gpio_set_dir(struct gpio_desc *desc)
return _dm_gpio_update_flags(desc, desc->flags);
 }
 
-int dm_gpio_get_dir_flags(struct gpio_desc *desc, ulong *flagsp)
+int dm_gpio_get_flags(struct gpio_desc *desc, ulong *flagsp)
 {
struct udevice *dev = desc->dev;
int ret, value;
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 48e042dc44b..5ecb73c138d 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -685,7 +685,7 @@ int dm_gpio_set_dir(struct gpio_desc *desc);
 int dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags);
 
 /**
- * dm_gpio_get_dir_flags() - Get direction flags
+ * dm_gpio_get_flags() - Get direction flags
  *
  * read the current direction flags
  *
@@ -694,7 +694,7 @@ int dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong 
flags);
  * @flags: place to put the used flags
  * @return 0 if OK, -ve on error, in which case desc->flags is not updated
  */
-int dm_gpio_get_dir_flags(struct gpio_desc *desc, ulong *flags);
+int dm_gpio_get_flags(struct gpio_desc *desc, ulong *flags);
 
 /**
  * gpio_get_number() - Get the global GPIO number of a GPIO
diff --git a/test/dm/gpio.c b/test/dm/gpio.c
index a08c3590d71..6b9ec88ca2b 100644
--- a/test/dm/gpio.c
+++ b/test/dm/gpio.c
@@ -397,22 +397,22 @@ static int dm_test_gpio_get_dir_flags(struct 
unit_test_state *uts)
ut_asserteq(6, gpio_request_list_by_name(dev, "test3-gpios", desc_list,
 ARRAY_SIZE(desc_list), 0));
 
-   ut_assertok(dm_gpio_get_dir_flags(_list[0], ));
+   ut_assertok(dm_gpio_get_flags(_list[0], ));
ut_asserteq(GPIOD_IS_OUT | GPIOD_OPEN_DRAIN, flags);
 
-   ut_assertok(dm_gpio_get_dir_flags(_list[1], ));
+   ut_assertok(dm_gpio_get_flags(_list[1], ));
ut_asserteq(GPIOD_IS_OUT | GPIOD_OPEN_SOURCE, flags);
 
-   ut_assertok(dm_gpio_get_dir_flags(_list[2], ));
+   ut_assertok(dm_gpio_get_flags(_list[2], ));
ut_asserteq(GPIOD_IS_OUT, flags);
 
-   ut_assertok(dm_gpio_get_dir_flags(_list[3], ));
+   ut_assertok(dm_gpio_get_flags(_list[3], ));
ut_asserteq(GPIOD_IS_IN | GPIOD_PULL_UP, flags);
 
-   ut_assertok(dm_gpio_get_dir_flags(_list[4], ));
+   ut_assertok(dm_gpio_get_flags(_list[4], ));
ut_asserteq(GPIOD_IS_IN | GPIOD_PULL_DOWN, flags);
 
-   ut_assertok(dm_gpio_get_dir_flags(_list[5], ));
+   ut_assertok(dm_gpio_get_flags(_list[5], ));
ut_asserteq(GPIOD_IS_IN, flags);
 
ut_assertok(gpio_free_list(dev, desc_list, 6));
-- 
2.30.0.284.gd98b1dd5eaa7-goog