Re: [PATCH v7 4/8] leds: lp3952: use devm API to cleanup module's resources

From: Andy Shevchenko
Date: Thu Mar 14 2024 - 19:38:03 EST


On Thu, Mar 14, 2024 at 10:19 PM George Stark <gnstark@xxxxxxxxxxxxxxxxx> wrote:
>
> In this driver LEDs are registered using devm_led_classdev_register()
> so they are automatically unregistered after module's remove() is done.
> led_classdev_unregister() calls module's led_set_brightness() to turn off
> the LEDs and that callback uses resources which were destroyed already
> in module's remove() so use devm API instead of remove().
> Also drop explicit turning LEDs off from remove() due to they will be off
> anyway by led_classdev_unregister().

..

> +static void gpio_set_low_action(void *data)
> +{
> + struct lp3952_led_array *priv = (struct lp3952_led_array *)data;

In case of new series, drop these castings in patches 4-6.

> + gpiod_set_value(priv->enable_gpio, 0);
> +}


--
With Best Regards,
Andy Shevchenko