lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210906135320.23134-2-chaochao2021666@163.com>
Date:   Mon,  6 Sep 2021 21:53:19 +0800
From:   chaochao2021666@....com
To:     pavel@....cz
Cc:     linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, jan.kiszk@...mens.com,
        464759471@...com, chao zeng <chao.zeng@...mens.com>
Subject: [PATCH 2/3] leds:gpio:Add the support for "panic-indicator-on" and "panic-indicator-off"

From: chao zeng <chao.zeng@...mens.com>

This commit extend the panic indicator,allowing to set LED a variety of
different of states on a kernel panic.There are on and off state
in addition to blink for a given LED.

Signed-off-by: chao zeng <chao.zeng@...mens.com>
---
 drivers/leds/leds-gpio.c | 9 +++++++++
 include/linux/leds.h     | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 092eb59a7d32..d77ec57f3f71 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -103,6 +103,11 @@ static int create_gpio_led(const struct gpio_led *template,
 		led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
 	if (template->panic_indicator)
 		led_dat->cdev.flags |= LED_PANIC_INDICATOR;
+	else if (template->panic_indicator_on)
+		led_dat->cdev.flags |= LED_PANIC_INDICATOR_ON;
+	else if (template->panic_indicator_off)
+		led_dat->cdev.flags |= LED_PANIC_INDICATOR_OFF;
+
 	if (template->retain_state_shutdown)
 		led_dat->cdev.flags |= LED_RETAIN_AT_SHUTDOWN;
 
@@ -169,6 +174,10 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
 			led.retain_state_shutdown = 1;
 		if (fwnode_property_present(child, "panic-indicator"))
 			led.panic_indicator = 1;
+		else if (fwnode_property_present(child, "panic-indicator-on"))
+			led.panic_indicator_on = 1;
+		else if (fwnode_property_present(child, "panic-indicator-off"))
+			led.panic_indicator_off = 1;
 
 		ret = create_gpio_led(&led, led_dat, dev, child, NULL);
 		if (ret < 0) {
diff --git a/include/linux/leds.h b/include/linux/leds.h
index a0b730be40ad..6b3ae1dbc65f 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -85,6 +85,8 @@ struct led_classdev {
 #define LED_BRIGHT_HW_CHANGED	BIT(21)
 #define LED_RETAIN_AT_SHUTDOWN	BIT(22)
 #define LED_INIT_DEFAULT_TRIGGER BIT(23)
+#define LED_PANIC_INDICATOR_ON	BIT(24)
+#define LED_PANIC_INDICATOR_OFF	BIT(25)
 
 	/* set_brightness_work / blink_timer flags, atomic, private. */
 	unsigned long		work_flags;
@@ -521,6 +523,8 @@ struct gpio_led {
 	unsigned	active_low : 1;
 	unsigned	retain_state_suspended : 1;
 	unsigned	panic_indicator : 1;
+	unsigned	panic_indicator_on : 1;
+	unsigned	panic_indicator_off : 1;
 	unsigned	default_state : 2;
 	unsigned	retain_state_shutdown : 1;
 	/* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */
-- 
2.17.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ