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: <1440081846-11697-2-git-send-email-j.anaszewski@samsung.com>
Date:	Thu, 20 Aug 2015 16:43:31 +0200
From:	Jacek Anaszewski <j.anaszewski@...sung.com>
To:	linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:	Jacek Anaszewski <j.anaszewski@...sung.com>,
	Andrew Lunn <andrew@...n.ch>,
	Sakari Ailus <sakari.ailus@...ux.intel.com>,
	Pavel Machek <pavel@....cz>,
	Stas Sergeev <stsp@...rs.sourceforge.net>
Subject: [PATCH/RFC v6 01/36] leds: Add brightness_set_blocking op

This patch adds a new brightness_set_blocking op to the LED subsystem.
The op is intended for drivers that set brightness in a blocking way,
i.e. they either can sleep or use delays while setting brightness.

Signed-off-by: Jacek Anaszewski <j.anaszewski@...sung.com>
Cc: Andrew Lunn <andrew@...n.ch>
Cc: Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: Pavel Machek <pavel@....cz>
Cc: Stas Sergeev <stsp@...rs.sourceforge.net>
---
 drivers/leds/led-class.c |    3 +++
 include/linux/leds.h     |    6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index ca51d58..93a2414 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -267,6 +267,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
 		dev_warn(parent, "Led %s renamed to %s due to name collision",
 				led_cdev->name, dev_name(led_cdev->dev));
 
+	WARN_ON(led_cdev->brightness_set &&
+		led_cdev->brightness_set_blocking);
+
 #ifdef CONFIG_LEDS_TRIGGERS
 	init_rwsem(&led_cdev->trigger_lock);
 #endif
diff --git a/include/linux/leds.h b/include/linux/leds.h
index b122eea..85fad6b 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -54,6 +54,12 @@ struct led_classdev {
 	void		(*brightness_set)(struct led_classdev *led_cdev,
 					  enum led_brightness brightness);
 	/*
+	 * Intended for drivers that either can sleep or use delays while
+	 * setting brightness.
+	 */
+	int (*brightness_set_blocking)(struct led_classdev *led_cdev,
+				       enum led_brightness brightness);
+	/*
 	 * Set LED brightness level immediately - it can block the caller for
 	 * the time required for accessing a LED device register.
 	 */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ