static int adb_kbd_detach(device_t dev) { struct adb_kbd_softc *sc; keyboard_t *kbd; sc = device_get_softc(dev); adb_set_autopoll(dev,0); callout_stop(&sc->sc_repeater); mtx_lock(&sc->sc_mutex); kbd = kbd_get_keyboard(kbd_find_keyboard(KBD_DRIVER_NAME, device_get_unit(dev))); kbdd_disable(kbd); #ifdef KBD_INSTALL_CDEV kbd_detach(kbd); #endif kbdd_term(kbd); mtx_unlock(&sc->sc_mutex); mtx_destroy(&sc->sc_mutex); cv_destroy(&sc->sc_cv); return (0); }
int ukbd_detach(device_t self) { keyboard_t *kbd; int error; kbd = kbd_get_keyboard(kbd_find_keyboard(DRIVER_NAME, device_get_unit(self))); if (kbd == NULL) { DPRINTF(("%s: keyboard not attached!?\n", device_get_nameunit(self))); return ENXIO; } kbd_disable(kbd); #ifdef KBD_INSTALL_CDEV error = kbd_detach(kbd); if (error) return error; #endif error = kbd_term(kbd); if (error) return error; DPRINTF(("%s: disconnected\n", device_get_nameunit(self))); return (0); }
int ukbd_detach(device_t self) { keyboard_t *kbd; int error; kbd = kbd_get_keyboard(kbd_find_keyboard(DRIVER_NAME, device_get_unit(self))); if (kbd == NULL) { DPRINTF(("%s: keyboard not attached!?\n", USBDEVNAME(self))); return ENXIO; } (*kbdsw[kbd->kb_index]->disable)(kbd); #ifdef KBD_INSTALL_CDEV error = kbd_detach(kbd); if (error) return error; #endif error = (*kbdsw[kbd->kb_index]->term)(kbd); if (error) return error; DPRINTF(("%s: disconnected\n", USBDEVNAME(self))); return (0); }