diff options
author | Joerg Jung <jung@cvs.openbsd.org> | 2015-12-27 20:05:06 +0000 |
---|---|---|
committer | Joerg Jung <jung@cvs.openbsd.org> | 2015-12-27 20:05:06 +0000 |
commit | 83b8ef142a0b03345b0e0f2ff0a6e06c755eec9b (patch) | |
tree | 332cda8e0d9f3ca71993758f2fe610769af39537 /sys | |
parent | 4c588bb19678e48c97997246a1fe8976da43e16e (diff) |
simplify and unify keyboard backlight hooks, doing the same kassert instead of
for-loop as acpithinkpad does
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/isa/asmc.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/sys/dev/isa/asmc.c b/sys/dev/isa/asmc.c index 78a9dc0df91..8c71dbd054b 100644 --- a/sys/dev/isa/asmc.c +++ b/sys/dev/isa/asmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asmc.c,v 1.23 2015/12/27 19:50:14 jung Exp $ */ +/* $OpenBSD: asmc.c,v 1.24 2015/12/27 20:05:05 jung Exp $ */ /* * Copyright (c) 2015 Joerg Jung <jung@openbsd.org> * @@ -377,15 +377,9 @@ asmc_kbdled(void *arg) int asmc_get_backlight(struct wskbd_backlight *kbl) { - struct asmc_softc *sc = NULL; - int i; - - for (i = 0; i < asmc_cd.cd_ndevs && !sc; i++) - if (asmc_cd.cd_devs[i]) - sc = (struct asmc_softc *)asmc_cd.cd_devs[i]; - if (!sc) - return -1; + struct asmc_softc *sc = asmc_cd.cd_devs[0]; + KASSERT(sc != NULL); kbl->min = 0; kbl->max = 0xff; kbl->curval = sc->sc_kbdled; @@ -395,15 +389,9 @@ asmc_get_backlight(struct wskbd_backlight *kbl) int asmc_set_backlight(struct wskbd_backlight *kbl) { - struct asmc_softc *sc = NULL; - int i; - - for (i = 0; i < asmc_cd.cd_ndevs && !sc; i++) - if (asmc_cd.cd_devs[i]) - sc = (struct asmc_softc *)asmc_cd.cd_devs[i]; - if (!sc) - return -1; + struct asmc_softc *sc = asmc_cd.cd_devs[0]; + KASSERT(sc != NULL); if (kbl->curval > 0xff) return EINVAL; sc->sc_kbdled = kbl->curval; |