diff mbox series

[v1,13/16] gpio: wcove: Utilize helpers from string_choices.h

Message ID 20230306195556.55475-14-andriy.shevchenko@linux.intel.com
State Handled Elsewhere
Headers show
Series gpio: Use string_choices.h | expand

Commit Message

Andy Shevchenko March 6, 2023, 7:55 p.m. UTC
There are a few helpers available to convert a boolean variable
to the dedicated string literals depending on the application.
Use them in the driver.

While at, utilize specifier field for padding the strings where
it's required.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-wcove.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Comments

Kuppuswamy Sathyanarayanan March 6, 2023, 8:28 p.m. UTC | #1
Hi,

On 3/6/23 11:55 AM, Andy Shevchenko wrote:
> There are a few helpers available to convert a boolean variable
> to the dedicated string literals depending on the application.
> Use them in the driver.
> 
> While at, utilize specifier field for padding the strings where
> it's required.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Looks good to me.

Acked-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

> ---
>  drivers/gpio/gpio-wcove.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c
> index c18b6b47384f..8d30fd04dede 100644
> --- a/drivers/gpio/gpio-wcove.c
> +++ b/drivers/gpio/gpio-wcove.c
> @@ -15,6 +15,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  #include <linux/seq_file.h>
> +#include <linux/string_choices.h>
>  
>  /*
>   * Whiskey Cove PMIC has 13 physical GPIO pins divided into 3 banks:
> @@ -391,14 +392,14 @@ static void wcove_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
>  			break;
>  		}
>  
> -		seq_printf(s, " gpio-%-2d %s %s %s %s ctlo=%2x,%s %s\n",
> -			   gpio, ctlo & CTLO_DIR_OUT ? "out" : "in ",
> -			   ctli & 0x1 ? "hi" : "lo",
> -			   ctli & CTLI_INTCNT_NE ? "fall" : "    ",
> -			   ctli & CTLI_INTCNT_PE ? "rise" : "    ",
> +		seq_printf(s, " gpio-%-2d %-3.3s %-2.2s %-4.4s %-4.4s ctlo=%2x,%-6.6s %s\n",
> +			   gpio, str_out_in(ctlo & CTLO_DIR_OUT),
> +			   str_hi_lo(ctli & BIT(0)),
> +			   ctli & CTLI_INTCNT_NE ? "fall" : "",
> +			   ctli & CTLI_INTCNT_PE ? "rise" : "",
>  			   ctlo,
> -			   irq_mask & mask ? "mask  " : "unmask",
> -			   irq_status & mask ? "pending" : "       ");
> +			   irq_mask & mask ? "mask" : "unmask",
> +			   irq_status & mask ? "pending" : "");
>  	}
>  }
>
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c
index c18b6b47384f..8d30fd04dede 100644
--- a/drivers/gpio/gpio-wcove.c
+++ b/drivers/gpio/gpio-wcove.c
@@ -15,6 +15,7 @@ 
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/seq_file.h>
+#include <linux/string_choices.h>
 
 /*
  * Whiskey Cove PMIC has 13 physical GPIO pins divided into 3 banks:
@@ -391,14 +392,14 @@  static void wcove_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 			break;
 		}
 
-		seq_printf(s, " gpio-%-2d %s %s %s %s ctlo=%2x,%s %s\n",
-			   gpio, ctlo & CTLO_DIR_OUT ? "out" : "in ",
-			   ctli & 0x1 ? "hi" : "lo",
-			   ctli & CTLI_INTCNT_NE ? "fall" : "    ",
-			   ctli & CTLI_INTCNT_PE ? "rise" : "    ",
+		seq_printf(s, " gpio-%-2d %-3.3s %-2.2s %-4.4s %-4.4s ctlo=%2x,%-6.6s %s\n",
+			   gpio, str_out_in(ctlo & CTLO_DIR_OUT),
+			   str_hi_lo(ctli & BIT(0)),
+			   ctli & CTLI_INTCNT_NE ? "fall" : "",
+			   ctli & CTLI_INTCNT_PE ? "rise" : "",
 			   ctlo,
-			   irq_mask & mask ? "mask  " : "unmask",
-			   irq_status & mask ? "pending" : "       ");
+			   irq_mask & mask ? "mask" : "unmask",
+			   irq_status & mask ? "pending" : "");
 	}
 }