diff options
author | marius <marius@FreeBSD.org> | 2005-05-21 20:26:30 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2005-05-21 20:26:30 +0000 |
commit | f02b55e3fecacb44f856504e9717479fe3e550c3 (patch) | |
tree | 0293b328f2482b76ac2a47dcd50652ed062b68d6 /sys/dev/uart | |
parent | 39aeb24d3bd331ca156de7a24ba3802b3bf7269f (diff) | |
download | FreeBSD-src-f02b55e3fecacb44f856504e9717479fe3e550c3.zip FreeBSD-src-f02b55e3fecacb44f856504e9717479fe3e550c3.tar.gz |
- Sprinkle some KBD_IS_* and KBD_*_DONE macros in sunkbd_configure() as
a band-aid allowing to call this function savely multiple times, e.g.
during sckbdprobe() and sc_probe_unit(). Otherwise calling it a second
time results in a non-working keyboard. This needs a lot of more work
to actually do the right thing and work like expected.
- Let sunkbd_configure() return the number of the found keyboards, i.e.
1 in case probing succeeds, as it's expected. The return values of the
keyboard configure functions however currently aren't checked so this
doesn't make a difference at the moment.
- Use FBSDID.
Diffstat (limited to 'sys/dev/uart')
-rw-r--r-- | sys/dev/uart/uart_kbd_sun.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/sys/dev/uart/uart_kbd_sun.c b/sys/dev/uart/uart_kbd_sun.c index 0349659..97c8bc5 100644 --- a/sys/dev/uart/uart_kbd_sun.c +++ b/sys/dev/uart/uart_kbd_sun.c @@ -22,10 +22,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + #include "opt_kbd.h" #include <sys/param.h> @@ -189,15 +190,21 @@ sunkbd_configure(int flags) { struct sunkbd_softc *sc; - if (uart_cpu_getdev(UART_DEV_KEYBOARD, &uart_keyboard)) - return (0); - if (uart_probe(&uart_keyboard)) - return (0); - uart_init(&uart_keyboard); + if (KBD_IS_CONFIGURED(&sunkbd_softc.sc_kbd)) + goto found; - uart_keyboard.type = UART_DEV_KEYBOARD; - uart_keyboard.attach = sunkbd_attach; - uart_add_sysdev(&uart_keyboard); + if (!KBD_IS_INITIALIZED(&sunkbd_softc.sc_kbd)) { + if (uart_cpu_getdev(UART_DEV_KEYBOARD, &uart_keyboard)) + return (0); + if (uart_probe(&uart_keyboard)) + return (0); + uart_init(&uart_keyboard); + + uart_keyboard.type = UART_DEV_KEYBOARD; + uart_keyboard.attach = sunkbd_attach; + uart_add_sysdev(&uart_keyboard); + KBD_INIT_DONE(&sunkbd_softc.sc_kbd); + } if (sunkbd_probe_keyboard(&uart_keyboard) == -1) return (0); @@ -215,8 +222,11 @@ sunkbd_configure(int flags) kbd_register(&sc->sc_kbd); sc->sc_sysdev = &uart_keyboard; + KBD_CONFIG_DONE(&sc->sc_kbd); - return (0); + found: + /* Return number of found keyboards. */ + return (1); } static int |