[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200715190727.4bb528dc@dellmb.labs.office.nic.cz>
Date: Wed, 15 Jul 2020 19:07:27 +0200
From: Marek BehĂșn <marek.behun@....cz>
To: Pavel Machek <pavel@....cz>
Cc: Ondrej Jirman <megous@...ous.com>, linux-kernel@...r.kernel.org,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Dan Murphy <dmurphy@...com>,
"open list:LED SUBSYSTEM" <linux-leds@...r.kernel.org>
Subject: Re: [PATCH RFC] leds: Add support for per-LED device triggers
On Sat, 11 Jul 2020 12:04:09 +0200
Pavel Machek <pavel@....cz> wrote:
> What about this? Should address Marek's concerns about resource use...
>
> Best regards,
> Pavel
>
...
> @@ -280,7 +291,8 @@ int led_trigger_register(struct led_trigger *trig)
> down_write(&triggers_list_lock);
> /* Make sure the trigger's name isn't already in use */
> list_for_each_entry(_trig, &trigger_list, next_trig) {
> - if (!strcmp(_trig->name, trig->name)) {
> + if (!strcmp(_trig->name, trig->name) &&
> + (!_trig->private_led || _trig->private_led ==
> trig->private_led)) { up_write(&triggers_list_lock);
> return -EEXIST;
> }
Hi Pavel,
Your proposal does not add private_led member to struct led_trigger. I
think you forgot to change this from Ondrej's proposal.
This should instead check:
the names are same and both trigger have the same type (either none
or same). In that case return -EEXIST.
Also a couple of lines below there is code for enabling this trigger
for LEDs that have it set as default trigger. There should also be a
check whether the trigger is relevant.
In the linux/leds.h header the trigger_type in led_classdev should be
inside the CONFIG_LEDS_TRIGGERS block.
I will send new version with an example usage for a Marvell PHY driver.
Marek
Powered by blists - more mailing lists