diff options
author | phk <phk@FreeBSD.org> | 2007-04-23 12:42:15 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2007-04-23 12:42:15 +0000 |
commit | 0edeffe8642ff3f47b7ceb166ab6a63d3b85158a (patch) | |
tree | eccfad0ca6ec66d1bd929ce86ece697d8b80e108 /sys/dev/led | |
parent | 1c3ed182bcc8976abe165ef276180b6eddde1b73 (diff) | |
download | FreeBSD-src-0edeffe8642ff3f47b7ceb166ab6a63d3b85158a.zip FreeBSD-src-0edeffe8642ff3f47b7ceb166ab6a63d3b85158a.tar.gz |
Make it possible to specify an initial state for the LED.
Requested by: Henrik Brix Andersen <henrik@brixandersen.dk>
PR: 112008
Diffstat (limited to 'sys/dev/led')
-rw-r--r-- | sys/dev/led/led.c | 8 | ||||
-rw-r--r-- | sys/dev/led/led.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/led/led.c b/sys/dev/led/led.c index 11c8d3a..b9aae50 100644 --- a/sys/dev/led/led.c +++ b/sys/dev/led/led.c @@ -242,6 +242,12 @@ static struct cdevsw led_cdevsw = { struct cdev * led_create(led_t *func, void *priv, char const *name) { + + return (led_create_state(func, priv, name, 0)); +} +struct cdev * +led_create_state(led_t *func, void *priv, char const *name, int state) +{ struct ledsc *sc; sc = malloc(sizeof *sc, M_LED, M_WAITOK | M_ZERO); @@ -259,7 +265,7 @@ led_create(led_t *func, void *priv, char const *name) if (LIST_EMPTY(&led_list)) callout_reset(&led_ch, hz / 10, led_timeout, NULL); LIST_INSERT_HEAD(&led_list, sc, list); - sc->func(sc->private, 0); + sc->func(sc->private, state != 0); mtx_unlock(&led_mtx); return (sc->dev); diff --git a/sys/dev/led/led.h b/sys/dev/led/led.h index 866311b..bbf301e 100644 --- a/sys/dev/led/led.h +++ b/sys/dev/led/led.h @@ -14,6 +14,7 @@ typedef void led_t(void *, int); +struct cdev *led_create_state(led_t *, void *, char const *, int); struct cdev *led_create(led_t *, void *, char const *); void led_destroy(struct cdev *); |