Re: [PATCH 2/2] leds: ktd2692: Make aux-gpios optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 7, 2022 at 1:33 PM Markuss Broks <markuss.broks@xxxxxxxxx> wrote:
>
> Make the AUX pin optional, since it isn't a core part of functionality,
> and the device is designed to be operational with only one CTRL pin.
>
> Also pick up maintainership for the LED driver and the yaml bindings.

maintenance?

...

> -               gpiod_direction_output(led->aux_gpio, KTD2692_LOW);
> +               if (led->aux_gpio)
> +                       gpiod_direction_output(led->aux_gpio, KTD2692_LOW);

Redundant change.

...

> -               gpiod_direction_output(led->aux_gpio, KTD2692_HIGH);
> +               if (led->aux_gpio)
> +                       gpiod_direction_output(led->aux_gpio, KTD2692_HIGH);

Ditto.

...

> -               gpiod_direction_output(led->aux_gpio, KTD2692_LOW);
> +               if (led->aux_gpio)
> +                       gpiod_direction_output(led->aux_gpio, KTD2692_LOW);

Ditto.

...

> -       gpiod_direction_output(led->aux_gpio, KTD2692_LOW);
> +       if (led->aux_gpio)
> +               gpiod_direction_output(led->aux_gpio, KTD2692_LOW);

Ditto.

...

>         ret = PTR_ERR_OR_ZERO(led->aux_gpio);
> -       if (ret) {
> -               dev_err(dev, "cannot get aux-gpios %d\n", ret);
> -               return ret;
> -       }
> +       if (ret)
> +               dev_info(dev, "aux-gpios not available, flash mode current might be reduced\n");

dev_warn()?

After this change the use of PTR_ERR_OR_ZERO() becomes unjustified, what about
        if (IS_ERR(led->aux_gpio))
?

But the problem here is the ignorance of important error codes, such a
deferred probe.

What you need is to switch to devm_gpiod_get_optional().

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux