[<prev] [next>] [day] [month] [year] [list]
Message-id: <1474273425-6670-1-git-send-email-j.anaszewski@samsung.com>
Date: Mon, 19 Sep 2016 10:23:45 +0200
From: Jacek Anaszewski <j.anaszewski@...sung.com>
To: linux-leds@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, daniel.gorsulowski@....eu,
danielromell@...il.com,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Jacek Anaszewski <j.anaszewski@...sung.com>
Subject: [PATCH] leds: triggers: Return from led_trigger_set() if there is
nothing to do
From: Jacek Anaszewski <jacek.anaszewski@...il.com>
If led_trigger_set() is called with "trig" argument set to NULL, and there
is no trigger to remove then the function should return immediately so
as to avoid doing unnecessary allocation and sending uevent.
Signed-off-by: Jacek Anaszewski <j.anaszewski@...sung.com>
Reported-by: Daniel Romell <daro@....se>
---
drivers/leds/led-triggers.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 59d6a3e..c7a38d4 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -110,6 +110,9 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
char *envp[2];
const char *name;
+ if (!led_cdev->trigger && !trig)
+ return;
+
name = trig ? trig->name : "none";
event = kasprintf(GFP_KERNEL, "TRIGGER=%s", name);
--
1.9.1
Powered by blists - more mailing lists