From: Ian Pilcher <arequipeno@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: LED module not creating /sys/class/leds entry
Date: Sun, 04 Aug 2013 23:27:08 -0500 [thread overview]
Message-ID: <ktn9im$tc2$1@ger.gmane.org> (raw)
I am trying to understand the LED API. I have created an extremely
simple "dummy" LED module (see below), which loads without any errors,
but /sys/class/leds is empty.
Any pointers on what additional steps I need to take to get my "LED" to
show up are greatly appreciated.
Thanks!
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/platform_device.h>
static enum led_brightness dummy_led_brightness = LED_OFF;
static void dummy_led_set_brightness(struct led_classdev *cdev,
enum led_brightness brightness)
{
dummy_led_brightness = brightness;
}
static enum led_brightness dummy_led_get_brightness(struct led_classdev
*cdev)
{
return dummy_led_brightness;
}
static struct led_classdev dummy_led_cdev = {
.name = "dummy",
.brightness_set = dummy_led_set_brightness,
.brightness_get = dummy_led_get_brightness,
};
static int dummy_led_probe(struct platform_device *pdev)
{
return led_classdev_register(&pdev->dev, &dummy_led_cdev);
}
static int dummy_led_remove(struct platform_device *pdev)
{
led_classdev_unregister(&dummy_led_cdev);
return 0;
}
static struct platform_driver dummy_led_driver = {
.probe = dummy_led_probe,
.remove = dummy_led_remove,
.driver = {
.name = "dummy-led",
.owner = THIS_MODULE,
},
};
static int __init dummy_led_init(void)
{
return platform_driver_register(&dummy_led_driver);
}
static void __exit dummy_led_exit(void)
{
platform_driver_unregister(&dummy_led_driver);
}
module_init(dummy_led_init);
module_exit(dummy_led_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Dummy LED driver");
MODULE_AUTHOR("Ian Pilcher <arequipeno@gmail.com>");
--
========================================================================
Ian Pilcher arequipeno@gmail.com
Sometimes there's nothing left to do but crash and burn...or die trying.
========================================================================
reply other threads:[~2013-08-05 4:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='ktn9im$tc2$1@ger.gmane.org' \
--to=arequipeno@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox