Add a reference to the adapter before probing the bus, and delete it

once we are done probing.
This commit is contained in:
thorpej 1998-11-19 22:25:56 +00:00
parent 3b068a6c78
commit 54b52fb5f6
2 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: atapiconf.c,v 1.14 1998/10/13 02:09:47 enami Exp $ */
/* $NetBSD: atapiconf.c,v 1.15 1998/11/19 22:25:56 thorpej Exp $ */
/*
* Copyright (c) 1996 Manuel Bouyer. All rights reserved.
@ -196,6 +196,7 @@ atapi_probe_bus(bus, target)
{
int maxtarget, mintarget;
struct atapibus_softc *atapi;
int error;
if (bus < 0 || bus >= atapibus_cd.cd_ndevs)
return (ENXIO);
@ -211,8 +212,11 @@ atapi_probe_bus(bus, target)
return (ENXIO);
maxtarget = mintarget = target;
}
if ((error = scsipi_adapter_addref(atapi->adapter_link)) != 0)
return (error);
for (target = mintarget; target <= maxtarget; target++)
atapi_probedev(atapi, target);
scsipi_adapter_delref(atapi->adapter_link);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsiconf.c,v 1.115 1998/11/17 14:38:42 bouyer Exp $ */
/* $NetBSD: scsiconf.c,v 1.116 1998/11/19 22:25:57 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -253,6 +253,7 @@ scsi_probe_bus(bus, target, lun)
struct scsibus_softc *scsi;
int maxtarget, mintarget, maxlun, minlun;
u_int8_t scsi_addr;
int error;
if (bus < 0 || bus >= scsibus_cd.cd_ndevs)
return (ENXIO);
@ -280,6 +281,8 @@ scsi_probe_bus(bus, target, lun)
maxlun = minlun = lun;
}
if ((error = scsipi_adapter_addref(scsi->adapter_link)) != 0)
return (error);
for (target = mintarget; target <= maxtarget; target++) {
if (target == scsi_addr)
continue;
@ -293,6 +296,7 @@ scsi_probe_bus(bus, target, lun)
/* otherwise something says we should look further */
}
}
scsipi_adapter_delref(scsi->adapter_link);
return (0);
}