spi.c (34f5de82e8fcf0ab335a708a9141a5f4240a4c64) spi.c (3ddaf8200bc90b1410755ebac7b5c979ea90a2f6)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

545
546 return (ENXIO);
547}
548
549int
550intelspi_detach(device_t dev)
551{
552 struct intelspi_softc *sc;
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

545
546 return (ENXIO);
547}
548
549int
550intelspi_detach(device_t dev)
551{
552 struct intelspi_softc *sc;
553 int error;
553
554 sc = device_get_softc(dev);
555
554
555 sc = device_get_softc(dev);
556
557 error = bus_generic_detach(dev);
558 if (error != 0)
559 return (error);
560
556 INTELSPI_LOCK_DESTROY(sc);
557
558 if (sc->sc_irq_ih)
559 bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_ih);
560
561 if (sc->sc_mem_res != NULL)
562 bus_release_resource(dev, SYS_RES_MEMORY,
563 sc->sc_mem_rid, sc->sc_mem_res);
564
565 if (sc->sc_irq_res != NULL)
566 bus_release_resource(dev, SYS_RES_IRQ,
567 sc->sc_irq_rid, sc->sc_irq_res);
568
561 INTELSPI_LOCK_DESTROY(sc);
562
563 if (sc->sc_irq_ih)
564 bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_ih);
565
566 if (sc->sc_mem_res != NULL)
567 bus_release_resource(dev, SYS_RES_MEMORY,
568 sc->sc_mem_rid, sc->sc_mem_res);
569
570 if (sc->sc_irq_res != NULL)
571 bus_release_resource(dev, SYS_RES_IRQ,
572 sc->sc_irq_rid, sc->sc_irq_res);
573
569 return (device_delete_children(dev));
574 return (0);
570}
571
572int
573intelspi_suspend(device_t dev)
574{
575 struct intelspi_softc *sc;
576 int err, i;
577

--- 41 unchanged lines hidden ---
575}
576
577int
578intelspi_suspend(device_t dev)
579{
580 struct intelspi_softc *sc;
581 int err, i;
582

--- 41 unchanged lines hidden ---