diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2012-11-21 05:38:13 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-11-21 05:38:13 -0500 |
commit | 851462444d421c223965b12b836bef63da61b57f (patch) | |
tree | 495baa14e638817941496c36e1443aed7dae0ea0 /drivers/leds/led-triggers.c | |
parent | 5a6ea4af0907f995dc06df21a9c9ef764c7cd3bc (diff) | |
parent | 6924d99fcdf1a688538a3cdebd1f135c22eec191 (diff) |
Merge branch 'for-3.7' of git://git.infradead.org/users/dedekind/l2-mtd
Conflicts:
drivers/mtd/nand/nand_base.c
Diffstat (limited to 'drivers/leds/led-triggers.c')
-rw-r--r-- | drivers/leds/led-triggers.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 363975b3c925..262eb4193710 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c | |||
@@ -102,6 +102,12 @@ EXPORT_SYMBOL_GPL(led_trigger_show); | |||
102 | void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig) | 102 | void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig) |
103 | { | 103 | { |
104 | unsigned long flags; | 104 | unsigned long flags; |
105 | char *event = NULL; | ||
106 | char *envp[2]; | ||
107 | const char *name; | ||
108 | |||
109 | name = trig ? trig->name : "none"; | ||
110 | event = kasprintf(GFP_KERNEL, "TRIGGER=%s", name); | ||
105 | 111 | ||
106 | /* Remove any existing trigger */ | 112 | /* Remove any existing trigger */ |
107 | if (led_cdev->trigger) { | 113 | if (led_cdev->trigger) { |
@@ -109,6 +115,8 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig) | |||
109 | list_del(&led_cdev->trig_list); | 115 | list_del(&led_cdev->trig_list); |
110 | write_unlock_irqrestore(&led_cdev->trigger->leddev_list_lock, | 116 | write_unlock_irqrestore(&led_cdev->trigger->leddev_list_lock, |
111 | flags); | 117 | flags); |
118 | cancel_work_sync(&led_cdev->set_brightness_work); | ||
119 | led_stop_software_blink(led_cdev); | ||
112 | if (led_cdev->trigger->deactivate) | 120 | if (led_cdev->trigger->deactivate) |
113 | led_cdev->trigger->deactivate(led_cdev); | 121 | led_cdev->trigger->deactivate(led_cdev); |
114 | led_cdev->trigger = NULL; | 122 | led_cdev->trigger = NULL; |
@@ -122,6 +130,13 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig) | |||
122 | if (trig->activate) | 130 | if (trig->activate) |
123 | trig->activate(led_cdev); | 131 | trig->activate(led_cdev); |
124 | } | 132 | } |
133 | |||
134 | if (event) { | ||
135 | envp[0] = event; | ||
136 | envp[1] = NULL; | ||
137 | kobject_uevent_env(&led_cdev->dev->kobj, KOBJ_CHANGE, envp); | ||
138 | kfree(event); | ||
139 | } | ||
125 | } | 140 | } |
126 | EXPORT_SYMBOL_GPL(led_trigger_set); | 141 | EXPORT_SYMBOL_GPL(led_trigger_set); |
127 | 142 | ||
@@ -224,7 +239,7 @@ void led_trigger_event(struct led_trigger *trig, | |||
224 | struct led_classdev *led_cdev; | 239 | struct led_classdev *led_cdev; |
225 | 240 | ||
226 | led_cdev = list_entry(entry, struct led_classdev, trig_list); | 241 | led_cdev = list_entry(entry, struct led_classdev, trig_list); |
227 | __led_set_brightness(led_cdev, brightness); | 242 | led_set_brightness(led_cdev, brightness); |
228 | } | 243 | } |
229 | read_unlock(&trig->leddev_list_lock); | 244 | read_unlock(&trig->leddev_list_lock); |
230 | } | 245 | } |