aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-06-17 19:51:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-06-17 19:51:35 -0400
commit374d801522fb4a809395c188b1a867c5ebcda752 (patch)
treef68b42e9cafbea52a1106cc8f4f1cec10ed8d01e
parent19ea9d668a1f9f1e5e6752549150795a6693e6ad (diff)
parent436c4c45b5b9562b59cedbb51b7343ab4a6dd8cc (diff)
Merge tag 'led_fixes_for_4.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds
Pull LED fixes from Jacek Anaszewski: "Two LED fixes: - fix signal source assignment for leds-bcm6328 - revert patch that intended to fix LED behavior on suspend but it had a side effect preventing suspend at all due to uevent being sent on trigger removal" * tag 'led_fixes_for_4.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds: Revert "leds: handle suspend/resume in heartbeat trigger" leds: bcm6328: fix signal source assignment for leds 4 to 7
-rw-r--r--drivers/leds/leds-bcm6328.c4
-rw-r--r--drivers/leds/trigger/ledtrig-heartbeat.c31
2 files changed, 2 insertions, 33 deletions
diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c
index 1548259297c1..2cfd9389ee96 100644
--- a/drivers/leds/leds-bcm6328.c
+++ b/drivers/leds/leds-bcm6328.c
@@ -242,7 +242,7 @@ static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg,
242 242
243 spin_lock_irqsave(lock, flags); 243 spin_lock_irqsave(lock, flags);
244 val = bcm6328_led_read(addr); 244 val = bcm6328_led_read(addr);
245 val |= (BIT(reg) << (((sel % 4) * 4) + 16)); 245 val |= (BIT(reg % 4) << (((sel % 4) * 4) + 16));
246 bcm6328_led_write(addr, val); 246 bcm6328_led_write(addr, val);
247 spin_unlock_irqrestore(lock, flags); 247 spin_unlock_irqrestore(lock, flags);
248 } 248 }
@@ -269,7 +269,7 @@ static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg,
269 269
270 spin_lock_irqsave(lock, flags); 270 spin_lock_irqsave(lock, flags);
271 val = bcm6328_led_read(addr); 271 val = bcm6328_led_read(addr);
272 val |= (BIT(reg) << ((sel % 4) * 4)); 272 val |= (BIT(reg % 4) << ((sel % 4) * 4));
273 bcm6328_led_write(addr, val); 273 bcm6328_led_write(addr, val);
274 spin_unlock_irqrestore(lock, flags); 274 spin_unlock_irqrestore(lock, flags);
275 } 275 }
diff --git a/drivers/leds/trigger/ledtrig-heartbeat.c b/drivers/leds/trigger/ledtrig-heartbeat.c
index afa3b4099214..e95ea65380c8 100644
--- a/drivers/leds/trigger/ledtrig-heartbeat.c
+++ b/drivers/leds/trigger/ledtrig-heartbeat.c
@@ -20,7 +20,6 @@
20#include <linux/sched/loadavg.h> 20#include <linux/sched/loadavg.h>
21#include <linux/leds.h> 21#include <linux/leds.h>
22#include <linux/reboot.h> 22#include <linux/reboot.h>
23#include <linux/suspend.h>
24#include "../leds.h" 23#include "../leds.h"
25 24
26static int panic_heartbeats; 25static int panic_heartbeats;
@@ -163,30 +162,6 @@ static struct led_trigger heartbeat_led_trigger = {
163 .deactivate = heartbeat_trig_deactivate, 162 .deactivate = heartbeat_trig_deactivate,
164}; 163};
165 164
166static int heartbeat_pm_notifier(struct notifier_block *nb,
167 unsigned long pm_event, void *unused)
168{
169 int rc;
170
171 switch (pm_event) {
172 case PM_SUSPEND_PREPARE:
173 case PM_HIBERNATION_PREPARE:
174 case PM_RESTORE_PREPARE:
175 led_trigger_unregister(&heartbeat_led_trigger);
176 break;
177 case PM_POST_SUSPEND:
178 case PM_POST_HIBERNATION:
179 case PM_POST_RESTORE:
180 rc = led_trigger_register(&heartbeat_led_trigger);
181 if (rc)
182 pr_err("could not re-register heartbeat trigger\n");
183 break;
184 default:
185 break;
186 }
187 return NOTIFY_DONE;
188}
189
190static int heartbeat_reboot_notifier(struct notifier_block *nb, 165static int heartbeat_reboot_notifier(struct notifier_block *nb,
191 unsigned long code, void *unused) 166 unsigned long code, void *unused)
192{ 167{
@@ -201,10 +176,6 @@ static int heartbeat_panic_notifier(struct notifier_block *nb,
201 return NOTIFY_DONE; 176 return NOTIFY_DONE;
202} 177}
203 178
204static struct notifier_block heartbeat_pm_nb = {
205 .notifier_call = heartbeat_pm_notifier,
206};
207
208static struct notifier_block heartbeat_reboot_nb = { 179static struct notifier_block heartbeat_reboot_nb = {
209 .notifier_call = heartbeat_reboot_notifier, 180 .notifier_call = heartbeat_reboot_notifier,
210}; 181};
@@ -221,14 +192,12 @@ static int __init heartbeat_trig_init(void)
221 atomic_notifier_chain_register(&panic_notifier_list, 192 atomic_notifier_chain_register(&panic_notifier_list,
222 &heartbeat_panic_nb); 193 &heartbeat_panic_nb);
223 register_reboot_notifier(&heartbeat_reboot_nb); 194 register_reboot_notifier(&heartbeat_reboot_nb);
224 register_pm_notifier(&heartbeat_pm_nb);
225 } 195 }
226 return rc; 196 return rc;
227} 197}
228 198
229static void __exit heartbeat_trig_exit(void) 199static void __exit heartbeat_trig_exit(void)
230{ 200{
231 unregister_pm_notifier(&heartbeat_pm_nb);
232 unregister_reboot_notifier(&heartbeat_reboot_nb); 201 unregister_reboot_notifier(&heartbeat_reboot_nb);
233 atomic_notifier_chain_unregister(&panic_notifier_list, 202 atomic_notifier_chain_unregister(&panic_notifier_list,
234 &heartbeat_panic_nb); 203 &heartbeat_panic_nb);