[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1207730791-31326-2-git-send-email-Uwe.Kleine-Koenig@digi.com>
Date: Wed, 9 Apr 2008 10:46:31 +0200
From: Uwe Kleine-König <Uwe.Kleine-Koenig@...i.com>
To: Richard Purdie <rpurdie@...ys.net>
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] leds: automatically request trigger module
This allows:
lala:/sys/class/leds/porta6# cat trigger
[none] heartbeat
lala:/sys/class/leds/porta6# echo timer > trigger
lala:/sys/class/leds/porta6# cat trigger
none heartbeat [timer]
Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@...i.com>
---
Hello,
this change is convenient but I'm not sure if it adds policy to the
kernel.
What do you think about requesting ("ledtrig-%s", trigger_name)? Maybe
better use something like ("ledtrigger:%s", trigger_name)? This looks
better IMHO, but you would need to add module aliases to the trigger
modules.
Best regards
Uwe
drivers/leds/led-triggers.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 13c9026..26cfeae 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -51,6 +51,8 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
return count;
}
+ request_module("ledtrig-%s", trigger_name);
+
down_read(&triggers_list_lock);
list_for_each_entry(trig, &trigger_list, next_trig) {
if (!strcmp(trigger_name, trig->name)) {
@@ -146,6 +148,8 @@ void led_trigger_set_default(struct led_classdev *led_cdev)
if (!led_cdev->default_trigger)
return;
+ request_module("ledtrig-%s", led_cdev->default_trigger);
+
down_read(&triggers_list_lock);
down_write(&led_cdev->trigger_lock);
list_for_each_entry(trig, &trigger_list, next_trig) {
--
1.5.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists