Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3276349pxu; Sat, 19 Dec 2020 19:47:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFndpxbnIL672OP1LAunYu3t3GKWyZk4AajhGVotD3RqgFQDgpH7LqI5EABJGp9cWJ7ofB X-Received: by 2002:a05:6402:1ad1:: with SMTP id ba17mr10826920edb.51.1608436049600; Sat, 19 Dec 2020 19:47:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608436049; cv=none; d=google.com; s=arc-20160816; b=PxxTdmMZClfmjkuHl5EF9Ugc5xeWIJsLzRBZWWPJvqnc8S1ZqnrmyXsQQ334r4dSrr hI0Yem2xNULgeup2TCof242RGTThFI/XAFSiBn7IH7AcKIkYu+1+AlzaFS/QNg/t26GF rUtCOd46v3oAEBOh/W7y1nVVRWt/DnxRoAF5JA/LZBGwYinznJ14EUyKEZMAqu0uJ04d gUjxgvX7N9zBKw8poLmyZ3uTOptDOLIGXUPpxpN3bu+cz1ReOqBFQfQLHc6d76AIg7rv zG9rcdcMeJAn2hx7gr/3AVZAOvSGJACsSfihTLhXu52iNXODzGCa5keyLLZ75rY3Snft l8DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=V+SVuW8EV+Cty/rTzhdTYZ4cetl7vZ6ZjB/PqrIdSMM=; b=l6qk2g4MBTR98FlIObjiOTTdMMeTgM8RBed1nN+84mYLHdT4IrxEPS9rPYs2yB2j9e xdFqMNTFhooSu5Xx7x0zJMCrcM6AdeEcc8tcmOcEZwYnZvXOh2rojvL8JU4+oYu0eIe5 yPfPAFSukFgkQQVOoH0Vs6CNlJutZ6UDITvuf5/F9kkQDbnMENsSUb/Gh4RvnCo0jSy6 fxpU+Zx1PB9yTWqx9VEuHfZc20RF0aGPQ7dZ2MDrA+CGsE8JnJr3vs5bndQY0OyYuiQw 3lmerNblRRy+FNlqMztqABu2VvAFUv2hM2eHk5Do6rFyNqZbDGt8X030+6DToqegkUuA KB5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s23si8587208eds.566.2020.12.19.19.47.07; Sat, 19 Dec 2020 19:47:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727605AbgLTDqJ (ORCPT + 99 others); Sat, 19 Dec 2020 22:46:09 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9542 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726923AbgLTDqA (ORCPT ); Sat, 19 Dec 2020 22:46:00 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Cz7lB0RjHzhvJy; Sun, 20 Dec 2020 11:44:38 +0800 (CST) Received: from use12-sp2.huawei.com (10.67.189.174) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Sun, 20 Dec 2020 11:45:08 +0800 From: Xiaoming Ni To: , , , , , , , , CC: , Subject: [PATCH v2 4/4] leds:trigger:ledtrig-heartbeat: Replace "panic_heartbeats" with in_panic_state() Date: Sun, 20 Dec 2020 11:45:05 +0800 Message-ID: <20201220034505.113118-5-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201220034505.113118-1-nixiaoming@huawei.com> References: <20201220034505.113118-1-nixiaoming@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.189.174] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace the global variable "panic_heartbeats" with in_panic_state() Signed-off-by: Xiaoming Ni --- 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..f24d64cf0a62 100644 --- a/drivers/leds/trigger/ledtrig-heartbeat.c +++ b/drivers/leds/trigger/ledtrig-heartbeat.c @@ -19,8 +19,6 @@ #include #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(in_panic_state())) { 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