Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1234439 > unrolled thread

[PATCH 0/3] leds: add device trigger

Started byMaciek Borzecki <maciek.borzecki@gmail.com>
First post2015-09-28 22:50 +0200
Last post2015-09-28 22:50 +0200
Articles 8 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] leds: add device trigger Maciek Borzecki <maciek.borzecki@gmail.com> - 2015-09-28 22:50 +0200
    [PATCH 2/3] leds: add debugfs to device trigger Maciek Borzecki <maciek.borzecki@gmail.com> - 2015-09-28 22:50 +0200
      Re: [PATCH 2/3] leds: add debugfs to device trigger kbuild test robot <lkp@intel.com> - 2015-09-29 05:50 +0200
        Re: [PATCH 2/3] leds: add debugfs to device trigger Maciek Borzecki <maciek.borzecki@gmail.com> - 2015-09-29 09:10 +0200
      Re: [PATCH 2/3] leds: add debugfs to device trigger Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-09-30 16:10 +0200
        Re: [PATCH 2/3] leds: add debugfs to device trigger Maciek Borzecki <maciek.borzecki@gmail.com> - 2015-09-30 17:50 +0200
          Re: [PATCH 2/3] leds: add debugfs to device trigger Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-10-01 09:40 +0200
    [PATCH 3/3] Documentation: leds: document ledtrig-device trigger Maciek Borzecki <maciek.borzecki@gmail.com> - 2015-09-28 22:50 +0200

#1234439 — [PATCH 0/3] leds: add device trigger

FromMaciek Borzecki <maciek.borzecki@gmail.com>
Date2015-09-28 22:50 +0200
Subject[PATCH 0/3] leds: add device trigger
Message-ID<qdNx1-23T-25@gated-at.bofh.it>
A series of patches that add yet another LED trigger, a device
activity trigger.

The motivation is to have a LED trigger that is associated with a
device and can be fired from cetrain points in the code that have been
chosen by the developer. With this this device activity trigger it is
possible for instance to easily hook up a tty driver for a console to
blink one LED, yet another serial port to blink a second LED and
writes to a block device to trigger a third LED.

The patches have been tested on Wandboard Quad.

The first patch adds the actual trigger. Each device wishing to use
the trigger has to be explicitly registered by calling
ledtrig_dev_add(), and passing it's dev_t. The intention is that the
trigger will be used in scenarios that are impossible to foresee at
this moment, and are likely to be approach in a case by case manner
anyway.

The second patch adds couple of debugfs helpers.

The third patch adds documentation and notes on debugfs interface.

Maciek Borzecki (3):
  leds: add device activity LED triggers
  leds: add debugfs to device trigger
  Documentation: leds: document ledtrig-device trigger

 Documentation/leds/00-INDEX           |   3 +
 Documentation/leds/ledtrig-device.txt |  32 ++++
 drivers/leds/trigger/Kconfig          |   8 +
 drivers/leds/trigger/Makefile         |   1 +
 drivers/leds/trigger/ledtrig-device.c | 289 ++++++++++++++++++++++++++++++++++
 include/linux/leds.h                  |  10 ++
 6 files changed, 343 insertions(+)
 create mode 100644 Documentation/leds/ledtrig-device.txt
 create mode 100644 drivers/leds/trigger/ledtrig-device.c

-- 
2.5.3

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

[toc] | [next] | [standalone]


#1234440 — [PATCH 2/3] leds: add debugfs to device trigger

FromMaciek Borzecki <maciek.borzecki@gmail.com>
Date2015-09-28 22:50 +0200
Subject[PATCH 2/3] leds: add debugfs to device trigger
Message-ID<qdNx1-23T-23@gated-at.bofh.it>
In reply to#1234439
Add debugfs entries for device activity trigger. Three entries are
created under /sys/kernel/debug/ledtrig-dev when the driver gets
loaded. These are:

  devices - cat'ing will produce a list of currently registered devices
            in <major>:<minor> format, a line for each device.

  register - echo'ing <major>:<minor> will create a trigger for this
             device

  trigger - echo'ing <major>:<minor> will fire a trigger for this device

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 drivers/leds/trigger/ledtrig-device.c | 113 +++++++++++++++++++++++++++++++++-
 1 file changed, 111 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/trigger/ledtrig-device.c b/drivers/leds/trigger/ledtrig-device.c
index dbb8d7d2b4a0258149c581a040c416d412d9ceeb..6814db5e34d76974ae095d2e1c8f1f2e23dea79e 100644
--- a/drivers/leds/trigger/ledtrig-device.c
+++ b/drivers/leds/trigger/ledtrig-device.c
@@ -16,15 +16,18 @@
 #include <linux/list.h>
 #include <linux/rwsem.h>
 #include <linux/kdev_t.h>
+#include <linux/fs.h>
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
 
 #define BLINK_DELAY 30
 static unsigned long blink_delay = BLINK_DELAY;
 
 static DECLARE_RWSEM(devs_list_lock);
 static LIST_HEAD(devs_list);
+static struct dentry *debug_root;
 
 #define MAX_NAME_LEN 20
-
 struct ledtrig_dev_data {
 	char name[MAX_NAME_LEN];
 	dev_t dev;
@@ -114,8 +117,11 @@ void ledtrig_dev_add(dev_t dev)
 		/* register with led triggers */
 		led_trigger_register_simple(new_dev_trig->name,
 					    &new_dev_trig->trig);
-	else
+	else {
+		pr_warn("device %u:%u already registered\n",
+			MAJOR(dev), MINOR(dev));
 		kfree(new_dev_trig);
+	}
 }
 EXPORT_SYMBOL(ledtrig_dev_add);
 
@@ -167,13 +173,116 @@ static void ledtrig_dev_remove_all(void)
 	up_write(&devs_list_lock);
 }
 
+static int ledtrig_dev_devices_show(struct seq_file *s, void *unused)
+{
+	struct ledtrig_dev_data *dev_trig;
+
+	down_read(&devs_list_lock);
+	list_for_each_entry(dev_trig, &devs_list, node) {
+		seq_printf(s, "%u:%u\n", MAJOR(dev_trig->dev),
+			MINOR(dev_trig->dev));
+	}
+	up_read(&devs_list_lock);
+	return 0;
+}
+
+static int ledtrig_dev_devices_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, ledtrig_dev_devices_show,
+			   &inode->i_private);
+}
+
+static const struct file_operations debug_devices_ops = {
+	.owner = THIS_MODULE,
+	.open = ledtrig_dev_devices_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release
+};
+
+static int get_dev_from_user(const char __user *buf, size_t size,
+			dev_t *dev)
+{
+	unsigned int major;
+	unsigned int minor;
+	int ret;
+
+	WARN_ON(dev == NULL);
+	if (dev == NULL)
+		return -EINVAL;
+
+	ret = sscanf(buf, "%u:%u", &major, &minor);
+	if (ret < 2)
+		return -EINVAL;
+
+	*dev = MKDEV(major, minor);
+	return 0;
+}
+
+static ssize_t ledtrig_dev_register_write(struct file *filp,
+					const char __user *buf,
+					size_t size, loff_t *off)
+{
+	dev_t dev;
+	int ret;
+
+	ret = get_dev_from_user(buf, size, &dev);
+	if (ret < 0)
+		return ret;
+
+	pr_debug("got device %u:%u\n", MAJOR(dev), MINOR(dev));
+	ledtrig_dev_add(dev);
+
+	return size;
+}
+
+static const struct file_operations debug_register_ops = {
+	.owner = THIS_MODULE,
+	.write = ledtrig_dev_register_write,
+};
+
+static ssize_t ledtrig_dev_trigger_write(struct file *filp,
+					const char __user *buf,
+					size_t size, loff_t *off)
+{
+	dev_t dev;
+	int ret;
+
+	ret = get_dev_from_user(buf, size, &dev);
+	if (ret < 0)
+		return ret;
+
+	pr_debug("trigger device %u:%u\n", MAJOR(dev), MINOR(dev));
+	ledtrig_dev_activity(dev);
+
+	return size;
+}
+
+static const struct file_operations debug_trigger_ops = {
+	.owner = THIS_MODULE,
+	.write = ledtrig_dev_trigger_write,
+};
+
 static int __init ledtrig_dev_init(void)
 {
+	debug_root = debugfs_create_dir("ledtrig-dev", NULL);
+
+	if (debug_root) {
+		debugfs_create_file("devices", 0444, debug_root, NULL,
+				&debug_devices_ops);
+		debugfs_create_file("register", 0200, debug_root, NULL,
+				&debug_register_ops);
+		debugfs_create_file("trigger", 0200, debug_root, NULL,
+				&debug_trigger_ops);
+	}
+
 	return 0;
 }
 
 static void __exit ledtrig_dev_exit(void)
 {
+	debugfs_remove_recursive(debug_root);
+
 	ledtrig_dev_remove_all();
 }
 
-- 
2.5.3

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

[toc] | [prev] | [next] | [standalone]


#1234678 — Re: [PATCH 2/3] leds: add debugfs to device trigger

Fromkbuild test robot <lkp@intel.com>
Date2015-09-29 05:50 +0200
SubjectRe: [PATCH 2/3] leds: add debugfs to device trigger
Message-ID<qdU5r-373-9@gated-at.bofh.it>
In reply to#1234440
Hi Maciek,

[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]

reproduce:
  # apt-get install sparse
  make ARCH=x86_64 allmodconfig
  make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/leds/trigger/ledtrig-device.c:214:22: sparse: incorrect type in argument 1 (different address spaces)
   drivers/leds/trigger/ledtrig-device.c:214:22:    expected char const *<noident>
   drivers/leds/trigger/ledtrig-device.c:214:22:    got char const [noderef] <asn:1>*buf

vim +214 drivers/leds/trigger/ledtrig-device.c

   198		.read = seq_read,
   199		.llseek = seq_lseek,
   200		.release = single_release
   201	};
   202	
   203	static int get_dev_from_user(const char __user *buf, size_t size,
   204				dev_t *dev)
   205	{
   206		unsigned int major;
   207		unsigned int minor;
   208		int ret;
   209	
   210		WARN_ON(dev == NULL);
   211		if (dev == NULL)
   212			return -EINVAL;
   213	
 > 214		ret = sscanf(buf, "%u:%u", &major, &minor);
   215		if (ret < 2)
   216			return -EINVAL;
   217	
   218		*dev = MKDEV(major, minor);
   219		return 0;
   220	}
   221	
   222	static ssize_t ledtrig_dev_register_write(struct file *filp,

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1234758 — Re: [PATCH 2/3] leds: add debugfs to device trigger

FromMaciek Borzecki <maciek.borzecki@gmail.com>
Date2015-09-29 09:10 +0200
SubjectRe: [PATCH 2/3] leds: add debugfs to device trigger
Message-ID<qdXcZ-7KR-5@gated-at.bofh.it>
In reply to#1234678
On 09/29 11:41, kbuild test robot wrote:
> Hi Maciek,
>
> [auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]
>
> reproduce:
>   # apt-get install sparse
>   make ARCH=x86_64 allmodconfig
>   make C=1 CF=-D__CHECK_ENDIAN__
>
>
> sparse warnings: (new ones prefixed by >>)
>
> >> drivers/leds/trigger/ledtrig-device.c:214:22: sparse: incorrect type in argument 1 (different address spaces)
>    drivers/leds/trigger/ledtrig-device.c:214:22:    expected char const *<noident>
>    drivers/leds/trigger/ledtrig-device.c:214:22:    got char const [noderef] <asn:1>*buf

Right, noted right after sending the patch. Will fix in v2.

>
> vim +214 drivers/leds/trigger/ledtrig-device.c
>
>    198		.read = seq_read,
>    199		.llseek = seq_lseek,
>    200		.release = single_release
>    201	};
>    202
>    203	static int get_dev_from_user(const char __user *buf, size_t size,
>    204				dev_t *dev)
>    205	{
>    206		unsigned int major;
>    207		unsigned int minor;
>    208		int ret;
>    209
>    210		WARN_ON(dev == NULL);
>    211		if (dev == NULL)
>    212			return -EINVAL;
>    213
>  > 214		ret = sscanf(buf, "%u:%u", &major, &minor);
>    215		if (ret < 2)
>    216			return -EINVAL;
>    217
>    218		*dev = MKDEV(major, minor);
>    219		return 0;
>    220	}
>    221
>    222	static ssize_t ledtrig_dev_register_write(struct file *filp,
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

[toc] | [prev] | [next] | [standalone]


#1236327 — Re: [PATCH 2/3] leds: add debugfs to device trigger

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-09-30 16:10 +0200
SubjectRe: [PATCH 2/3] leds: add debugfs to device trigger
Message-ID<qeqf0-7dN-7@gated-at.bofh.it>
In reply to#1234440
Hi Maciek,

Please test your solution thoroughly before submitting
the next version. Writing to debugfs register attribute
fails due to lack of proper copying from user memory,
which makes testing impossible.

Best Regards,
Jacek Anaszewski

On 09/28/2015 10:43 PM, Maciek Borzecki wrote:
> Add debugfs entries for device activity trigger. Three entries are
> created under /sys/kernel/debug/ledtrig-dev when the driver gets
> loaded. These are:
>
>    devices - cat'ing will produce a list of currently registered devices
>              in <major>:<minor> format, a line for each device.
>
>    register - echo'ing <major>:<minor> will create a trigger for this
>               device
>
>    trigger - echo'ing <major>:<minor> will fire a trigger for this device
>
> Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
> ---
>   drivers/leds/trigger/ledtrig-device.c | 113 +++++++++++++++++++++++++++++++++-
>   1 file changed, 111 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/leds/trigger/ledtrig-device.c b/drivers/leds/trigger/ledtrig-device.c
> index dbb8d7d2b4a0258149c581a040c416d412d9ceeb..6814db5e34d76974ae095d2e1c8f1f2e23dea79e 100644
> --- a/drivers/leds/trigger/ledtrig-device.c
> +++ b/drivers/leds/trigger/ledtrig-device.c
> @@ -16,15 +16,18 @@
>   #include <linux/list.h>
>   #include <linux/rwsem.h>
>   #include <linux/kdev_t.h>
> +#include <linux/fs.h>
> +#include <linux/debugfs.h>
> +#include <linux/seq_file.h>
>
>   #define BLINK_DELAY 30
>   static unsigned long blink_delay = BLINK_DELAY;
>
>   static DECLARE_RWSEM(devs_list_lock);
>   static LIST_HEAD(devs_list);
> +static struct dentry *debug_root;
>
>   #define MAX_NAME_LEN 20
> -
>   struct ledtrig_dev_data {
>   	char name[MAX_NAME_LEN];
>   	dev_t dev;
> @@ -114,8 +117,11 @@ void ledtrig_dev_add(dev_t dev)
>   		/* register with led triggers */
>   		led_trigger_register_simple(new_dev_trig->name,
>   					    &new_dev_trig->trig);
> -	else
> +	else {
> +		pr_warn("device %u:%u already registered\n",
> +			MAJOR(dev), MINOR(dev));
>   		kfree(new_dev_trig);
> +	}
>   }
>   EXPORT_SYMBOL(ledtrig_dev_add);
>
> @@ -167,13 +173,116 @@ static void ledtrig_dev_remove_all(void)
>   	up_write(&devs_list_lock);
>   }
>
> +static int ledtrig_dev_devices_show(struct seq_file *s, void *unused)
> +{
> +	struct ledtrig_dev_data *dev_trig;
> +
> +	down_read(&devs_list_lock);
> +	list_for_each_entry(dev_trig, &devs_list, node) {
> +		seq_printf(s, "%u:%u\n", MAJOR(dev_trig->dev),
> +			MINOR(dev_trig->dev));
> +	}
> +	up_read(&devs_list_lock);
> +	return 0;
> +}
> +
> +static int ledtrig_dev_devices_open(struct inode *inode, struct file *file)
> +{
> +	return single_open(file, ledtrig_dev_devices_show,
> +			   &inode->i_private);
> +}
> +
> +static const struct file_operations debug_devices_ops = {
> +	.owner = THIS_MODULE,
> +	.open = ledtrig_dev_devices_open,
> +	.read = seq_read,
> +	.llseek = seq_lseek,
> +	.release = single_release
> +};
> +
> +static int get_dev_from_user(const char __user *buf, size_t size,
> +			dev_t *dev)
> +{
> +	unsigned int major;
> +	unsigned int minor;
> +	int ret;
> +
> +	WARN_ON(dev == NULL);
> +	if (dev == NULL)
> +		return -EINVAL;
> +
> +	ret = sscanf(buf, "%u:%u", &major, &minor);
> +	if (ret < 2)
> +		return -EINVAL;
> +
> +	*dev = MKDEV(major, minor);
> +	return 0;
> +}
> +
> +static ssize_t ledtrig_dev_register_write(struct file *filp,
> +					const char __user *buf,
> +					size_t size, loff_t *off)
> +{
> +	dev_t dev;
> +	int ret;
> +
> +	ret = get_dev_from_user(buf, size, &dev);
> +	if (ret < 0)
> +		return ret;
> +
> +	pr_debug("got device %u:%u\n", MAJOR(dev), MINOR(dev));
> +	ledtrig_dev_add(dev);
> +
> +	return size;
> +}
> +
> +static const struct file_operations debug_register_ops = {
> +	.owner = THIS_MODULE,
> +	.write = ledtrig_dev_register_write,
> +};
> +
> +static ssize_t ledtrig_dev_trigger_write(struct file *filp,
> +					const char __user *buf,
> +					size_t size, loff_t *off)
> +{
> +	dev_t dev;
> +	int ret;
> +
> +	ret = get_dev_from_user(buf, size, &dev);
> +	if (ret < 0)
> +		return ret;
> +
> +	pr_debug("trigger device %u:%u\n", MAJOR(dev), MINOR(dev));
> +	ledtrig_dev_activity(dev);
> +
> +	return size;
> +}
> +
> +static const struct file_operations debug_trigger_ops = {
> +	.owner = THIS_MODULE,
> +	.write = ledtrig_dev_trigger_write,
> +};
> +
>   static int __init ledtrig_dev_init(void)
>   {
> +	debug_root = debugfs_create_dir("ledtrig-dev", NULL);
> +
> +	if (debug_root) {
> +		debugfs_create_file("devices", 0444, debug_root, NULL,
> +				&debug_devices_ops);
> +		debugfs_create_file("register", 0200, debug_root, NULL,
> +				&debug_register_ops);
> +		debugfs_create_file("trigger", 0200, debug_root, NULL,
> +				&debug_trigger_ops);
> +	}
> +
>   	return 0;
>   }
>
>   static void __exit ledtrig_dev_exit(void)
>   {
> +	debugfs_remove_recursive(debug_root);
> +
>   	ledtrig_dev_remove_all();
>   }
>
>


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

[toc] | [prev] | [next] | [standalone]


#1236453 — Re: [PATCH 2/3] leds: add debugfs to device trigger

FromMaciek Borzecki <maciek.borzecki@gmail.com>
Date2015-09-30 17:50 +0200
SubjectRe: [PATCH 2/3] leds: add debugfs to device trigger
Message-ID<qerNN-SV-35@gated-at.bofh.it>
In reply to#1236327
On 09/30 16:08, Jacek Anaszewski wrote:
> Hi Maciek,
>
> Please test your solution thoroughly before submitting
> the next version. Writing to debugfs register attribute
> fails due to lack of proper copying from user memory,
> which makes testing impossible.

Hi, thanks for the comment. Indeed, I noticed the problem just after
sending the patch. Surprisingly this didn't fail on iMX6 for some
reason.

Aside from the __user access problem, is the approach, in general, ok for
you or would you suggest that I changed something?

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

[toc] | [prev] | [next] | [standalone]


#1237081 — Re: [PATCH 2/3] leds: add debugfs to device trigger

FromJacek Anaszewski <j.anaszewski@samsung.com>
Date2015-10-01 09:40 +0200
SubjectRe: [PATCH 2/3] leds: add debugfs to device trigger
Message-ID<qeGD7-5vh-5@gated-at.bofh.it>
In reply to#1236453
On 09/30/2015 05:47 PM, Maciek Borzecki wrote:
> On 09/30 16:08, Jacek Anaszewski wrote:
>> Hi Maciek,
>>
>> Please test your solution thoroughly before submitting
>> the next version. Writing to debugfs register attribute
>> fails due to lack of proper copying from user memory,
>> which makes testing impossible.
>
> Hi, thanks for the comment. Indeed, I noticed the problem just after
> sending the patch. Surprisingly this didn't fail on iMX6 for some
> reason.
>
> Aside from the __user access problem, is the approach, in general, ok for
> you or would you suggest that I changed something?

At first glance the feature looks nice. I'll be able to say more
after testing working version.

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

[toc] | [prev] | [next] | [standalone]


#1234442 — [PATCH 3/3] Documentation: leds: document ledtrig-device trigger

FromMaciek Borzecki <maciek.borzecki@gmail.com>
Date2015-09-28 22:50 +0200
Subject[PATCH 3/3] Documentation: leds: document ledtrig-device trigger
Message-ID<qdNx1-23T-31@gated-at.bofh.it>
In reply to#1234439
This patch adds documentation for ledtrig-device trigger.

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 Documentation/leds/00-INDEX           |  3 +++
 Documentation/leds/ledtrig-device.txt | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 Documentation/leds/ledtrig-device.txt

diff --git a/Documentation/leds/00-INDEX b/Documentation/leds/00-INDEX
index b4ef1f34e25faafe544971f619019d748538e4de..7f18adaadc04756a6b52157a71f86bd131dd915c 100644
--- a/Documentation/leds/00-INDEX
+++ b/Documentation/leds/00-INDEX
@@ -20,3 +20,6 @@ ledtrig-oneshot.txt
 	- One-shot LED trigger for both sporadic and dense events.
 ledtrig-transient.txt
 	- LED Transient Trigger, one shot timer activation.
+ledtrig-device.txt
+        - LED Device Activity Trigger for indicating an activity
+          on a device
\ No newline at end of file
diff --git a/Documentation/leds/ledtrig-device.txt b/Documentation/leds/ledtrig-device.txt
new file mode 100644
index 0000000000000000000000000000000000000000..b319d5da9df513a15b5c8094c6a5923682ff4579
--- /dev/null
+++ b/Documentation/leds/ledtrig-device.txt
@@ -0,0 +1,32 @@
+Device Activity LED Trigger
+==========================
+
+This is a LED trigger useful for signaling an activity on a given
+device identified by it's MKDEV(major, minor). A typical use case
+would be debugging of a device or a driver on an embedded board,
+patching up trivial electronic hardware design deficiencies in
+software or just plain desire to indicate activity on a certain
+device.
+
+Internally, a instance of a trigger is created and registered with LED
+triggers for every device added via ledtrig_dev_add() call. The
+triggers are named in the following manner:
+
+         `dev-<major>:<minor>`
+
+And can be selected from under /sys/class/leds/*/trigger. A device
+activity is explicitly indicated by calling ledtrig_dev_activity() for
+a registered device.
+
+The driver also creates a set of debugfs entries under
+/sys/kernel/debug/ledtrig-dev, these are:
+
+  devices - cat'ing will produce a list of currently registered
+            devices
+
+  register - echo'ing <major>:<minor> will create a trigger for this
+             device (note, you still need to add at least
+             ledtrig_dev_activity() hook)
+
+  trigger - echo'ing <major>:<minor> will fire the trigger for this
+            device
-- 
2.5.3

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web