summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Schmidt <sos@FreeBSD.org>2004-03-01 13:17:07 +0000
committerSøren Schmidt <sos@FreeBSD.org>2004-03-01 13:17:07 +0000
commite7c9858a8f738d81a1b7758edf8293dcd9faa971 (patch)
tree07b0f1973673fafc42460d1f18cb99255e4aba82
parent2298a6e7660d23db767b1ff466fc08e2f9488d49 (diff)
Notes
-rw-r--r--sys/dev/ata/ata-all.c9
-rw-r--r--sys/dev/ata/ata-disk.c1
-rw-r--r--sys/dev/ata/atapi-cd.c1
-rw-r--r--sys/dev/ata/atapi-fd.c1
-rw-r--r--sys/dev/ata/atapi-tape.c1
5 files changed, 10 insertions, 3 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 27c2c1360b3e..dd369b0d77b2 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -123,9 +123,6 @@ ata_probe(device_t dev)
ch->device[SLAVE].mode = ATA_PIO;
ch->dev = dev;
ch->state = ATA_IDLE;
- bzero(&ch->queue_mtx, sizeof(struct mtx));
- mtx_init(&ch->queue_mtx, "ATA queue lock", MTX_DEF, 0);
- TAILQ_INIT(&ch->ata_queue);
/* initialise device(s) on this channel */
ch->locking(ch, ATA_LF_LOCK);
@@ -159,6 +156,11 @@ ata_attach(device_t dev)
if (ch->dma)
ch->dma->alloc(ch);
+ /* initialize queue and associated lock */
+ bzero(&ch->queue_mtx, sizeof(struct mtx));
+ mtx_init(&ch->queue_mtx, "ATA queue lock", MTX_DEF, 0);
+ TAILQ_INIT(&ch->ata_queue);
+
/* do not attach devices if we are in early boot */
if (ata_delayed_attach)
return 0;
@@ -220,6 +222,7 @@ ata_detach(device_t dev)
bus_teardown_intr(dev, ch->r_irq, ch->ih);
bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq);
ch->r_irq = NULL;
+ mtx_destroy(&ch->queue_mtx);
return 0;
}
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c
index 504049f3219c..5752e0e61762 100644
--- a/sys/dev/ata/ata-disk.c
+++ b/sys/dev/ata/ata-disk.c
@@ -169,6 +169,7 @@ ad_detach(struct ata_device *atadev)
mtx_lock(&adp->queue_mtx);
bioq_flush(&adp->queue, NULL, ENXIO);
mtx_unlock(&adp->queue_mtx);
+ mtx_destroy(&adp->queue_mtx);
disk_destroy(adp->disk);
ata_prtdev(atadev, "WARNING - removed from configuration\n");
ata_free_name(atadev);
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c
index 38309b3d8420..df10d95a1387 100644
--- a/sys/dev/ata/atapi-cd.c
+++ b/sys/dev/ata/atapi-cd.c
@@ -204,6 +204,7 @@ acd_detach(struct ata_device *atadev)
mtx_lock(&cdp->queue_mtx);
bioq_flush(&cdp->queue, NULL, ENXIO);
mtx_unlock(&cdp->queue_mtx);
+ mtx_destroy(&cdp->queue_mtx);
ata_prtdev(atadev, "WARNING - removed from configuration\n");
ata_free_name(atadev);
ata_free_lun(&acd_lun_map, cdp->lun);
diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c
index 0cba39acb1d7..e59f60ff5244 100644
--- a/sys/dev/ata/atapi-fd.c
+++ b/sys/dev/ata/atapi-fd.c
@@ -124,6 +124,7 @@ afd_detach(struct ata_device *atadev)
mtx_lock(&fdp->queue_mtx);
bioq_flush(&fdp->queue, NULL, ENXIO);
mtx_unlock(&fdp->queue_mtx);
+ mtx_destroy(&fdp->queue_mtx);
disk_destroy(fdp->disk);
ata_prtdev(atadev, "WARNING - removed from configuration\n");
ata_free_name(atadev);
diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c
index aef27a688325..c6ae4b792475 100644
--- a/sys/dev/ata/atapi-tape.c
+++ b/sys/dev/ata/atapi-tape.c
@@ -169,6 +169,7 @@ ast_detach(struct ata_device *atadev)
mtx_lock(&stp->queue_mtx);
bioq_flush(&stp->queue, NULL, ENXIO);
mtx_unlock(&stp->queue_mtx);
+ mtx_destroy(&stp->queue_mtx);
destroy_dev(stp->dev1);
destroy_dev(stp->dev2);
devstat_remove_entry(stp->stats);