[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201218114406.61906-4-nixiaoming@huawei.com>
Date: Fri, 18 Dec 2020 19:44:05 +0800
From: Xiaoming Ni <nixiaoming@...wei.com>
To: <linux-kernel@...r.kernel.org>, <linux-leds@...r.kernel.org>,
<pavel@....cz>, <dmurphy@...com>, <akpm@...ux-foundation.org>,
<keescook@...omium.org>, <gpiccoli@...onical.com>,
<penguin-kernel@...ove.sakura.ne.jp>
CC: <nixiaoming@...wei.com>, <wangle6@...wei.com>
Subject: [PATCH 3/4] leds:trigger:ledtrig-activity Replace "panic_detected" with is_be_panic()
Replace the global variable "panic_detected" with is_be_panic()
Signed-off-by: Xiaoming Ni <nixiaoming@...wei.com>
---
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..bbacb3dbe341 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(is_being_panic())) {
/* 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
Powered by blists - more mailing lists