[PATCH v2 3/4] leds:trigger:ledtrig-activity Replace "panic_detected" with in_panic_state()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Replace the global variable "panic_detected" with in_panic_state()

Signed-off-by: Xiaoming Ni <nixiaoming@xxxxxxxxxx>
---
 drivers/leds/trigger/ledtrig-activity.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/drivers/leds/trigger/ledtrig-activity.c b/drivers/leds/trigger/ledtrig-activity.c
index 14ba7faaed9e..9675c9348516 100644
--- a/drivers/leds/trigger/ledtrig-activity.c
+++ b/drivers/leds/trigger/ledtrig-activity.c
@@ -17,8 +17,6 @@
 #include <linux/timer.h>
 #include "../leds.h"
 
-static int panic_detected;
-
 struct activity_data {
 	struct timer_list timer;
 	struct led_classdev *led_cdev;
@@ -47,7 +45,7 @@ static void led_activity_function(struct timer_list *t)
 	if (test_and_clear_bit(LED_BLINK_BRIGHTNESS_CHANGE, &led_cdev->work_flags))
 		led_cdev->blink_brightness = led_cdev->new_blink_brightness;
 
-	if (unlikely(panic_detected)) {
+	if (unlikely(in_panic_state())) {
 		/* full brightness in case of panic */
 		led_set_brightness_nosleep(led_cdev, led_cdev->blink_brightness);
 		return;
@@ -226,28 +224,15 @@ static int activity_reboot_notifier(struct notifier_block *nb,
 	return NOTIFY_DONE;
 }
 
-static int activity_panic_notifier(struct notifier_block *nb,
-                                   unsigned long code, void *unused)
-{
-	panic_detected = 1;
-	return NOTIFY_DONE;
-}
-
 static struct notifier_block activity_reboot_nb = {
 	.notifier_call = activity_reboot_notifier,
 };
 
-static struct notifier_block activity_panic_nb = {
-	.notifier_call = activity_panic_notifier,
-};
-
 static int __init activity_init(void)
 {
 	int rc = led_trigger_register(&activity_led_trigger);
 
 	if (!rc) {
-		atomic_notifier_chain_register(&panic_notifier_list,
-					       &activity_panic_nb);
 		register_reboot_notifier(&activity_reboot_nb);
 	}
 	return rc;
@@ -256,8 +241,6 @@ static int __init activity_init(void)
 static void __exit activity_exit(void)
 {
 	unregister_reboot_notifier(&activity_reboot_nb);
-	atomic_notifier_chain_unregister(&panic_notifier_list,
-					 &activity_panic_nb);
 	led_trigger_unregister(&activity_led_trigger);
 }
 
-- 
2.27.0




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux