linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guru Das Srinagesh <gurus@codeaurora.org>
To: linux-leds@vger.kernel.org
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Pavel Machek <pavel@ucw.cz>, Dan Murphy <dmurphy@ti.com>,
	linux-kernel@vger.kernel.org,
	Fenglin Wu <fenglinw@codeaurora.org>,
	Guru Das Srinagesh <gurus@codeaurora.org>
Subject: [PATCH 2/2] leds: triggers: Don't remove trigger if LED_KEEP_TRIGGER flag is set
Date: Fri,  9 Aug 2019 17:52:47 -0700	[thread overview]
Message-ID: <1565398367-11811-2-git-send-email-gurus@codeaurora.org> (raw)
In-Reply-To: <1565398367-11811-1-git-send-email-gurus@codeaurora.org>

From: Fenglin Wu <fenglinw@codeaurora.org>

The LED_KEEP_TRIGGER flag prevents the trigger being removed while
turning off the LEDs. Extend the flag usage to prevent the trigger being
removed even while "none" trigger is set.

Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
---
 drivers/leds/led-triggers.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 8d11a5e..a0e4531 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -40,7 +40,8 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
 		goto unlock;
 	}
 
-	if (sysfs_streq(buf, "none")) {
+	if (sysfs_streq(buf, "none") &&
+			!(led_cdev->flags & LED_KEEP_TRIGGER)) {
 		led_trigger_remove(led_cdev);
 		goto unlock;
 	}
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


  reply	other threads:[~2019-08-10  0:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-10  0:52 [PATCH 1/2] leds: Add flag to keep trigger always Guru Das Srinagesh
2019-08-10  0:52 ` Guru Das Srinagesh [this message]
2019-08-10  7:13 ` Pavel Machek
2019-09-30 13:39   ` Greg KH
2019-09-30 17:22     ` Pavel Machek
2019-09-30 17:27       ` Greg KH
2019-10-04 20:09         ` Guru Das Srinagesh
2019-10-08  7:47           ` Pavel Machek
2019-10-10  0:52             ` Guru Das Srinagesh

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=1565398367-11811-2-git-send-email-gurus@codeaurora.org \
    --to=gurus@codeaurora.org \
    --cc=dmurphy@ti.com \
    --cc=fenglinw@codeaurora.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).