本文整理汇总了C++中device_detach函数的典型用法代码示例。如果您正苦于以下问题:C++ device_detach函数的具体用法?C++ device_detach怎么用?C++ device_detach使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了device_detach函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: a10_ehci_detach
static int
a10_ehci_detach(device_t self)
{
ehci_softc_t *sc = device_get_softc(self);
device_t bdev;
int err;
uint32_t reg_value = 0;
if (sc->sc_bus.bdev) {
bdev = sc->sc_bus.bdev;
device_detach(bdev);
device_delete_child(self, bdev);
}
/* during module unload there are lots of children leftover */
device_delete_children(self);
if (sc->sc_irq_res && sc->sc_intr_hdl) {
/*
* only call ehci_detach() after ehci_init()
*/
ehci_detach(sc);
err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl);
if (err)
/* XXX or should we panic? */
device_printf(self, "Could not tear down irq, %d\n",
err);
sc->sc_intr_hdl = NULL;
}
if (sc->sc_irq_res) {
bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res);
sc->sc_irq_res = NULL;
}
if (sc->sc_io_res) {
bus_release_resource(self, SYS_RES_MEMORY, 0,
sc->sc_io_res);
sc->sc_io_res = NULL;
}
usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc);
/* Disable configure port */
reg_value = A10_READ_4(sc, SW_SDRAM_REG_HPCR_USB2);
reg_value &= ~SW_SDRAM_BP_HPCR_ACCESS;
A10_WRITE_4(sc, SW_SDRAM_REG_HPCR_USB2, reg_value);
/* Disable passby */
reg_value = A10_READ_4(sc, SW_USB_PMU_IRQ_ENABLE);
reg_value &= ~SW_AHB_INCR8; /* AHB INCR8 disable */
reg_value &= ~SW_AHB_INCR4; /* AHB burst type INCR4 disable */
reg_value &= ~SW_AHB_INCRX_ALIGN; /* AHB INCRX align disable */
reg_value &= ~SW_ULPI_BYPASS; /* ULPI bypass disable */
A10_WRITE_4(sc, SW_USB_PMU_IRQ_ENABLE, reg_value);
/* Disable clock for USB */
a10_clk_usb_deactivate();
return (0);
}
示例2: octusb_octeon_detach
static int
octusb_octeon_detach(device_t dev)
{
struct octusb_octeon_softc *sc = device_get_softc(dev);
device_t bdev;
int err;
if (sc->sc_dci.sc_bus.bdev) {
bdev = sc->sc_dci.sc_bus.bdev;
device_detach(bdev);
device_delete_child(dev, bdev);
}
/* during module unload there are lots of children leftover */
device_delete_children(dev);
if (sc->sc_dci.sc_irq_res && sc->sc_dci.sc_intr_hdl) {
/*
* only call octusb_octeon_uninit() after octusb_octeon_init()
*/
octusb_uninit(&sc->sc_dci);
err = bus_teardown_intr(dev, sc->sc_dci.sc_irq_res,
sc->sc_dci.sc_intr_hdl);
sc->sc_dci.sc_intr_hdl = NULL;
}
if (sc->sc_dci.sc_irq_res) {
bus_release_resource(dev, SYS_RES_IRQ, 0,
sc->sc_dci.sc_irq_res);
sc->sc_dci.sc_irq_res = NULL;
}
usb_bus_mem_free_all(&sc->sc_dci.sc_bus, NULL);
return (0);
}
示例3: zy7_ehci_detach
static int
zy7_ehci_detach(device_t dev)
{
ehci_softc_t *sc = device_get_softc(dev);
sc->sc_flags &= ~EHCI_SCFLG_DONEINIT;
if (device_is_attached(dev))
bus_generic_detach(dev);
if (sc->sc_irq_res && sc->sc_intr_hdl)
/* call ehci_detach() after ehci_init() called after
* successful bus_setup_intr().
*/
ehci_detach(sc);
if (sc->sc_bus.bdev) {
device_detach(sc->sc_bus.bdev);
device_delete_child(dev, sc->sc_bus.bdev);
}
if (sc->sc_irq_res) {
if (sc->sc_intr_hdl != NULL)
bus_teardown_intr(dev, sc->sc_irq_res,
sc->sc_intr_hdl);
bus_release_resource(dev, SYS_RES_IRQ,
rman_get_rid(sc->sc_irq_res), sc->sc_irq_res);
}
if (sc->sc_io_res)
bus_release_resource(dev, SYS_RES_MEMORY,
rman_get_rid(sc->sc_io_res), sc->sc_io_res);
usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc);
return (0);
}
示例4: acpi_dock_eject_child
static ACPI_STATUS
acpi_dock_eject_child(ACPI_HANDLE handle, UINT32 level, void *context,
void **status)
{
device_t dock_dev, dev;
ACPI_HANDLE dock_handle;
dock_dev = *(device_t *)context;
dock_handle = acpi_get_handle(dock_dev);
if (!acpi_dock_is_ejd_device(dock_handle, handle))
goto out;
ACPI_VPRINT(dock_dev, acpi_device_get_parent_softc(dock_dev),
"ejecting device for %s\n", acpi_name(handle));
dev = acpi_get_device(handle);
if (dev != NULL && device_is_attached(dev)) {
mtx_lock(&Giant);
device_detach(dev);
mtx_unlock(&Giant);
}
acpi_SetInteger(handle, "_EJ0", 0);
out:
return (AE_OK);
}
示例5: at91_udp_detach
static int
at91_udp_detach(device_t dev)
{
struct at91_udp_softc *sc = device_get_softc(dev);
device_t bdev;
int err;
if (sc->sc_dci.sc_bus.bdev) {
bdev = sc->sc_dci.sc_bus.bdev;
device_detach(bdev);
device_delete_child(dev, bdev);
}
/* during module unload there are lots of children leftover */
device_delete_children(dev);
USB_BUS_LOCK(&sc->sc_dci.sc_bus);
callout_stop(&sc->sc_vbus);
USB_BUS_UNLOCK(&sc->sc_dci.sc_bus);
callout_drain(&sc->sc_vbus);
/* disable Transceiver */
AT91_UDP_WRITE_4(&sc->sc_dci, AT91_UDP_TXVC, AT91_UDP_TXVC_DIS);
/* disable and clear all interrupts */
AT91_UDP_WRITE_4(&sc->sc_dci, AT91_UDP_IDR, 0xFFFFFFFF);
AT91_UDP_WRITE_4(&sc->sc_dci, AT91_UDP_ICR, 0xFFFFFFFF);
if (sc->sc_dci.sc_irq_res && sc->sc_dci.sc_intr_hdl) {
/*
* only call at91_udp_uninit() after at91_udp_init()
*/
at91dci_uninit(&sc->sc_dci);
err = bus_teardown_intr(dev, sc->sc_dci.sc_irq_res,
sc->sc_dci.sc_intr_hdl);
sc->sc_dci.sc_intr_hdl = NULL;
}
if (sc->sc_dci.sc_irq_res) {
bus_release_resource(dev, SYS_RES_IRQ, 0,
sc->sc_dci.sc_irq_res);
sc->sc_dci.sc_irq_res = NULL;
}
if (sc->sc_dci.sc_io_res) {
bus_release_resource(dev, SYS_RES_MEMORY, MEM_RID,
sc->sc_dci.sc_io_res);
sc->sc_dci.sc_io_res = NULL;
}
usb_bus_mem_free_all(&sc->sc_dci.sc_bus, NULL);
/* disable clocks */
at91_pmc_clock_disable(sc->sc_iclk);
at91_pmc_clock_disable(sc->sc_fclk);
at91_pmc_clock_disable(sc->sc_mclk);
at91_pmc_clock_deref(sc->sc_fclk);
at91_pmc_clock_deref(sc->sc_iclk);
at91_pmc_clock_deref(sc->sc_mclk);
return (0);
}
示例6: exynos_xhci_detach
static int
exynos_xhci_detach(device_t dev)
{
struct exynos_xhci_softc *esc = device_get_softc(dev);
device_t bdev;
int err;
if (esc->base.sc_bus.bdev != NULL) {
bdev = esc->base.sc_bus.bdev;
device_detach(bdev);
device_delete_child(dev, bdev);
}
/* During module unload there are lots of children leftover */
device_delete_children(dev);
xhci_halt_controller(&esc->base);
if (esc->res[2] && esc->base.sc_intr_hdl) {
err = bus_teardown_intr(dev, esc->res[2],
esc->base.sc_intr_hdl);
if (err) {
device_printf(dev, "Could not tear down IRQ,"
" %d\n", err);
return (err);
}
}
bus_release_resources(dev, exynos_xhci_spec, esc->res);
xhci_uninit(&esc->base);
return (0);
}
示例7: ohci_atmelarm_detach
static int
ohci_atmelarm_detach(device_t dev)
{
struct at91_ohci_softc *sc = device_get_softc(dev);
device_t bdev;
int err;
if (sc->sc_ohci.sc_bus.bdev) {
bdev = sc->sc_ohci.sc_bus.bdev;
device_detach(bdev);
device_delete_child(dev, bdev);
}
/* during module unload there are lots of children leftover */
device_delete_children(dev);
/*
* Put the controller into reset, then disable clocks and do
* the MI tear down. We have to disable the clocks/hardware
* after we do the rest of the teardown. We also disable the
* clocks in the opposite order we acquire them, but that
* doesn't seem to be absolutely necessary. We free up the
* clocks after we disable them, so the system could, in
* theory, reuse them.
*/
bus_space_write_4(sc->sc_ohci.sc_io_tag, sc->sc_ohci.sc_io_hdl,
OHCI_CONTROL, 0);
at91_pmc_clock_disable(sc->fclk);
at91_pmc_clock_disable(sc->iclk);
at91_pmc_clock_disable(sc->mclk);
at91_pmc_clock_deref(sc->fclk);
at91_pmc_clock_deref(sc->iclk);
at91_pmc_clock_deref(sc->mclk);
if (sc->sc_ohci.sc_irq_res && sc->sc_ohci.sc_intr_hdl) {
/*
* only call ohci_detach() after ohci_init()
*/
ohci_detach(&sc->sc_ohci);
err = bus_teardown_intr(dev, sc->sc_ohci.sc_irq_res, sc->sc_ohci.sc_intr_hdl);
sc->sc_ohci.sc_intr_hdl = NULL;
}
if (sc->sc_ohci.sc_irq_res) {
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_ohci.sc_irq_res);
sc->sc_ohci.sc_irq_res = NULL;
}
if (sc->sc_ohci.sc_io_res) {
bus_release_resource(dev, SYS_RES_MEMORY, MEM_RID,
sc->sc_ohci.sc_io_res);
sc->sc_ohci.sc_io_res = NULL;
}
usb_bus_mem_free_all(&sc->sc_ohci.sc_bus, &ohci_iterate_hw_softc);
return (0);
}
示例8: device_free
void device_free(Device *d) {
assert(d);
device_detach(d);
hashmap_remove(d->manager->devices, d->sysfs);
free(d->sysfs);
free(d);
}
示例9: uhci_pci_detach
int
uhci_pci_detach(device_t self)
{
uhci_softc_t *sc = device_get_softc(self);
device_t bdev;
if (sc->sc_bus.bdev) {
bdev = sc->sc_bus.bdev;
device_detach(bdev);
device_delete_child(self, bdev);
}
/* during module unload there are lots of children leftover */
device_delete_children(self);
/*
* disable interrupts that might have been switched on in
* uhci_init.
*/
if (sc->sc_io_res) {
USB_BUS_LOCK(&sc->sc_bus);
/* stop the controller */
uhci_reset(sc);
USB_BUS_UNLOCK(&sc->sc_bus);
}
pci_disable_busmaster(self);
if (sc->sc_irq_res && sc->sc_intr_hdl) {
int err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl);
if (err) {
/* XXX or should we panic? */
device_printf(self, "Could not tear down irq, %d\n",
err);
}
sc->sc_intr_hdl = NULL;
}
if (sc->sc_irq_res) {
bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res);
sc->sc_irq_res = NULL;
}
if (sc->sc_io_res) {
bus_release_resource(self, SYS_RES_IOPORT, PCI_UHCI_BASE_REG,
sc->sc_io_res);
sc->sc_io_res = NULL;
}
usb_bus_mem_free_all(&sc->sc_bus, &uhci_iterate_hw_softc);
return (0);
}
示例10: musbotg_detach
static int
musbotg_detach(device_t dev)
{
struct musbotg_super_softc *sc = device_get_softc(dev);
device_t bdev;
int err;
int i;
for (i = 0; i < AM335X_USB_PORTS; i++) {
if (sc->sc_otg[i].sc_bus.bdev) {
bdev = sc->sc_otg[i].sc_bus.bdev;
device_detach(bdev);
device_delete_child(dev, bdev);
}
if (sc->sc_otg[i].sc_irq_res && sc->sc_otg[i].sc_intr_hdl) {
/*
* only call musbotg_uninit() after musbotg_init()
*/
musbotg_uninit(&sc->sc_otg[i]);
err = bus_teardown_intr(dev, sc->sc_otg[i].sc_irq_res,
sc->sc_otg[i].sc_intr_hdl);
sc->sc_otg[i].sc_intr_hdl = NULL;
}
usb_bus_mem_free_all(&sc->sc_otg[i].sc_bus, NULL);
}
if (sc->sc_intr_hdl) {
bus_teardown_intr(dev, sc->sc_irq_res[0],
sc->sc_intr_hdl);
sc->sc_intr_hdl = NULL;
}
/* Free resources if any */
if (sc->sc_mem_res[0])
bus_release_resources(dev, am335x_musbotg_mem_spec,
sc->sc_mem_res);
if (sc->sc_irq_res[0])
bus_release_resources(dev, am335x_musbotg_irq_spec,
sc->sc_irq_res);
/* during module unload there are lots of children leftover */
device_delete_children(dev);
return (0);
}
示例11: ehci_obio_detach
static int
ehci_obio_detach(device_t self)
{
ehci_softc_t *sc = device_get_softc(self);
device_t bdev;
int err;
if (sc->sc_bus.bdev) {
bdev = sc->sc_bus.bdev;
device_detach(bdev);
device_delete_child(self, bdev);
}
/* during module unload there are lots of children leftover */
device_delete_children(self);
if (sc->sc_irq_res && sc->sc_intr_hdl) {
/*
* only call ehci_detach() after ehci_init()
*/
ehci_detach(sc);
/* Stop EHCI clock */
rt305x_sysctl_set(SYSCTL_CLKCFG1,
rt305x_sysctl_get(SYSCTL_CLKCFG1) &
~(SYSCTL_CLKCFG1_UPHY0_CLK_EN
#ifdef MT7620
| SYSCTL_CLKCFG1_UPHY1_CLK_EN
#endif
));
err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl);
if (err)
device_printf(self, "Could not tear down irq, %d\n",
err);
sc->sc_intr_hdl = NULL;
}
if (sc->sc_irq_res) {
bus_release_resource(self, SYS_RES_IRQ, 0,
sc->sc_irq_res);
sc->sc_irq_res = NULL;
}
if (sc->sc_io_res) {
bus_release_resource(self, SYS_RES_MEMORY, 0,
sc->sc_io_res);
sc->sc_io_res = NULL;
}
usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc);
return (0);
}
示例12: device_attach
void device_attach(Device *d, Seat *s) {
assert(d);
assert(s);
if (d->seat == s)
return;
if (d->seat)
device_detach(d);
d->seat = s;
LIST_PREPEND(Device, devices, s->devices, d);
seat_send_changed(s, "CanGraphical\0");
}
示例13: puc_bfe_detach
int
puc_bfe_detach(device_t dev)
{
struct puc_bar *bar;
struct puc_port *port;
struct puc_softc *sc;
int error, idx;
sc = device_get_softc(dev);
/* Detach our children. */
error = 0;
for (idx = 0; idx < sc->sc_nports; idx++) {
port = &sc->sc_port[idx];
if (port->p_dev == NULL)
continue;
if (device_detach(port->p_dev) == 0) {
device_delete_child(dev, port->p_dev);
if (port->p_rres != NULL)
rman_release_resource(port->p_rres);
if (port->p_ires != NULL)
rman_release_resource(port->p_ires);
} else
error = ENXIO;
}
if (error)
return (error);
if (sc->sc_serdevs != 0UL)
bus_teardown_intr(dev, sc->sc_ires, sc->sc_icookie);
bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irid, sc->sc_ires);
for (idx = 0; idx < PUC_PCI_BARS; idx++) {
bar = &sc->sc_bar[idx];
if (bar->b_res != NULL)
bus_release_resource(sc->sc_dev, bar->b_type,
bar->b_rid, bar->b_res);
}
rman_fini(&sc->sc_irq);
free(__DECONST(void *, sc->sc_irq.rm_descr), M_PUC);
rman_fini(&sc->sc_iomem);
free(__DECONST(void *, sc->sc_iomem.rm_descr), M_PUC);
rman_fini(&sc->sc_ioport);
free(__DECONST(void *, sc->sc_ioport.rm_descr), M_PUC);
free(sc->sc_port, M_PUC);
return (0);
}
示例14: ar71xx_ehci_detach
static int
ar71xx_ehci_detach(device_t self)
{
struct ar71xx_ehci_softc *isc = device_get_softc(self);
ehci_softc_t *sc = &isc->base;
device_t bdev;
int err;
if (sc->sc_bus.bdev) {
bdev = sc->sc_bus.bdev;
device_detach(bdev);
device_delete_child(self, bdev);
}
/* during module unload there are lots of children leftover */
device_delete_children(self);
if (sc->sc_irq_res && sc->sc_intr_hdl) {
/*
* only call ehci_detach() after ehci_init()
*/
ehci_detach(sc);
err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl);
if (err)
/* XXX or should we panic? */
device_printf(self, "Could not tear down irq, %d\n",
err);
sc->sc_intr_hdl = NULL;
}
if (sc->sc_irq_res) {
bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res);
sc->sc_irq_res = NULL;
}
if (sc->sc_io_res) {
bus_release_resource(self, SYS_RES_MEMORY, 0,
sc->sc_io_res);
sc->sc_io_res = NULL;
}
usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc);
return (0);
}
示例15: dotg_obio_detach
static int
dotg_obio_detach(device_t dev)
{
struct dotg_obio_softc *sc = device_get_softc(dev);
device_t bdev;
int err;
if (sc->sc_dci.sc_bus.bdev) {
bdev = sc->sc_dci.sc_bus.bdev;
device_detach(bdev);
device_delete_child(dev, bdev);
}
/* during module unload there are lots of children leftover */
device_delete_children(dev);
if (sc->sc_dci.sc_irq_res && sc->sc_dci.sc_intr_hdl) {
/*
* only call dotg_obio_uninit() after dotg_obio_init()
*/
dotg_uninit(&sc->sc_dci);
/* Stop OTG clock */
rt305x_sysctl_set(SYSCTL_CLKCFG1,
rt305x_sysctl_get(SYSCTL_CLKCFG1) &
~SYSCTL_CLKCFG1_OTG_CLK_EN);
err = bus_teardown_intr(dev, sc->sc_dci.sc_irq_res,
sc->sc_dci.sc_intr_hdl);
sc->sc_dci.sc_intr_hdl = NULL;
}
if (sc->sc_dci.sc_irq_res) {
bus_release_resource(dev, SYS_RES_IRQ, 0,
sc->sc_dci.sc_irq_res);
sc->sc_dci.sc_irq_res = NULL;
}
if (sc->sc_dci.sc_mem_res) {
bus_release_resource(dev, SYS_RES_MEMORY, 0,
sc->sc_dci.sc_mem_res);
sc->sc_dci.sc_mem_res = NULL;
}
usb_bus_mem_free_all(&sc->sc_dci.sc_bus, NULL);
return (0);
}