static int epic_detach(device_t dev) { struct epic_softc *sc; sc = device_get_softc(dev); led_destroy(sc->sc_led_dev_alert); led_destroy(sc->sc_led_dev_power); bus_release_resources(dev, epic_res_spec, sc->sc_res); EPIC_LOCK_DESTROY(sc); return (0); }
void seteSeg_destroy (SeteSeg * my7Seg) { for (int i = 0; i<8; i++) { led_destroy (my7Seg->segs[i]); } free (my7Seg); }
static int led_avila_detach(device_t dev) { struct led_avila_softc *sc = device_get_softc(dev); if (sc->sc_led != NULL) led_destroy(sc->sc_led); return (0); }
static int fled_detach(device_t dev) { struct fled_softc *sc = device_get_softc(dev); if (sc->sc_led != NULL) led_destroy(sc->sc_led); return 0; }
static int rbled_detach(device_t dev) { struct rbled_softc *sc; sc = device_get_softc(dev); led_destroy(sc->sc_led); return (0); }
static void gpioleds_detach_led(struct gpioled *led) { if (led->leddev != NULL) led_destroy(led->leddev); if (led->pin) gpio_pin_release(led->pin); }
static int auxio_bus_detach(device_t dev) { struct auxio_softc *sc; sc = device_get_softc(dev); led_destroy(sc->sc_led_dev); auxio_led_func(sc, sc->sc_led_stat); auxio_free_resource(sc); return (0); }
static int led_detach(device_t dev) { struct led_softc *sc = device_get_softc(dev); int i; for (i = 0; i < 8; i++) { struct cdev *led = sc->sc_leds[i]; if (led != NULL) led_destroy(led); } return (0); }
static int gpioled_detach(device_t dev) { struct gpioled_softc *sc; sc = device_get_softc(dev); if (sc->sc_leddev) { led_destroy(sc->sc_leddev); sc->sc_leddev = NULL; } GPIOLED_LOCK_DESTROY(sc); return (0); }
void terasic_de4led_detach(struct terasic_de4led_softc *sc) { int i; for (i = 0; i < 8; i++) { led_destroy(sc->tdl_leds[i]); sc->tdl_leds[i] = NULL; } TERASIC_DE4LED_LOCK(sc); TERASIC_DE4LED_CLEARBAR(sc); terasic_de4led_update(sc); TERASIC_DE4LED_UNLOCK(sc); TERASIC_DE4LED_LOCK_DESTROY(sc); }
static int clkbrd_detach(device_t dev) { struct clkbrd_softc *sc; sc = device_get_softc(dev); led_destroy(sc->sc_led_dev); bus_space_write_1(sc->sc_bt[CLKBRD_CLK], sc->sc_bh[CLKBRD_CLK], CLK_CTRL, sc->sc_clk_ctrl); bus_space_read_1(sc->sc_bt[CLKBRD_CLK], sc->sc_bh[CLKBRD_CLK], CLK_CTRL); clkbrd_free_resources(sc); return (0); }
static int ahci_em_detach(device_t dev) { struct ahci_enclosure *enc = device_get_softc(dev); int i; for (i = 0; i < enc->channels * AHCI_NUM_LEDS; i++) { if (enc->leds[i].led) led_destroy(enc->leds[i].led); } mtx_lock(&enc->mtx); xpt_async(AC_LOST_DEVICE, enc->path, NULL); xpt_free_path(enc->path); xpt_bus_deregister(cam_sim_path(enc->sim)); cam_sim_free(enc->sim, /*free_devq*/TRUE); mtx_unlock(&enc->mtx); bus_release_resource(dev, SYS_RES_MEMORY, 0, enc->r_memc); bus_release_resource(dev, SYS_RES_MEMORY, 1, enc->r_memt); if (enc->r_memr) bus_release_resource(dev, SYS_RES_MEMORY, 2, enc->r_memr); mtx_destroy(&enc->mtx); return (0); }
static int isci_detach(device_t device) { struct isci_softc *isci = DEVICE2SOFTC(device); int i, phy; for (i = 0; i < isci->controller_count; i++) { struct ISCI_CONTROLLER *controller = &isci->controllers[i]; SCI_STATUS status; void *unmap_buffer; if (controller->scif_controller_handle != NULL) { scic_controller_disable_interrupts( scif_controller_get_scic_handle(controller->scif_controller_handle)); mtx_lock(&controller->lock); status = scif_controller_stop(controller->scif_controller_handle, 0); mtx_unlock(&controller->lock); while (controller->is_started == TRUE) { /* Now poll for interrupts until the controller stop complete * callback is received. */ mtx_lock(&controller->lock); isci_interrupt_poll_handler(controller); mtx_unlock(&controller->lock); pause("isci", 1); } if(controller->sim != NULL) { mtx_lock(&controller->lock); xpt_free_path(controller->path); xpt_bus_deregister(cam_sim_path(controller->sim)); cam_sim_free(controller->sim, TRUE); mtx_unlock(&controller->lock); } } if (controller->timer_memory != NULL) free(controller->timer_memory, M_ISCI); if (controller->remote_device_memory != NULL) free(controller->remote_device_memory, M_ISCI); for (phy = 0; phy < SCI_MAX_PHYS; phy++) { if (controller->phys[phy].cdev_fault) led_destroy(controller->phys[phy].cdev_fault); if (controller->phys[phy].cdev_locate) led_destroy(controller->phys[phy].cdev_locate); } while (1) { sci_pool_get(controller->unmap_buffer_pool, unmap_buffer); if (unmap_buffer == NULL) break; contigfree(unmap_buffer, PAGE_SIZE, M_ISCI); } } /* The SCIF controllers have been stopped, so we can now * free the SCI library memory. */ if (isci->sci_library_memory != NULL) free(isci->sci_library_memory, M_ISCI); for (i = 0; i < ISCI_NUM_PCI_BARS; i++) { struct ISCI_PCI_BAR *pci_bar = &isci->pci_bar[i]; if (pci_bar->resource != NULL) bus_release_resource(device, SYS_RES_MEMORY, pci_bar->resource_id, pci_bar->resource); } for (i = 0; i < isci->num_interrupts; i++) { struct ISCI_INTERRUPT_INFO *interrupt_info; interrupt_info = &isci->interrupt_info[i]; if(interrupt_info->tag != NULL) bus_teardown_intr(device, interrupt_info->res, interrupt_info->tag); if(interrupt_info->res != NULL) bus_release_resource(device, SYS_RES_IRQ, rman_get_rid(interrupt_info->res), interrupt_info->res); pci_release_msi(device); } pci_disable_busmaster(device); return (0); }
static int sysctl_machdep_elan_gpio_config(SYSCTL_HANDLER_ARGS) { u_int u, v; int i, np, ne; int error; char buf[32]; char tmp[10]; error = SYSCTL_OUT(req, gpio_config, 33); if (error != 0 || req->newptr == NULL) return (error); if (req->newlen != 32) return (EINVAL); error = SYSCTL_IN(req, buf, 32); if (error != 0) return (error); /* Disallow any disabled pins and count pps and echo */ np = ne = 0; for (i = 0; i < 32; i++) { if (gpio_config[i] == '-' && buf[i] == '.') buf[i] = gpio_config[i]; if (gpio_config[i] == '-' && buf[i] != '-') return (EPERM); if (buf[i] == 'P') { np++; if (np > 1) return (EINVAL); } if (buf[i] == 'e' || buf[i] == 'E') { ne++; if (ne > 1) return (EINVAL); } if (buf[i] != 'L' && buf[i] != 'l' #ifdef CPU_ELAN_PPS && buf[i] != 'P' && buf[i] != 'E' && buf[i] != 'e' #endif /* CPU_ELAN_PPS */ && buf[i] != '.' && buf[i] != '-') return (EINVAL); } #ifdef CPU_ELAN_PPS if (np == 0) pps_a = pps_d = 0; if (ne == 0) echo_a = echo_d = 0; #endif for (i = 0; i < 32; i++) { u = 1 << (i & 0xf); if (i >= 16) v = 2; else v = 0; #ifdef CPU_SOEKRIS if (i == 9) ; else #endif if (buf[i] != 'l' && buf[i] != 'L' && led_dev[i] != NULL) { led_destroy(led_dev[i]); led_dev[i] = NULL; mmcrptr[(0xc2a + v) / 2] &= ~u; } switch (buf[i]) { #ifdef CPU_ELAN_PPS case 'P': pps_d = u; pps_a = 0xc30 + v; pps_ap[0] = &mmcrptr[pps_a / 2]; pps_ap[1] = &elan_mmcr->GPTMR2CNT; pps_ap[2] = &elan_mmcr->GPTMR1CNT; mmcrptr[(0xc2a + v) / 2] &= ~u; gpio_config[i] = buf[i]; break; case 'e': case 'E': echo_d = u; if (buf[i] == 'E') echo_a = 0xc34 + v; else echo_a = 0xc38 + v; mmcrptr[(0xc2a + v) / 2] |= u; gpio_config[i] = buf[i]; break; #endif /* CPU_ELAN_PPS */ case 'l': case 'L': if (buf[i] == 'L') led_cookie[i] = (0xc34 + v) | (u << 16); else led_cookie[i] = (0xc38 + v) | (u << 16); if (led_dev[i]) break; sprintf(tmp, "gpio%d", i); mmcrptr[(0xc2a + v) / 2] |= u; gpio_config[i] = buf[i]; led_dev[i] = led_create(gpio_led, &led_cookie[i], tmp); break; case '.': gpio_config[i] = buf[i]; break; case '-': default: break; } } return (0); }