From patchwork Mon Apr 4 20:22:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 8743921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4C6BCC0553 for ; Mon, 4 Apr 2016 20:24:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 343492022A for ; Mon, 4 Apr 2016 20:24:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 45CB2201CE for ; Mon, 4 Apr 2016 20:24:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1anB1Z-0006tG-PY; Mon, 04 Apr 2016 20:23:01 +0000 Received: from mail-qk0-x229.google.com ([2607:f8b0:400d:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1anB1K-0006mY-8J for linux-arm-kernel@lists.infradead.org; Mon, 04 Apr 2016 20:22:47 +0000 Received: by mail-qk0-x229.google.com with SMTP id r184so32552894qkc.1 for ; Mon, 04 Apr 2016 13:22:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vanguardiasur-com-ar.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7jl2L2tNDoteJPlppW7C94eBFKZ4U527QXbUCxvK/1g=; b=Zpg9w3TfQF+eW7dq5/japhY7Jc6azMTV0zdO9o7/pxw+WGj7NkrYjM5f+P+Xh9bT1Z pszwwX7bR38HCjfn78rMdO2i+8qJV8QNWLtkBNUgwK49ddum+oKKzEBJCyVeYtra4Y65 GN+9qVddl9Zu3zeWUK9iZ10PEH85aUxnffJxva+fy7ySp0SPocUD6ZmbQWvlIUbq+4HS Pcc43wqxJlGn+oVdID8QtSAweC6re95x9Tsnpb6YkK8xWfarZNiYpoIZsW6iNhlT6v70 wnbCfYypLqREH9TBqnAzVavDf1mDNFwIbnGQEaj3olHRIc+PYyDrxPwlrX2fDBy8vNyf mrSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7jl2L2tNDoteJPlppW7C94eBFKZ4U527QXbUCxvK/1g=; b=EPc8ZZHsMbhSYq4LVKjtKBnUxywPR4k9xHze/JkTLb787ndFwIlHx6tgpAv4f2hvL6 Xje2a7BAT1GxACqsLri15ZNOGUwodU/IhefRuidIcYalpZQhJkRthF6FNlu0AjnCr+jp ebSdlwIv63gXYFIZNm/wmIsnESnMO6rpQREMVt6E9ZAsEK8mR/GAwlbWCVC1zE77Rtw3 3JL+zHv6hGMzYrAM2nNzaAQGveHRlp5SBiXj1Hm70+MoOrSqWhFQdYuNNZ3bfrqtYvjV Op9ykiQ/AYyzUBSUd3arOujKH7tUm8nFHk7pXlVAMtrkfRODKK5+M9C7YISgGJk9ezQM uP9g== X-Gm-Message-State: AD7BkJI6w50dq8GJclb8zieZ/aR9edvS+kGam+pROcPerwNw7RAdh4OCK0g7IDB70r0eyg== X-Received: by 10.55.81.87 with SMTP id f84mr35931448qkb.10.1459801345245; Mon, 04 Apr 2016 13:22:25 -0700 (PDT) Received: from localhost.localdomain ([190.2.108.156]) by smtp.gmail.com with ESMTPSA id w75sm13065124qka.49.2016.04.04.13.22.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Apr 2016 13:22:24 -0700 (PDT) From: Ezequiel Garcia To: , , Subject: [PATCH 2/5] leds: triggers: Add a led_trigger_event_nosleep API Date: Mon, 4 Apr 2016 17:22:03 -0300 Message-Id: <1459801326-5541-3-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1459801326-5541-1-git-send-email-ezequiel@vanguardiasur.com.ar> References: <1459801326-5541-1-git-send-email-ezequiel@vanguardiasur.com.ar> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160404_132246_497057_B64A708D X-CRM114-Status: GOOD ( 11.96 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Purdie , Jacek Anaszewski , Ezequiel Garcia MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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); + list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list) { + if (nosleep) + led_set_brightness_nosleep(led_cdev, brightness); + else + led_set_brightness(led_cdev, brightness); + } read_unlock(&trig->leddev_list_lock); } + +void led_trigger_event(struct led_trigger *trig, + enum led_brightness brightness) +{ + do_led_trigger_event(trig, brightness, false); +} EXPORT_SYMBOL_GPL(led_trigger_event); +void led_trigger_event_nosleep(struct led_trigger *trig, + enum led_brightness brightness) +{ + do_led_trigger_event(trig, brightness, true); +} +EXPORT_SYMBOL_GPL(led_trigger_event_nosleep); + static void led_trigger_blink_setup(struct led_trigger *trig, unsigned long *delay_on, unsigned long *delay_off, diff --git a/include/linux/leds.h b/include/linux/leds.h index 7f1428bb1e69..d33b230ce66d 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -259,6 +259,8 @@ extern void led_trigger_register_simple(const char *name, extern void led_trigger_unregister_simple(struct led_trigger *trigger); extern void led_trigger_event(struct led_trigger *trigger, enum led_brightness event); +extern void led_trigger_event_nosleep(struct led_trigger *trigger, + enum led_brightness event); extern void led_trigger_blink(struct led_trigger *trigger, unsigned long *delay_on, unsigned long *delay_off); @@ -305,6 +307,8 @@ static inline void led_trigger_register_simple(const char *name, static inline void led_trigger_unregister_simple(struct led_trigger *trigger) {} static inline void led_trigger_event(struct led_trigger *trigger, enum led_brightness event) {} +static inline void led_trigger_event_nosleep(struct led_trigger *trigger, + enum led_brightness event) {} static inline void led_trigger_blink(struct led_trigger *trigger, unsigned long *delay_on, unsigned long *delay_off) {}