All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ledtrig-cpu: Handle CPU hot(un)plugging
@ 2014-01-22 16:32 Pawel Moll
  2014-02-06 17:06 ` Pawel Moll
  0 siblings, 1 reply; 3+ messages in thread
From: Pawel Moll @ 2014-01-22 16:32 UTC (permalink / raw)
  To: linux-leds, Bryan Wu, Richard Purdie; +Cc: Linus Walleij, Pawel Moll

When CPU is hot(un)plugged, no syscore notification is being
generated, nor is cpuidle involved. This leaves the CPU LED
turned on, because the dying thread is doing some work (LED on)
and than it is... well, dying (LED still on :-)

Added notifier block for hot(un)plugging operations, generating
existing trigger events.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
 drivers/leds/trigger/ledtrig-cpu.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/leds/trigger/ledtrig-cpu.c b/drivers/leds/trigger/ledtrig-cpu.c
index 118335e..1c3ee9f 100644
--- a/drivers/leds/trigger/ledtrig-cpu.c
+++ b/drivers/leds/trigger/ledtrig-cpu.c
@@ -26,6 +26,7 @@
 #include <linux/percpu.h>
 #include <linux/syscore_ops.h>
 #include <linux/rwsem.h>
+#include <linux/cpu.h>
 #include "../leds.h"
 
 #define MAX_NAME_LEN	8
@@ -92,6 +93,26 @@ static struct syscore_ops ledtrig_cpu_syscore_ops = {
 	.resume		= ledtrig_cpu_syscore_resume,
 };
 
+static int ledtrig_cpu_notify(struct notifier_block *self,
+					   unsigned long action, void *hcpu)
+{
+	switch (action & ~CPU_TASKS_FROZEN) {
+	case CPU_STARTING:
+		ledtrig_cpu(CPU_LED_START);
+		break;
+	case CPU_DYING:
+		ledtrig_cpu(CPU_LED_STOP);
+		break;
+	}
+
+	return NOTIFY_OK;
+}
+
+
+static struct notifier_block ledtrig_cpu_nb = {
+	.notifier_call = ledtrig_cpu_notify,
+};
+
 static int __init ledtrig_cpu_init(void)
 {
 	int cpu;
@@ -113,6 +134,7 @@ static int __init ledtrig_cpu_init(void)
 	}
 
 	register_syscore_ops(&ledtrig_cpu_syscore_ops);
+	register_cpu_notifier(&ledtrig_cpu_nb);
 
 	pr_info("ledtrig-cpu: registered to indicate activity on CPUs\n");
 
@@ -124,6 +146,8 @@ static void __exit ledtrig_cpu_exit(void)
 {
 	int cpu;
 
+	unregister_cpu_notifier(&ledtrig_cpu_nb);
+
 	for_each_possible_cpu(cpu) {
 		struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
 
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ledtrig-cpu: Handle CPU hot(un)plugging
  2014-01-22 16:32 [PATCH] ledtrig-cpu: Handle CPU hot(un)plugging Pawel Moll
@ 2014-02-06 17:06 ` Pawel Moll
  2014-02-06 17:15   ` Bryan Wu
  0 siblings, 1 reply; 3+ messages in thread
From: Pawel Moll @ 2014-02-06 17:06 UTC (permalink / raw)
  To: Bryan Wu, Richard Purdie; +Cc: linux-leds@vger.kernel.org, Linus Walleij

On Wed, 2014-01-22 at 16:32 +0000, Pawel Moll wrote:
> When CPU is hot(un)plugged, no syscore notification is being
> generated, nor is cpuidle involved. This leaves the CPU LED
> turned on, because the dying thread is doing some work (LED on)
> and than it is... well, dying (LED still on :-)
> 
> Added notifier block for hot(un)plugging operations, generating
> existing trigger events.
> 
> Signed-off-by: Pawel Moll <pawel.moll@arm.com>

This is just a friendly and polite ping :-)

Pawel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ledtrig-cpu: Handle CPU hot(un)plugging
  2014-02-06 17:06 ` Pawel Moll
@ 2014-02-06 17:15   ` Bryan Wu
  0 siblings, 0 replies; 3+ messages in thread
From: Bryan Wu @ 2014-02-06 17:15 UTC (permalink / raw)
  To: Pawel Moll; +Cc: Richard Purdie, linux-leds@vger.kernel.org, Linus Walleij

On Thu, Feb 6, 2014 at 9:06 AM, Pawel Moll <pawel.moll@arm.com> wrote:
> On Wed, 2014-01-22 at 16:32 +0000, Pawel Moll wrote:
>> When CPU is hot(un)plugged, no syscore notification is being
>> generated, nor is cpuidle involved. This leaves the CPU LED
>> turned on, because the dying thread is doing some work (LED on)
>> and than it is... well, dying (LED still on :-)
>>
>> Added notifier block for hot(un)plugging operations, generating
>> existing trigger events.
>>
>> Signed-off-by: Pawel Moll <pawel.moll@arm.com>
>
> This is just a friendly and polite ping :-)
>

Just back from a vacation recently, start to catch up patch emails, :-)
This patch looks good to me, I will merge it.

Thanks,
-Bryan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-06 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-22 16:32 [PATCH] ledtrig-cpu: Handle CPU hot(un)plugging Pawel Moll
2014-02-06 17:06 ` Pawel Moll
2014-02-06 17:15   ` Bryan Wu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.