Make it possible to specify an initial state for the LED.

Requested by:	Henrik Brix Andersen <henrik@brixandersen.dk>
PR:	112008
This commit is contained in:
Poul-Henning Kamp 2007-04-23 12:42:15 +00:00
parent 98b2967900
commit ea60845d09
2 changed files with 8 additions and 1 deletions

View File

@ -241,6 +241,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;
@ -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);

View File

@ -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 *);