Exemple #1
0
int
pcppi_detach(device_t self, int flags)
{
	int rc;
	struct pcppi_softc *sc = device_private(self);

#if NATTIMER > 0
	pcppi_detach_speaker(sc);
#endif

	if ((rc = config_detach_children(sc->sc_dv, flags)) != 0)
		return rc;

	pmf_device_deregister(self);

#if NPCKBD > 0
	pckbd_unhook_bell(pcppi_pckbd_bell, sc);
#endif
	mutex_spin_enter(&tty_lock);
	pcppi_bell_stop(sc);
	mutex_spin_exit(&tty_lock);

	callout_halt(&sc->sc_bell_ch, NULL);
	callout_destroy(&sc->sc_bell_ch);

	cv_destroy(&sc->sc_slp);

	bus_space_unmap(sc->sc_iot, sc->sc_ppi_ioh, sc->sc_size);

	return 0;
}
Exemple #2
0
int
scsibusdetach(struct device *dev, int type)
{
	struct scsibus_softc		*sb = (struct scsibus_softc *)dev;
	int				i, j, error;

#if NBIO > 0
	bio_unregister(&sb->sc_dev);
#endif

	if ((error = config_detach_children(dev, type)) != 0)
		return (error);

	for (i = 0; i < sb->sc_buswidth; i++) {
		if (sb->sc_link[i] != NULL) {
			for (j = 0; j < sb->adapter_link->luns; j++) {
				if (sb->sc_link[i][j] != NULL)
					free(sb->sc_link[i][j], M_DEVBUF);
			}
			free(sb->sc_link[i], M_DEVBUF);
		}
	}

	free(sb->sc_link, M_DEVBUF);

	/* Free shared data. */
	scsi_deinit();

	return (0);
}
Exemple #3
0
int
ppbdetach(struct device *self, int flags)
{
	struct ppb_softc *sc = (struct ppb_softc *)self;
	char *name;
	int rv;

	if (sc->sc_intrhand)
		pci_intr_disestablish(sc->sc_pc, sc->sc_intrhand);

	rv = config_detach_children(self, flags);

	if (sc->sc_ioex) {
		name = sc->sc_ioex->ex_name;
		extent_destroy(sc->sc_ioex);
		free(name, M_DEVBUF);
	}

	if (sc->sc_memex) {
		name = sc->sc_memex->ex_name;
		extent_destroy(sc->sc_memex);
		free(name, M_DEVBUF);
	}

	if (sc->sc_pmemex) {
		name = sc->sc_pmemex->ex_name;
		extent_destroy(sc->sc_pmemex);
		free(name, M_DEVBUF);
	}

	return (rv);
}
static int
nor_detach(device_t self, int flags)
{
	struct nor_softc * const sc = device_private(self);
	struct nor_chip * const chip = &sc->sc_chip;
	int error = 0;

	error = config_detach_children(self, flags);
	if (error) {
		return error;
	}

	flash_sync_thread_destroy(&sc->sc_flash_io);
#ifdef NOR_BBT
	nor_bbt_detach(self);
#endif
#ifdef NOTET
	/* free oob cache */
	kmem_free(chip->nc_oob_cache, chip->nc_spare_size);
#endif
	kmem_free(chip->nc_page_cache, chip->nc_page_size);

	mutex_destroy(&sc->sc_device_lock);

	pmf_device_deregister(sc->sc_dev);

	return error;
}
static int
bthub_detach(device_t self, int flags)
{

	pmf_device_deregister(self);

	return config_detach_children(self, flags);
}
Exemple #6
0
int
pcidetach(device_t self, int flags)
{
	int rc;

	if ((rc = config_detach_children(self, flags)) != 0)
		return rc;
	pmf_device_deregister(self);
	return 0;
}
static int
geode_gcb_detach(device_t self, int flags)
{
	int rc;
	struct geode_gcb_softc *sc = device_private(self);

	if ((rc = config_detach_children(self, flags)) != 0)
		return rc;

	bus_space_unmap(sc->sc_iot, sc->sc_ioh, SC1100_GCB_SIZE);
	return 0;
}
Exemple #8
0
int
wbsio_detach(device_t self, int flags)
{
	struct wbsio_softc *sc = device_private(self);
	int rc;

	if ((rc = config_detach_children(self, flags)) != 0)
		return rc;
	bus_space_unmap(sc->sc_iot, sc->sc_ioh, WBSIO_IOSIZE);
	pmf_device_deregister(self);
	return 0;
}
Exemple #9
0
static int
obiosdhc_detach(device_t self, int flags)
{
//	struct obiosdhc_softc *sc = device_private(self);
    int error;

    error = config_detach_children(self, flags);

    /* XXXXXX: Regurator turn-off via I2C. */
    /* XXXXXX: And disable ICLOCK/FCLOCK. */

    return error;
}
STATIC int
cardslotdetach(device_t self, int flags)
{
	int rc;
	struct cardslot_softc *sc = device_private(self);

	if ((rc = config_detach_children(self, flags)) != 0)
		return rc;

	sc->sc_th_enable = 0;
	wakeup(&sc->sc_events);
	while (sc->sc_event_thread != NULL)
		(void)tsleep(sc, PWAIT, "cardslotthd", 0);

	if (!SIMPLEQ_EMPTY(&sc->sc_events))
		aprint_error_dev(self, "events outstanding");

	pmf_device_deregister(self);
	return 0;
}
Exemple #11
0
int
fdcdetach(device_t self, int flags)
{
	int rc;
	struct fdc_softc *fdc = device_private(self);

	if ((rc = config_detach_children(self, flags)) != 0)
		return rc;

	pmf_device_deregister(self);

	isa_dmamap_destroy(fdc->sc_ic, fdc->sc_drq);
	isa_drq_free(fdc->sc_ic, fdc->sc_drq);

	callout_destroy(&fdc->sc_intr_ch);
	callout_destroy(&fdc->sc_timo_ch);

	cv_destroy(&fdc->sc_cv);
	mutex_destroy(&fdc->sc_mtx);

	return 0;
}
Exemple #12
0
static int
auvia_detach(device_t self, int flags)
{
	int rc;
	struct auvia_softc *sc = device_private(self);

	if ((rc = config_detach_children(self, flags)) != 0)
		return rc;
	pmf_device_deregister(self);

	mutex_enter(&sc->sc_lock);
	auconv_delete_encodings(sc->sc_encodings);
	auconv_delete_encodings(sc->sc_spdif_encodings);
	if (sc->codec_if != NULL)
		sc->codec_if->vtbl->detach(sc->codec_if);
	mutex_exit(&sc->sc_lock);

	/* XXX restore compatibility? */
	if (sc->sc_ih != NULL)
		pci_intr_disestablish(sc->sc_pc, sc->sc_ih);

	bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_iosize);
	if (sc->sc_play.sc_dma_ops != NULL) {
		auvia_free(sc, sc->sc_play.sc_dma_ops,
		    sc->sc_play.sc_dma_op_count *
		    sizeof(struct auvia_dma_op));
	}
	if (sc->sc_record.sc_dma_ops != NULL) {
		auvia_free(sc, sc->sc_record.sc_dma_ops,
		    sc->sc_play.sc_dma_op_count *
		    sizeof(struct auvia_dma_op));
	}
	mutex_destroy(&sc->sc_lock);
	mutex_destroy(&sc->sc_intr_lock);

	return 0;
}
Exemple #13
0
int
atapiscsi_detach(struct device *dev, int flags)
{
	return (config_detach_children(dev, flags));
}