diff options
author | mav <mav@FreeBSD.org> | 2009-02-19 12:47:24 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2009-02-19 12:47:24 +0000 |
commit | 6127a7d95a93e81e644a76241dcd28a7f41925f7 (patch) | |
tree | ebbbf416f6cb65d574f788efa836329c852e5273 /sys/dev/ata/ata-pci.c | |
parent | facbd7451d55460587d9d7295154cd25a90ae8d5 (diff) | |
download | FreeBSD-src-6127a7d95a93e81e644a76241dcd28a7f41925f7.zip FreeBSD-src-6127a7d95a93e81e644a76241dcd28a7f41925f7.tar.gz |
Use channel driver's attach/detach routines instead of ata_attach()/
ata_detach() to implement IOCATAATTACH/IOCATADETACH ioctls.
This will permit channel drivers to properly shutdown port hardware on channel
detach and init it on attach.
Diffstat (limited to 'sys/dev/ata/ata-pci.c')
-rw-r--r-- | sys/dev/ata/ata-pci.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index ebba094..c2f2953 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -550,8 +550,9 @@ ata_pcichannel_attach(device_t dev) struct ata_channel *ch = device_get_softc(dev); int error; - /* take care of green memory */ - bzero(ch, sizeof(struct ata_channel)); + if (ch->attached) + return (0); + ch->attached = 1; ch->unit = (intptr_t)device_get_ivars(dev); @@ -565,8 +566,13 @@ static int ata_pcichannel_detach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); + struct ata_channel *ch = device_get_softc(dev); int error; + if (!ch->attached) + return (0); + ch->attached = 0; + if ((error = ata_detach(dev))) return error; |