[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfSoDHX-zy3Kdk0=oBA64mKddXqHh7v6RwfzRJo8Az_1A@mail.gmail.com>
Date: Fri, 5 Sep 2025 12:58:11 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Aleksandrs Vinarskis <alex@...arskis.com>
Cc: Hans de Goede <hansg@...nel.org>, Lee Jones <lee@...nel.org>, Pavel Machek <pavel@...nel.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
"Bryan O'Donoghue" <bryan.odonoghue@...aro.org>, Daniel Thompson <danielt@...nel.org>,
Jingoo Han <jingoohan1@...il.com>, Mauro Carvalho Chehab <mchehab@...nel.org>,
Jean-Jacques Hiblot <jjhiblot@...phandler.com>, Jacopo Mondi <jacopo@...ndi.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>, Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>, linux-leds@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Daniel Thompson <daniel.thompson@...aro.org>, dri-devel@...ts.freedesktop.org,
linux-media@...r.kernel.org, linux-arm-msm@...r.kernel.org,
Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH v2 3/4] leds: led-class: Add devicetree support to led_get()
On Fri, Sep 5, 2025 at 11:00 AM Aleksandrs Vinarskis <alex@...arskis.com> wrote:
> Add 'name' argument to of_led_get() such that it can lookup LEDs in
> devicetree by either name or index.
>
> And use this modified function to add devicetree support to the generic
> (non devicetree specific) [devm_]led_get() function.
>
> This uses the standard devicetree pattern of adding a -names string array
> to map names to the indexes for an array of resources.
...
> + if (dev->of_node) {
This check is not needed.
Currently of_led_get() returns -ENOENT if the np is NULL or index is
invalid (negative value).
Same will be with the added index search as in case of error it will
hold a negative value.
> + led_cdev = of_led_get(dev->of_node, -1, con_id);
> + if (!IS_ERR(led_cdev) || PTR_ERR(led_cdev) != -ENOENT)
> + return led_cdev;
> + }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists