lkml.org 
[lkml]   [2022]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RESEND PATCH v6 6/6] leds: Add a multicolor LED driver to group monochromatic LEDs
On Tue, Dec 27, 2022 at 12:07 PM Jean-Jacques Hiblot
<jjhiblot@traphandler.com> wrote:
>
> By allowing to group multiple monochrome LED into multicolor LEDs,
> all involved LEDs can be controlled in-sync. This enables using effects
> using triggers, etc.

...

> + count = 0;
> + max_brightness = 0;
> + for (;;) {
> + struct led_classdev *led_cdev;
> +
> + led_cdev = devm_of_led_get_optional(dev, count);

> +

Redundant blank line.

> + if (IS_ERR(led_cdev))
> + return dev_err_probe(dev, PTR_ERR(led_cdev),
> + "Unable to get led #%d", count);
> +
> + /* Reached the end of the list ?*/
> + if (!led_cdev)
> + break;

> + count++;

If I understand the flow correctly, this can be moved...

> + priv->monochromatics = devm_krealloc_array(dev, priv->monochromatics,
> + count, sizeof(*priv->monochromatics),
> + GFP_KERNEL);
> + if (!priv->monochromatics)
> + return -ENOMEM;

> + priv->monochromatics[count - 1] = led_cdev;

...here either as a separate line or a part of the above assignment,
in either case the -1 wouldn't be needed.


> + max_brightness = max(max_brightness, led_cdev->max_brightness);
> + }

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2023-03-26 23:21    [W:0.065 / U:0.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site