diff options
author | mav <mav@FreeBSD.org> | 2009-03-09 20:48:57 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2009-03-09 20:48:57 +0000 |
commit | bc83c57ba7c92d1523020d8eeee3e432aaf72bb0 (patch) | |
tree | 1056a796d7247c6966802ab9853e4582b8827c27 /sys/dev/ata/ata-pci.c | |
parent | 9ba769ec34275c685b57136a2b70a74003d36cb5 (diff) | |
download | FreeBSD-src-bc83c57ba7c92d1523020d8eeee3e432aaf72bb0.zip FreeBSD-src-bc83c57ba7c92d1523020d8eeee3e432aaf72bb0.tar.gz |
Add type specific suspend/resume ata channel functions. Add checks to avoid
crash on detached channel resume. Add placeholder for possible type-specific
suspend/resume routines.
Diffstat (limited to 'sys/dev/ata/ata-pci.c')
-rw-r--r-- | sys/dev/ata/ata-pci.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index c2f2953..97261d2 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -581,6 +581,28 @@ ata_pcichannel_detach(device_t dev) return (0); } +static int +ata_pcichannel_suspend(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (!ch->attached) + return (0); + + return ata_suspend(dev); +} + +static int +ata_pcichannel_resume(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (!ch->attached) + return (0); + + return ata_resume(dev); +} + static int ata_pcichannel_locking(device_t dev, int mode) @@ -629,8 +651,8 @@ static device_method_t ata_pcichannel_methods[] = { DEVMETHOD(device_attach, ata_pcichannel_attach), DEVMETHOD(device_detach, ata_pcichannel_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, ata_suspend), - DEVMETHOD(device_resume, ata_resume), + DEVMETHOD(device_suspend, ata_pcichannel_suspend), + DEVMETHOD(device_resume, ata_pcichannel_resume), /* ATA methods */ DEVMETHOD(ata_setmode, ata_pcichannel_setmode), |