| 915 | } |
| 916 | |
| 917 | static int |
| 918 | ti_adc_detach(device_t dev) |
| 919 | { |
| 920 | struct ti_adc_softc *sc; |
| 921 | |
| 922 | sc = device_get_softc(dev); |
| 923 | |
| 924 | /* Turn off the ADC. */ |
| 925 | TI_ADC_LOCK(sc); |
| 926 | ti_adc_reset(sc); |
| 927 | ti_adc_setup(sc); |
| 928 | |
| 929 | #ifdef EVDEV_SUPPORT |
| 930 | evdev_free(sc->sc_evdev); |
| 931 | #endif |
| 932 | |
| 933 | TI_ADC_UNLOCK(sc); |
| 934 | |
| 935 | TI_ADC_LOCK_DESTROY(sc); |
| 936 | |
| 937 | if (sc->sc_intrhand) |
| 938 | bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intrhand); |
| 939 | if (sc->sc_irq_res) |
| 940 | bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); |
| 941 | if (sc->sc_mem_res) |
| 942 | bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); |
| 943 | |
| 944 | return (bus_generic_detach(dev)); |
| 945 | } |
| 946 | |
| 947 | static device_method_t ti_adc_methods[] = { |
| 948 | DEVMETHOD(device_probe, ti_adc_probe), |
no test coverage detected