zy7_ehci.c (a49d8b6ecc0323b5ee7cf68348e49cc59b40296c) zy7_ehci.c (d3bf5efc1ff19b102b176512a66110ec84ac982d)
1/*-
2 * Copyright (c) 2012-2013 Thomas Skibo
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

--- 309 unchanged lines hidden (view full) ---

318 return (0);
319}
320
321static int
322zy7_ehci_detach(device_t dev)
323{
324 ehci_softc_t *sc = device_get_softc(dev);
325
1/*-
2 * Copyright (c) 2012-2013 Thomas Skibo
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

--- 309 unchanged lines hidden (view full) ---

318 return (0);
319}
320
321static int
322zy7_ehci_detach(device_t dev)
323{
324 ehci_softc_t *sc = device_get_softc(dev);
325
326 /* during module unload there are lots of children leftover */
327 device_delete_children(dev);
328
326 sc->sc_flags &= ~EHCI_SCFLG_DONEINIT;
327
329 sc->sc_flags &= ~EHCI_SCFLG_DONEINIT;
330
328 if (device_is_attached(dev))
329 bus_generic_detach(dev);
330
331 if (sc->sc_irq_res && sc->sc_intr_hdl)
332 /* call ehci_detach() after ehci_init() called after
333 * successful bus_setup_intr().
334 */
335 ehci_detach(sc);
331 if (sc->sc_irq_res && sc->sc_intr_hdl)
332 /* call ehci_detach() after ehci_init() called after
333 * successful bus_setup_intr().
334 */
335 ehci_detach(sc);
336 if (sc->sc_bus.bdev) {
337 device_detach(sc->sc_bus.bdev);
338 device_delete_child(dev, sc->sc_bus.bdev);
339 }
336
340 if (sc->sc_irq_res) {
341 if (sc->sc_intr_hdl != NULL)
342 bus_teardown_intr(dev, sc->sc_irq_res,
343 sc->sc_intr_hdl);
344 bus_release_resource(dev, SYS_RES_IRQ,
345 rman_get_rid(sc->sc_irq_res), sc->sc_irq_res);
346 }
347

--- 32 unchanged lines hidden ---
337 if (sc->sc_irq_res) {
338 if (sc->sc_intr_hdl != NULL)
339 bus_teardown_intr(dev, sc->sc_irq_res,
340 sc->sc_intr_hdl);
341 bus_release_resource(dev, SYS_RES_IRQ,
342 rman_get_rid(sc->sc_irq_res), sc->sc_irq_res);
343 }
344

--- 32 unchanged lines hidden ---