From: jacek.anaszewski@gmail.com (Jacek Anaszewski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] leds: triggers: Add a led_trigger_event_nosleep API
Date: Wed, 6 Apr 2016 08:12:40 +0200 [thread overview]
Message-ID: <5704A8D8.8090004@gmail.com> (raw)
In-Reply-To: <CAAEAJfCoJEM9+Y_=B=YKFG_zT5TMHEKqzrX-nns7L8Mx5WqSug@mail.gmail.com>
On 04/06/2016 06:38 AM, Ezequiel Garcia wrote:
> On 5 April 2016 at 18:36, Jacek Anaszewski <jacek.anaszewski@gmail.com> wrote:
>> Hi Ezequiel,
>>
>>
>> On 04/04/2016 10:22 PM, Ezequiel Garcia wrote:
>>>
>>> Now that we can mark any LED (even those in use by delayed blink
>>> triggers) to trigger on a kernel panic, let's introduce a nosleep
>>> led_trigger_event API.
>>>
>>> This API is needed to skip the delayed blink path on
>>> led_trigger_event. LEDs that are switched on a kernel panic,
>>> might be in use by a delayed blink trigger.
>>>
>>> This will be used by the panic LED trigger.
>>>
>>> Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
>>> ---
>>> drivers/leds/led-triggers.c | 26 ++++++++++++++++++++++----
>>> include/linux/leds.h | 4 ++++
>>> 2 files changed, 26 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
>>> index f5c9d7c4d181..00b9d8497777 100644
>>> --- a/drivers/leds/led-triggers.c
>>> +++ b/drivers/leds/led-triggers.c
>>> @@ -307,8 +307,9 @@ EXPORT_SYMBOL_GPL(devm_led_trigger_register);
>>>
>>> /* Simple LED Tigger Interface */
>>>
>>> -void led_trigger_event(struct led_trigger *trig,
>>> - enum led_brightness brightness)
>>> +static void do_led_trigger_event(struct led_trigger *trig,
>>> + enum led_brightness brightness,
>>> + bool nosleep)
>>> {
>>> struct led_classdev *led_cdev;
>>>
>>> @@ -316,12 +317,29 @@ void led_trigger_event(struct led_trigger *trig,
>>> return;
>>>
>>> read_lock(&trig->leddev_list_lock);
>>> - list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list)
>>> - led_set_brightness(led_cdev, brightness);
>>
>>
>> led_set_brightness() can gently disable blinking if passed 0 in the
>> brightness argument. IMHO this patch is not needed then.
>>
>>
>
> Yes, but the blinking disable is deferred, and so might never
> run (e.g. I'd say it won't run on a non-preemptible kernel).
>
> I think we need this API, or otherwise some way of circumventing
> the deferred path on led_set_brightness. For instance, we
> could turn off delay_on and delay_off in the panic atomic notifier.
Yes, I prefer the latter, as it requires less changes.
> I'm not strongly convinced by any approach, but this API seemed
> slightly cleaner.
>
--
Best regards,
Jacek Anaszewski
next prev parent reply other threads:[~2016-04-06 6:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-04 20:22 [PATCH 0/5] Extend the LED panic trigger Ezequiel Garcia
2016-04-04 20:22 ` [PATCH 1/5] leds: triggers: Allow to switch the trigger to "panic" on a kernel panic Ezequiel Garcia
2016-04-05 21:36 ` Jacek Anaszewski
2016-04-24 9:25 ` Pavel Machek
2016-04-24 9:29 ` Pavel Machek
2016-04-25 6:56 ` Jacek Anaszewski
2016-04-25 16:27 ` Ezequiel Garcia
2016-04-26 7:15 ` Jacek Anaszewski
2016-04-27 20:10 ` Ezequiel Garcia
2016-05-02 7:06 ` Pavel Machek
2016-04-04 20:22 ` [PATCH 2/5] leds: triggers: Add a led_trigger_event_nosleep API Ezequiel Garcia
2016-04-05 21:36 ` Jacek Anaszewski
2016-04-06 4:38 ` Ezequiel Garcia
2016-04-06 6:12 ` Jacek Anaszewski [this message]
2016-04-04 20:22 ` [PATCH 3/5] leds: trigger: panic: Use led_trigger_event_nosleep Ezequiel Garcia
2016-04-04 20:22 ` [PATCH 4/5] devicetree: leds: Introduce "panic-blink" optional property Ezequiel Garcia
2016-04-05 21:37 ` Jacek Anaszewski
2016-04-06 4:39 ` Ezequiel Garcia
2016-04-06 15:12 ` Rob Herring
2016-04-06 16:13 ` Ezequiel Garcia
2016-04-04 20:22 ` [PATCH 5/5] leds: gpio: Support the panic-blink firmware property Ezequiel Garcia
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=5704A8D8.8090004@gmail.com \
--to=jacek.anaszewski@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).