summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2010-06-28 08:35:47 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2010-06-28 08:35:47 +0000
commit449a5242d535e6a55d98a78538e9feb2ae617e46 (patch)
treebe61211591745f9ac49094f78dff8b9436bd29b0 /sys/scsi
parente1ff1b940aff4e9a8375c3bf8d8a0ad5daece206 (diff)
Move disk_attach() to the end of the attach functions, at which point the
disk is now ready to handle I/O. ok krw@ dlg@
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/cd.c8
-rw-r--r--sys/scsi/sd.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index b721935f8b8..b62604ddc5a 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.171 2010/06/15 04:11:34 dlg Exp $ */
+/* $OpenBSD: cd.c,v 1.172 2010/06/28 08:35:46 jsing Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -221,12 +221,11 @@ cdattach(struct device *parent, struct device *self, void *aux)
sc_link->openings = CDOUTSTANDING;
/*
- * Initialize and attach the disk structure.
+ * Initialize disk structures.
*/
sc->sc_dk.dk_driver = &cddkdriver;
sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
sc->sc_bufq = bufq_init(BUFQ_DEFAULT);
- disk_attach(&sc->sc_dk);
/*
* Note if this device is ancient. This is used in cdminphys().
@@ -244,6 +243,9 @@ cdattach(struct device *parent, struct device *self, void *aux)
if ((sc->sc_cdpwrhook = powerhook_establish(cd_powerhook, sc)) == NULL)
printf("%s: WARNING: unable to establish power hook\n",
sc->sc_dev.dv_xname);
+
+ /* Attach disk. */
+ disk_attach(&sc->sc_dk);
}
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 5ff51310ab3..11e207b3ff9 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.197 2010/06/24 10:05:18 dlg Exp $ */
+/* $OpenBSD: sd.c,v 1.198 2010/06/28 08:35:46 jsing Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -178,12 +178,11 @@ sdattach(struct device *parent, struct device *self, void *aux)
sc_link->device_softc = sc;
/*
- * Initialize and attach the disk structure.
+ * Initialize disk structures.
*/
sc->sc_dk.dk_driver = &sddkdriver;
sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
sc->sc_bufq = bufq_init(BUFQ_DEFAULT);
- disk_attach(&sc->sc_dk);
if ((sc_link->flags & SDEV_ATAPI) && (sc_link->flags & SDEV_REMOVABLE))
sc_link->quirks |= SDEV_NOSYNCCACHE;
@@ -270,6 +269,9 @@ sdattach(struct device *parent, struct device *self, void *aux)
shutdownhook_establish(sd_shutdown, sc)) == NULL)
printf("%s: WARNING: unable to establish shutdown hook\n",
sc->sc_dev.dv_xname);
+
+ /* Attach disk. */
+ disk_attach(&sc->sc_dk);
}
int