Deleted Added
full compact
ppc.c (188173) ppc.c (227701)
1/*-
2 * Copyright (c) 1997-2000 Nicolas Souchu
3 * Copyright (c) 2001 Alcove - Nicolas Souchu
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997-2000 Nicolas Souchu
3 * Copyright (c) 2001 Alcove - Nicolas Souchu
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/ppc/ppc.c 188173 2009-02-05 19:31:55Z imp $");
29__FBSDID("$FreeBSD: head/sys/dev/ppc/ppc.c 227701 2011-11-19 10:11:50Z hselasky $");
30
31#include "opt_ppc.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/bus.h>
36#include <sys/kernel.h>
37#include <sys/lock.h>

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

1846
1847 return (0);
1848}
1849
1850int
1851ppc_detach(device_t dev)
1852{
1853 struct ppc_data *ppc = DEVTOSOFTC(dev);
30
31#include "opt_ppc.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/bus.h>
36#include <sys/kernel.h>
37#include <sys/lock.h>

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

1846
1847 return (0);
1848}
1849
1850int
1851ppc_detach(device_t dev)
1852{
1853 struct ppc_data *ppc = DEVTOSOFTC(dev);
1854 device_t *children;
1855 int nchildren, i;
1856
1857 if (ppc->res_irq == 0) {
1858 return (ENXIO);
1859 }
1860
1861 /* detach & delete all children */
1854
1855 if (ppc->res_irq == 0) {
1856 return (ENXIO);
1857 }
1858
1859 /* detach & delete all children */
1862 if (!device_get_children(dev, &children, &nchildren)) {
1863 for (i = 0; i < nchildren; i++)
1864 if (children[i])
1865 device_delete_child(dev, children[i]);
1866 free(children, M_TEMP);
1867 }
1860 device_delete_all_children(dev);
1868
1869 if (ppc->res_irq != 0) {
1870 bus_teardown_intr(dev, ppc->res_irq, ppc->intr_cookie);
1871 bus_release_resource(dev, SYS_RES_IRQ, ppc->rid_irq,
1872 ppc->res_irq);
1873 }
1874 if (ppc->res_ioport != 0) {
1875 bus_release_resource(dev, SYS_RES_IOPORT, ppc->rid_ioport,

--- 166 unchanged lines hidden ---
1861
1862 if (ppc->res_irq != 0) {
1863 bus_teardown_intr(dev, ppc->res_irq, ppc->intr_cookie);
1864 bus_release_resource(dev, SYS_RES_IRQ, ppc->rid_irq,
1865 ppc->res_irq);
1866 }
1867 if (ppc->res_ioport != 0) {
1868 bus_release_resource(dev, SYS_RES_IOPORT, ppc->rid_ioport,

--- 166 unchanged lines hidden ---