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: <20240526-cros_ec-kbd-led-framework-v3-2-ee577415a521@weissschuh.net>
Date: Sun, 26 May 2024 20:17:16 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Lee Jones <lee@...nel.org>, Benson Leung <bleung@...omium.org>, 
 Guenter Roeck <groeck@...omium.org>, Tzung-Bi Shih <tzungbi@...nel.org>, 
 Pavel Machek <pavel@....cz>
Cc: chrome-platform@...ts.linux.dev, linux-kernel@...r.kernel.org, 
 Dustin Howett <dustin@...ett.net>, 
 Mario Limonciello <mario.limonciello@....com>, linux-leds@...r.kernel.org, 
 Rajas Paranjpe <paranjperajas@...il.com>, 
 Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH v3 2/4] leds: add flag to avoid automatic renaming of led
 devices

Add a mechanism for drivers to opt-out of the automatic device renaming
on conflicts.
Those drivers will provide their own conflict resolution.

Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
 drivers/leds/led-class.c | 2 ++
 include/linux/leds.h     | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index c298355d5b7d..2f08c20702f3 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -503,6 +503,8 @@ int led_classdev_register_ext(struct device *parent,
 	ret = led_classdev_next_name(proposed_name, final_name, sizeof(final_name));
 	if (ret < 0)
 		return ret;
+	else if (ret && led_cdev->flags & LED_REJECT_NAME_CONFLICT)
+		return -EEXIST;
 	else if (ret)
 		dev_warn(parent, "Led %s renamed to %s due to name collision\n",
 			 proposed_name, final_name);
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 6300313c46b7..36663ac6c58a 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -107,6 +107,7 @@ 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_REJECT_NAME_CONFLICT BIT(24)
 
 	/* set_brightness_work / blink_timer flags, atomic, private. */
 	unsigned long		work_flags;

-- 
2.45.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ