summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/ata-pci.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2009-02-18 22:17:48 +0000
committermav <mav@FreeBSD.org>2009-02-18 22:17:48 +0000
commitf10246717a6419e9755a0fbdd0a21da8b769c8f9 (patch)
treec51d12167c13be63889b1950e54f936d14b2ba41 /sys/dev/ata/ata-pci.c
parentbf75b4612ae760eeef7dbe0b2544c2532419caac (diff)
downloadFreeBSD-src-f10246717a6419e9755a0fbdd0a21da8b769c8f9.zip
FreeBSD-src-f10246717a6419e9755a0fbdd0a21da8b769c8f9.tar.gz
As soon as they called in only same one place (ata_pcichannel_attach()),
join allocate() and dmainit() atapci subdriver's channel initialization methods into single ch_attach() method. As opposite to ch_attach() add new ch_detach() method to deallocate/disable channel.
Diffstat (limited to 'sys/dev/ata/ata-pci.c')
-rw-r--r--sys/dev/ata/ata-pci.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c
index cbec410..d05d0b5 100644
--- a/sys/dev/ata/ata-pci.c
+++ b/sys/dev/ata/ata-pci.c
@@ -99,8 +99,7 @@ ata_pci_attach(device_t dev)
else
ctlr->channels = 1;
ctlr->ichannels = -1;
- ctlr->allocate = ata_pci_allocate;
- ctlr->dmainit = ata_pci_dmainit;
+ ctlr->ch_attach = ata_pci_ch_attach;
ctlr->dev = dev;
/* if needed try to enable busmastering */
@@ -344,7 +343,7 @@ ata_generic_chipinit(device_t dev)
}
int
-ata_pci_allocate(device_t dev)
+ata_pci_ch_attach(device_t dev)
{
struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
struct ata_channel *ch = device_get_softc(dev);
@@ -361,6 +360,8 @@ ata_pci_allocate(device_t dev)
return ENXIO;
}
+ ata_pci_dmainit(dev);
+
for (i = ATA_DATA; i <= ATA_COMMAND; i ++) {
ch->r_io[i].res = io;
ch->r_io[i].offset = i;
@@ -532,10 +533,7 @@ ata_pcichannel_attach(device_t dev)
ch->unit = (intptr_t)device_get_ivars(dev);
- if (ctlr->dmainit)
- ctlr->dmainit(dev);
-
- if ((error = ctlr->allocate(dev)))
+ if ((error = ctlr->ch_attach(dev)))
return error;
return ata_attach(dev);
@@ -544,14 +542,16 @@ ata_pcichannel_attach(device_t dev)
static int
ata_pcichannel_detach(device_t dev)
{
+ struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
int error;
if ((error = ata_detach(dev)))
return error;
- /* XXX SOS free resources for io and ctlio ?? */
+ if (ctlr->ch_detach)
+ return (ctlr->ch_detach(dev));
- return 0;
+ return (0);
}
static int
OpenPOWER on IntegriCloud