Re: [PATCH 6/7] gpiolib: of: factor out code overriding gpio line polarity

From: Dmitry Torokhov
Date: Wed Oct 12 2022 - 11:30:56 EST


On October 12, 2022 4:10:37 AM PDT, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>On Tue, Oct 11, 2022 at 03:19:34PM -0700, Dmitry Torokhov wrote:
>> There are several instances where we use a separate property to
>> override polarity specified in gpio property. Factor it out into
>> a separate function.
>
>...
>
>> static void of_gpio_flags_quirks(const struct device_node *np,
>> const char *propname,
>> enum of_gpio_flags *flags,
>> @@ -145,7 +167,7 @@ static void of_gpio_flags_quirks(const struct device_node *np,
>> (!(strcmp(propname, "enable-gpio") &&
>> strcmp(propname, "enable-gpios")) &&
>> of_device_is_compatible(np, "regulator-gpio")))) {
>> - bool active_low = !of_property_read_bool(np,
>> + bool active_high = of_property_read_bool(np,
>
>Defining
>
> bool active_high;
>
>at the top of the function will save you a few ugly indented code lines here
>and in the next patch.
>

Indeed, but I think the idea was to keep the quirks as independent as possible.
I guess I could split it further into separate functions, like the other quirk handling.

Bartosz, Linus, any preference here?

Thanks.

--
Dmitry