Message ID | 20240603181938.76047-3-wahrenst@gmx.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | pinctrl: bcm2835: persist_gpio_outputs follow-up | expand |
On 6/3/2024 8:19 PM, Stefan Wahren wrote: > Use modern string_choices API instead of manually determining the > output using ternary operator. > > Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Signed-off-by: Stefan Wahren <wahrenst@gmx.net> LGTM but sometimes I really wonder to what degree should we invent a helper function... Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
On Tue, Jun 4, 2024 at 10:28 AM Florian Fainelli <florian.fainelli@broadcom.com> wrote: > On 6/3/2024 8:19 PM, Stefan Wahren wrote: ... > LGTM but sometimes I really wonder to what degree should we invent a > helper function... The rationale for the messaging is unification, that's why helpers like dev_err_probe() (for known non-deferred error codes), str_*() choices, and %pt (to have time and date be printed) are good to have. In general I agree that we should't become fanatics of hiding everything behind the macros and helpers.
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index 27fd54795791..184641e221d4 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -34,6 +34,7 @@ #include <linux/seq_file.h> #include <linux/slab.h> #include <linux/spinlock.h> +#include <linux/string_choices.h> #include <linux/types.h> #include <dt-bindings/pinctrl/bcm2835.h> @@ -752,7 +753,7 @@ static void bcm2835_pctl_pin_dbg_show(struct pinctrl_dev *pctldev, int irq = irq_find_mapping(chip->irq.domain, offset); seq_printf(s, "function %s in %s; irq %d (%s)", - fname, value ? "hi" : "lo", + fname, str_hi_lo(value), irq, irq_type_names[pc->irq_type[offset]]); } @@ -1428,7 +1429,7 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) } dev_info(dev, "GPIO_OUT persistence: %s\n", - persist_gpio_outputs ? "yes" : "no"); + str_yes_no(persist_gpio_outputs)); return 0;
Use modern string_choices API instead of manually determining the output using ternary operator. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Stefan Wahren <wahrenst@gmx.net> --- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.34.1