[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VceSOCiu=17jrmHVOaqAoaqw4He9DKgH8Vjw_oYZdi7Eg@mail.gmail.com>
Date: Wed, 28 Dec 2022 02:41:44 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Jean-Jacques Hiblot <jjhiblot@...phandler.com>
Cc: lee@...nel.org, pavel@....cz, robh+dt@...nel.org,
sven.schwermer@...ruptive-technologies.com,
krzysztof.kozlowski+dt@...aro.org, johan+linaro@...nel.org,
marijn.suijten@...ainline.org, bjorn.andersson@...aro.org,
jacek.anaszewski@...il.com, linux-leds@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [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@...phandler.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
Powered by blists - more mailing lists