From: Xiaoming Ni <nixiaoming@huawei.com>
To: <linux-kernel@vger.kernel.org>, <linux-leds@vger.kernel.org>,
<pavel@ucw.cz>, <dmurphy@ti.com>, <akpm@linux-foundation.org>,
<keescook@chromium.org>, <gpiccoli@canonical.com>,
<penguin-kernel@i-love.sakura.ne.jp>
Cc: <nixiaoming@huawei.com>, <wangle6@huawei.com>
Subject: [PATCH 4/4] leds:trigger:ledtrig-heartbeat: Replace "panic_heartbeats" with is_be_panic()
Date: Fri, 18 Dec 2020 19:44:06 +0800 [thread overview]
Message-ID: <20201218114406.61906-5-nixiaoming@huawei.com> (raw)
In-Reply-To: <20201218114406.61906-1-nixiaoming@huawei.com>
Replace the global variable "panic_heartbeats" with is_be_panic()
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
---
drivers/leds/trigger/ledtrig-heartbeat.c | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/drivers/leds/trigger/ledtrig-heartbeat.c b/drivers/leds/trigger/ledtrig-heartbeat.c
index 36b6709afe9f..3c34d49f0ed8 100644
--- a/drivers/leds/trigger/ledtrig-heartbeat.c
+++ b/drivers/leds/trigger/ledtrig-heartbeat.c
@@ -19,8 +19,6 @@
#include <linux/reboot.h>
#include "../leds.h"
-static int panic_heartbeats;
-
struct heartbeat_trig_data {
struct led_classdev *led_cdev;
unsigned int phase;
@@ -39,7 +37,7 @@ static void led_heartbeat_function(struct timer_list *t)
led_cdev = heartbeat_data->led_cdev;
- if (unlikely(panic_heartbeats)) {
+ if (unlikely(is_being_panic())) {
led_set_brightness_nosleep(led_cdev, LED_OFF);
return;
}
@@ -169,28 +167,15 @@ static int heartbeat_reboot_notifier(struct notifier_block *nb,
return NOTIFY_DONE;
}
-static int heartbeat_panic_notifier(struct notifier_block *nb,
- unsigned long code, void *unused)
-{
- panic_heartbeats = 1;
- return NOTIFY_DONE;
-}
-
static struct notifier_block heartbeat_reboot_nb = {
.notifier_call = heartbeat_reboot_notifier,
};
-static struct notifier_block heartbeat_panic_nb = {
- .notifier_call = heartbeat_panic_notifier,
-};
-
static int __init heartbeat_trig_init(void)
{
int rc = led_trigger_register(&heartbeat_led_trigger);
if (!rc) {
- atomic_notifier_chain_register(&panic_notifier_list,
- &heartbeat_panic_nb);
register_reboot_notifier(&heartbeat_reboot_nb);
}
return rc;
@@ -199,8 +184,6 @@ static int __init heartbeat_trig_init(void)
static void __exit heartbeat_trig_exit(void)
{
unregister_reboot_notifier(&heartbeat_reboot_nb);
- atomic_notifier_chain_unregister(&panic_notifier_list,
- &heartbeat_panic_nb);
led_trigger_unregister(&heartbeat_led_trigger);
}
--
2.27.0
prev parent reply other threads:[~2020-12-18 11:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-18 11:44 [PATCH 0/4] Add new API is_being_panic() Xiaoming Ni
2020-12-18 11:44 ` [PATCH 1/4] panic: " Xiaoming Ni
2020-12-18 11:44 ` [PATCH 2/4] hung_task: Replace "did_panic" with is_be_panic() Xiaoming Ni
2020-12-18 12:59 ` Pavel Machek
2020-12-18 14:36 ` Tetsuo Handa
2020-12-18 17:06 ` Randy Dunlap
2020-12-20 2:58 ` Xiaoming Ni
2020-12-18 11:44 ` [PATCH 3/4] leds:trigger:ledtrig-activity Replace "panic_detected" " Xiaoming Ni
2020-12-18 11:44 ` Xiaoming Ni [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201218114406.61906-5-nixiaoming@huawei.com \
--to=nixiaoming@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=dmurphy@ti.com \
--cc=gpiccoli@canonical.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=wangle6@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®