diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2006-10-22 22:43:22 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2006-10-22 22:43:22 +0000 |
commit | ac506658ebb21e072d1ff4f4390e004b7c69516a (patch) | |
tree | 454984eb2f7501134063a2f26159c38fa56afb63 /sys/dev | |
parent | 94413c4fa13a3d5c19099d47671bbb56bd3db8cc (diff) |
fetch the name of the cd device attached to the atapiscsi scsibus by
following the child device that attaches to us. this is cleaner than using
the scsibus member of the adapters sc_link to look up the correct unit.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/atapiscsi/atapiscsi.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/dev/atapiscsi/atapiscsi.c b/sys/dev/atapiscsi/atapiscsi.c index ce4344aa4f5..b23ec973848 100644 --- a/sys/dev/atapiscsi/atapiscsi.c +++ b/sys/dev/atapiscsi/atapiscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atapiscsi.c,v 1.74 2006/10/22 22:39:57 dlg Exp $ */ +/* $OpenBSD: atapiscsi.c,v 1.75 2006/10/22 22:43:21 dlg Exp $ */ /* * This code is derived from code with the copyright below. @@ -225,13 +225,13 @@ void atapiscsi_attach(parent, self, aux) struct device *parent, *self; void *aux; - { struct atapiscsi_softc *as = (struct atapiscsi_softc *)self; struct ata_atapi_attach *aa_link = aux; struct ata_drive_datas *drvp = aa_link->aa_drv_data; struct channel_softc *chp = drvp->chnl_softc; struct ataparams *id = &drvp->id; + struct device *child; printf("\n"); @@ -286,16 +286,11 @@ atapiscsi_attach(parent, self, aux) WDCDEBUG_PRINT(("driver caps %04x\n", drvp->atapi_cap), DEBUG_PROBE); + child = config_found((struct device *)as, &as->sc_adapterlink, + scsiprint); - as->sc_adapterlink.scsibus = (u_int8_t)-1; - - config_found((struct device *)as, - &as->sc_adapterlink, scsiprint); - - if (as->sc_adapterlink.scsibus != (u_int8_t)-1) { - int bus = as->sc_adapterlink.scsibus; - extern struct cfdriver scsibus_cd; - struct scsibus_softc *scsi = scsibus_cd.cd_devs[bus]; + if (child != NULL) { + struct scsibus_softc *scsi = (struct scsibus_softc *)child; struct scsi_link *link = scsi->sc_link[0][0]; if (link) { |