Re: [PATCH v2 07/10] pinctrl: baytrail: use gpiochip_dup_line_label()

From: Andy Shevchenko
Date: Thu Nov 30 2023 - 11:36:22 EST


On Thu, Nov 30, 2023 at 02:46:27PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> Use the new gpiochip_dup_line_label() helper to safely retrieve the
> descriptor label.

...

> seq_printf(s,
> " gpio-%-3d (%-20.20s) %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s",
> pin,
> - label,
> + label ?: "Unrequested",

This already fourth (?) duplication among drivers.
Perhaps you want a helper:
gpiochip_dup_line_label_fallback() // naming is up to you
which will return the same for everybody and we don't need to hunt for
the different meaning of "Unrequested".

Also the word "Unrequested" is a bit doubtful as it can be a label, right?
Something with special characters / spaces / etc would suit better?
In any case it might require to add a warning (?) to the GPIO lib core
when label gets assigned if it clashes with the "reserved" word.

> val & BYT_INPUT_EN ? " " : "in",
> val & BYT_OUTPUT_EN ? " " : "out",
> str_hi_lo(val & BYT_LEVEL),

--
With Best Regards,
Andy Shevchenko