tegra_ehci.c (5b56413d04e608379c9a306373554a8e4d321bc0) | tegra_ehci.c (3ddaf8200bc90b1410755ebac7b5c979ea90a2f6) |
---|---|
1/*- 2 * Copyright (c) 2016 Michal Meloun <mmel@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 99 unchanged lines hidden (view full) --- 108 return (ENXIO); 109} 110 111static int 112tegra_ehci_detach(device_t dev) 113{ 114 struct tegra_ehci_softc *sc; 115 ehci_softc_t *esc; | 1/*- 2 * Copyright (c) 2016 Michal Meloun <mmel@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 99 unchanged lines hidden (view full) --- 108 return (ENXIO); 109} 110 111static int 112tegra_ehci_detach(device_t dev) 113{ 114 struct tegra_ehci_softc *sc; 115 ehci_softc_t *esc; |
116 int error; |
|
116 | 117 |
118 error = bus_generic_detach(dev); 119 if (error != 0) 120 return (error); 121 |
|
117 sc = device_get_softc(dev); 118 119 esc = &sc->ehci_softc; 120 if (sc->clk != NULL) 121 clk_release(sc->clk); | 122 sc = device_get_softc(dev); 123 124 esc = &sc->ehci_softc; 125 if (sc->clk != NULL) 126 clk_release(sc->clk); |
122 if (esc->sc_bus.bdev != NULL) 123 device_delete_child(dev, esc->sc_bus.bdev); | |
124 if (esc->sc_flags & EHCI_SCFLG_DONEINIT) 125 ehci_detach(esc); 126 if (esc->sc_intr_hdl != NULL) 127 bus_teardown_intr(dev, esc->sc_irq_res, 128 esc->sc_intr_hdl); 129 if (sc->ehci_irq_res != NULL) 130 bus_release_resource(dev, SYS_RES_IRQ, 0, 131 sc->ehci_irq_res); 132 if (sc->ehci_mem_res != NULL) 133 bus_release_resource(dev, SYS_RES_MEMORY, 0, 134 sc->ehci_mem_res); 135 if (sc->usb_alloc_called) 136 usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc); 137 | 127 if (esc->sc_flags & EHCI_SCFLG_DONEINIT) 128 ehci_detach(esc); 129 if (esc->sc_intr_hdl != NULL) 130 bus_teardown_intr(dev, esc->sc_irq_res, 131 esc->sc_intr_hdl); 132 if (sc->ehci_irq_res != NULL) 133 bus_release_resource(dev, SYS_RES_IRQ, 0, 134 sc->ehci_irq_res); 135 if (sc->ehci_mem_res != NULL) 136 bus_release_resource(dev, SYS_RES_MEMORY, 0, 137 sc->ehci_mem_res); 138 if (sc->usb_alloc_called) 139 usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc); 140 |
138 /* During module unload there are lots of children leftover. */ 139 device_delete_children(dev); 140 | |
141 return (0); 142} 143 144static int 145tegra_ehci_attach(device_t dev) 146{ 147 struct tegra_ehci_softc *sc; 148 ehci_softc_t *esc; --- 167 unchanged lines hidden --- | 141 return (0); 142} 143 144static int 145tegra_ehci_attach(device_t dev) 146{ 147 struct tegra_ehci_softc *sc; 148 ehci_softc_t *esc; --- 167 unchanged lines hidden --- |