From: "Marek Behún" <kabel@kernel.org>
To: Lee Jones <lee@kernel.org>
Cc: Pavel Machek <pavel@ucw.cz>, linux-leds@vger.kernel.org
Subject: Re: [PATCH v3 5/6] leds: turris-omnia: support HW controlled mode via private trigger
Date: Mon, 21 Aug 2023 12:34:11 +0200 [thread overview]
Message-ID: <20230821123411.6ea98dac@dellmb> (raw)
In-Reply-To: <20230818090921.GQ986605@google.com>
On Fri, 18 Aug 2023 10:09:21 +0100
Lee Jones <lee@kernel.org> wrote:
> > + if (!err) {
> > + /* put the LED into MCU controlled mode */
>
> Nit: You improved the comment above to be more grammatically correct by
> starting with an uppercase character. Please continue with this
> improvement for all comments there in.
OK.
> > +static struct led_trigger omnia_hw_trigger = {
> > + .name = "omnia-mcu",
> > + .activate = omnia_hwtrig_activate,
> > + .deactivate = omnia_hwtrig_deactivate,
> > + .trigger_type = &omnia_hw_trigger_type,
>
> Not sure I understand this interface.
>
> Why not just set a bool instead of carrying around an empty struct?
Let me explain:
So, if a LED class device has the same trigger type as a LED trigger,
the trigger will be available for that LED (it is listed in the sysfs
trigger file and can be chosen).
So we have a mechanism to "pair" a LED with a given trigger, to make it
possible for the LED core to distinguish whether a given trigger is
available for the LED.
A boolean information would not be enough: if we used a bool, we would
know that the trigger is private. But the LED core would not know for
which LEDs the trigger should be avaiable.
In pseudocode:
list_triggers_for_led(led) {
for (trigger in trigger_list) {
if (!trigger.trigger_type || trigger.trigger_type ==
led.trigger_type)
trigger is available for led
else
trigger is not available for led
}
}
Is this explaination good enough?
Marek
next prev parent reply other threads:[~2023-08-21 10:34 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-02 16:07 [PATCH v3 0/6] leds: turris-omnia: updates Marek Behún
2023-08-02 16:07 ` [PATCH v3 1/6] leds: turris-omnia: drop unnecessary mutex locking Marek Behún
2023-08-18 8:09 ` Lee Jones
2023-08-18 9:23 ` (subset) " Lee Jones
2023-08-02 16:07 ` [PATCH v3 2/6] leds: turris-omnia: do not use SMBUS calls Marek Behún
2023-08-18 8:08 ` Lee Jones
2023-08-21 10:01 ` Marek Behún
2023-08-21 12:45 ` Lee Jones
2023-08-02 16:07 ` [PATCH v3 3/6] leds: turris-omnia: use sysfs_emit() instead of sprintf() Marek Behún
2023-08-18 9:18 ` (subset) " Lee Jones
2023-08-02 16:07 ` [PATCH v3 4/6] leds: turris-omnia: make set_brightness() more efficient Marek Behún
2023-08-18 9:42 ` Lee Jones
2023-08-21 10:14 ` Marek Behún
2023-08-21 12:39 ` Lee Jones
2023-08-02 16:07 ` [PATCH v3 5/6] leds: turris-omnia: support HW controlled mode via private trigger Marek Behún
2023-08-02 16:13 ` Marek Behún
2023-08-18 8:00 ` Lee Jones
2023-08-18 21:12 ` Jacek Anaszewski
2023-08-21 8:15 ` Lee Jones
2023-08-18 9:09 ` Lee Jones
2023-08-21 10:34 ` Marek Behún [this message]
2023-08-21 12:36 ` Lee Jones
2023-08-02 16:07 ` [PATCH v3 6/6] leds: turris-omnia: add support for enabling/disabling HW gamma correction Marek Behún
2023-08-18 10:30 ` Lee Jones
2023-08-21 10:46 ` Marek Behún
2023-08-21 12:26 ` Lee Jones
2023-08-14 7:33 ` [PATCH v3 0/6] leds: turris-omnia: updates Marek Behún
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230821123411.6ea98dac@dellmb \
--to=kabel@kernel.org \
--cc=lee@kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox