summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Long <scottl@FreeBSD.org>2018-02-06 06:42:25 +0000
committerScott Long <scottl@FreeBSD.org>2018-02-06 06:42:25 +0000
commit99e7a4ad9e6fe53868cb15449667ad46814d692b (patch)
treedd1f69f49785e64aaff2cfabbcb463555c431816
parent87dda4ed5d3d34f339a5a8e1643627c1f28001dc (diff)
Notes
-rw-r--r--sys/cam/ata/ata_da.c8
-rw-r--r--sys/cam/ata/ata_pmp.c4
-rw-r--r--sys/cam/ata/ata_xpt.c8
-rw-r--r--sys/cam/cam_periph.c12
-rw-r--r--sys/cam/cam_periph.h2
-rw-r--r--sys/cam/ctl/scsi_ctl.c10
-rw-r--r--sys/cam/mmc/mmc_da.c4
-rw-r--r--sys/cam/mmc/mmc_xpt.c8
-rw-r--r--sys/cam/nvme/nvme_da.c6
-rw-r--r--sys/cam/nvme/nvme_xpt.c8
-rw-r--r--sys/cam/scsi/scsi_cd.c10
-rw-r--r--sys/cam/scsi/scsi_da.c17
-rw-r--r--sys/cam/scsi/scsi_enc.c6
-rw-r--r--sys/cam/scsi/scsi_pass.c12
-rw-r--r--sys/cam/scsi/scsi_pt.c2
-rw-r--r--sys/cam/scsi/scsi_sa.c4
-rw-r--r--sys/cam/scsi/scsi_sg.c4
-rw-r--r--sys/cam/scsi/scsi_xpt.c8
18 files changed, 62 insertions, 71 deletions
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index fa88260c8b51..1a55ff41df80 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -911,7 +911,7 @@ adaopen(struct disk *dp)
int error;
periph = (struct cam_periph *)dp->d_drv1;
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
return(ENXIO);
}
@@ -1328,7 +1328,7 @@ adaasync(void *callback_arg, u_int32_t code,
softc->state = ADA_STATE_LOGDIR;
else
break;
- if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) != 0)
softc->state = ADA_STATE_NORMAL;
else
xpt_schedule(periph, CAM_PRIORITY_DEV);
@@ -1841,7 +1841,7 @@ adaregister(struct cam_periph *periph, void *arg)
* We'll release this reference once GEOM calls us back (via
* adadiskgonecb()) telling us that our provider has been freed.
*/
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
xpt_print(periph->path, "%s: lost periph during "
"registration!\n", __func__);
cam_periph_lock(periph);
@@ -1866,7 +1866,7 @@ adaregister(struct cam_periph *periph, void *arg)
* Create our sysctl variables, now that we know
* we have successfully attached.
*/
- if (cam_periph_acquire(periph) == CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) == 0)
taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task);
/*
diff --git a/sys/cam/ata/ata_pmp.c b/sys/cam/ata/ata_pmp.c
index defab2477655..6d5cec194811 100644
--- a/sys/cam/ata/ata_pmp.c
+++ b/sys/cam/ata/ata_pmp.c
@@ -315,7 +315,7 @@ pmpasync(void *callback_arg, u_int32_t code,
if (code == AC_SENT_BDR || code == AC_BUS_RESET)
softc->found = 0; /* We have to reset everything. */
if (softc->state == PMP_STATE_NORMAL) {
- if (cam_periph_acquire(periph) == CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) == 0) {
if (softc->pm_pid == 0x37261095 ||
softc->pm_pid == 0x38261095)
softc->state = PMP_STATE_PM_QUIRKS_1;
@@ -343,7 +343,7 @@ pmpsysctlinit(void *context, int pending)
char tmpstr[32], tmpstr2[16];
periph = (struct cam_periph *)context;
- if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) != 0)
return;
softc = (struct pmp_softc *)periph->softc;
diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c
index 334752efe2c4..c41ab076b122 100644
--- a/sys/cam/ata/ata_xpt.c
+++ b/sys/cam/ata/ata_xpt.c
@@ -280,7 +280,6 @@ static cam_status
proberegister(struct cam_periph *periph, void *arg)
{
union ccb *request_ccb; /* CCB representing the probe request */
- cam_status status;
probe_softc *softc;
request_ccb = (union ccb *)arg;
@@ -304,10 +303,9 @@ proberegister(struct cam_periph *periph, void *arg)
periph->softc = softc;
softc->periph = periph;
softc->action = PROBE_INVALID;
- status = cam_periph_acquire(periph);
- if (status != CAM_REQ_CMP) {
- return (status);
- }
+ if (cam_periph_acquire(periph) != 0)
+ return (CAM_REQ_CMP_ERR);
+
CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe started\n"));
ata_device_transport(periph->path);
probeschedule(periph);
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index 6cb4583e92d8..e563b7f46abb 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -403,19 +403,19 @@ retry:
return (count);
}
-cam_status
+int
cam_periph_acquire(struct cam_periph *periph)
{
- cam_status status;
+ int status;
- status = CAM_REQ_CMP_ERR;
if (periph == NULL)
- return (status);
+ return (EINVAL);
+ status = ENOENT;
xpt_lock_buses();
if ((periph->flags & CAM_PERIPH_INVALID) == 0) {
periph->refcount++;
- status = CAM_REQ_CMP;
+ status = 0;
}
xpt_unlock_buses();
@@ -482,7 +482,7 @@ cam_periph_hold(struct cam_periph *periph, int priority)
* from user us while we sleep.
*/
- if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) != 0)
return (ENXIO);
cam_periph_assert(periph, MA_OWNED);
diff --git a/sys/cam/cam_periph.h b/sys/cam/cam_periph.h
index ee9a5fc0f07f..4694327be2fd 100644
--- a/sys/cam/cam_periph.h
+++ b/sys/cam/cam_periph.h
@@ -159,7 +159,7 @@ cam_status cam_periph_alloc(periph_ctor_t *periph_ctor,
ac_callback_t *, ac_code, void *arg);
struct cam_periph *cam_periph_find(struct cam_path *path, char *name);
int cam_periph_list(struct cam_path *, struct sbuf *);
-cam_status cam_periph_acquire(struct cam_periph *periph);
+int cam_periph_acquire(struct cam_periph *periph);
void cam_periph_doacquire(struct cam_periph *periph);
void cam_periph_release(struct cam_periph *periph);
void cam_periph_release_locked(struct cam_periph *periph);
diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c
index cf8ff2fb9188..912c4c49245d 100644
--- a/sys/cam/ctl/scsi_ctl.c
+++ b/sys/cam/ctl/scsi_ctl.c
@@ -459,7 +459,7 @@ ctlferegister(struct cam_periph *periph, void *arg)
struct ctlfe_lun_softc *softc;
union ccb ccb;
cam_status status;
- int i;
+ int i, acstatus;
softc = (struct ctlfe_lun_softc *)arg;
bus_softc = softc->parent_softc;
@@ -539,11 +539,11 @@ ctlferegister(struct cam_periph *periph, void *arg)
}
}
- status = cam_periph_acquire(periph);
- if ((status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+ acstatus = cam_periph_acquire(periph);
+ if (acstatus != 0) {
xpt_print(periph->path, "%s: could not acquire reference "
- "count, status = %#x\n", __func__, status);
- return (status);
+ "count, status = %#x\n", __func__, acstatus);
+ return (CAM_REQ_CMP_ERR);
}
if (i == 0) {
diff --git a/sys/cam/mmc/mmc_da.c b/sys/cam/mmc/mmc_da.c
index dd865ae374a4..84095f48f6ef 100644
--- a/sys/cam/mmc/mmc_da.c
+++ b/sys/cam/mmc/mmc_da.c
@@ -369,7 +369,7 @@ sddaopen(struct disk *dp)
int error;
periph = (struct cam_periph *)dp->d_drv1;
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
return(ENXIO);
}
@@ -744,7 +744,7 @@ sdda_hook_into_geom(struct cam_periph *periph)
* We'll release this reference once GEOM calls us back (via
* sddadiskgonecb()) telling us that our provider has been freed.
*/
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
xpt_print(periph->path, "%s: lost periph during "
"registration!\n", __func__);
cam_periph_lock(periph);
diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c
index 4837b4847ed1..d2cb8bd8f14f 100644
--- a/sys/cam/mmc/mmc_xpt.c
+++ b/sys/cam/mmc/mmc_xpt.c
@@ -471,9 +471,9 @@ probe_periph_init()
static cam_status
mmcprobe_register(struct cam_periph *periph, void *arg)
{
- union ccb *request_ccb; /* CCB representing the probe request */
- cam_status status;
mmcprobe_softc *softc;
+ union ccb *request_ccb; /* CCB representing the probe request */
+ int status;
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("mmcprobe_register\n"));
@@ -501,10 +501,10 @@ mmcprobe_register(struct cam_periph *periph, void *arg)
status = cam_periph_acquire(periph);
memset(&periph->path->device->mmc_ident_data, 0, sizeof(struct mmc_params));
- if (status != CAM_REQ_CMP) {
+ if (status != 0) {
printf("proberegister: cam_periph_acquire failed (status=%d)\n",
status);
- return (status);
+ return (CAM_REQ_CMP_ERR);
}
CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe started\n"));
diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c
index b120a414629d..40ef7c70765f 100644
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -260,7 +260,7 @@ ndaopen(struct disk *dp)
int error;
periph = (struct cam_periph *)dp->d_drv1;
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
return(ENXIO);
}
@@ -785,7 +785,7 @@ ndaregister(struct cam_periph *periph, void *arg)
* We'll release this reference once GEOM calls us back (via
* ndadiskgonecb()) telling us that our provider has been freed.
*/
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
xpt_print(periph->path, "%s: lost periph during "
"registration!\n", __func__);
cam_periph_lock(periph);
@@ -807,7 +807,7 @@ ndaregister(struct cam_periph *periph, void *arg)
* Create our sysctl variables, now that we know
* we have successfully attached.
*/
- if (cam_periph_acquire(periph) == CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) == 0)
taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task);
/*
diff --git a/sys/cam/nvme/nvme_xpt.c b/sys/cam/nvme/nvme_xpt.c
index 6aacd9e8eb82..2719f35ec005 100644
--- a/sys/cam/nvme/nvme_xpt.c
+++ b/sys/cam/nvme/nvme_xpt.c
@@ -198,7 +198,6 @@ static cam_status
nvme_probe_register(struct cam_periph *periph, void *arg)
{
union ccb *request_ccb; /* CCB representing the probe request */
- cam_status status;
nvme_probe_softc *softc;
request_ccb = (union ccb *)arg;
@@ -222,10 +221,9 @@ nvme_probe_register(struct cam_periph *periph, void *arg)
periph->softc = softc;
softc->periph = periph;
softc->action = NVME_PROBE_INVALID;
- status = cam_periph_acquire(periph);
- if (status != CAM_REQ_CMP) {
- return (status);
- }
+ if (cam_periph_acquire(periph) != 0)
+ return (CAM_REQ_CMP_ERR);
+
CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe started\n"));
// nvme_device_transport(periph->path);
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index 182165e0a5c7..50fb4709aa9f 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -445,7 +445,7 @@ cdasync(void *callback_arg, u_int32_t code,
case AC_SCSI_AEN:
softc = (struct cd_softc *)periph->softc;
if (softc->state == CD_STATE_NORMAL && !softc->tur) {
- if (cam_periph_acquire(periph) == CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) == 0) {
softc->tur = 1;
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
}
@@ -480,7 +480,7 @@ cdsysctlinit(void *context, int pending)
char tmpstr[32], tmpstr2[16];
periph = (struct cam_periph *)context;
- if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) != 0)
return;
softc = (struct cd_softc *)periph->softc;
@@ -676,7 +676,7 @@ cdregister(struct cam_periph *periph, void *arg)
* We'll release this reference once GEOM calls us back (via
* dadiskgonecb()) telling us that our provider has been freed.
*/
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
xpt_print(periph->path, "%s: lost periph during "
"registration!\n", __func__);
cam_periph_lock(periph);
@@ -717,7 +717,7 @@ cdopen(struct disk *dp)
periph = (struct cam_periph *)dp->d_drv1;
softc = (struct cd_softc *)periph->softc;
- if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) != 0)
return(ENXIO);
cam_periph_lock(periph);
@@ -2601,7 +2601,7 @@ cdmediapoll(void *arg)
if (softc->state == CD_STATE_NORMAL && !softc->tur &&
softc->outstanding_cmds == 0) {
- if (cam_periph_acquire(periph) == CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) == 0) {
softc->tur = 1;
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
}
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 9c5cb1368870..5f061db91cbe 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -1565,7 +1565,7 @@ da_periph_acquire(struct cam_periph *periph, da_ref_token token)
token_sanity(token);
DA_PERIPH_PRINT(periph, "acquiring device %s (%d): %d\n",
da_ref_text[token], token, err);
- if (err == CAM_REQ_CMP) {
+ if (err == 0) {
int cnt;
struct da_softc *softc = periph->softc;
@@ -1628,7 +1628,7 @@ daopen(struct disk *dp)
int error;
periph = (struct cam_periph *)dp->d_drv1;
- if (da_periph_acquire(periph, DA_REF_OPEN) != CAM_REQ_CMP) {
+ if (da_periph_acquire(periph, DA_REF_OPEN) != 0) {
return (ENXIO);
}
@@ -2061,7 +2061,7 @@ daasync(void *callback_arg, u_int32_t code,
case AC_SCSI_AEN:
softc = (struct da_softc *)periph->softc;
if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) {
- if (da_periph_acquire(periph, DA_REF_TUR) == CAM_REQ_CMP) {
+ if (da_periph_acquire(periph, DA_REF_TUR) == 0) {
cam_iosched_set_work_flags(softc->cam_iosched, DA_WORK_TUR);
daschedule(periph);
}
@@ -2732,7 +2732,7 @@ daregister(struct cam_periph *periph, void *arg)
* We'll release this reference once GEOM calls us back (via
* dadiskgonecb()) telling us that our provider has been freed.
*/
- if (da_periph_acquire(periph, DA_REF_GEOM) != CAM_REQ_CMP) {
+ if (da_periph_acquire(periph, DA_REF_GEOM) != 0) {
xpt_print(periph->path, "%s: lost periph during "
"registration!\n", __func__);
cam_periph_lock(periph);
@@ -4700,7 +4700,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
* we have successfully attached.
*/
/* increase the refcount */
- if (da_periph_acquire(periph, DA_REF_SYSCTL) == CAM_REQ_CMP) {
+ if (da_periph_acquire(periph, DA_REF_SYSCTL) == 0) {
taskqueue_enqueue(taskqueue_thread,
&softc->sysctl_task);
@@ -5558,7 +5558,7 @@ static void
dareprobe(struct cam_periph *periph)
{
struct da_softc *softc;
- cam_status status;
+ int status;
softc = (struct da_softc *)periph->softc;
@@ -5567,8 +5567,7 @@ dareprobe(struct cam_periph *periph)
return;
status = da_periph_acquire(periph, DA_REF_REPROBE);
- KASSERT(status == CAM_REQ_CMP,
- ("dareprobe: cam_periph_acquire failed"));
+ KASSERT(status == 0, ("dareprobe: cam_periph_acquire failed"));
softc->state = DA_STATE_PROBE_WP;
xpt_schedule(periph, CAM_PRIORITY_DEV);
@@ -5666,7 +5665,7 @@ damediapoll(void *arg)
if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR) &&
LIST_EMPTY(&softc->pending_ccbs)) {
- if (da_periph_acquire(periph, DA_REF_TUR) == CAM_REQ_CMP) {
+ if (da_periph_acquire(periph, DA_REF_TUR) == 0) {
cam_iosched_set_work_flags(softc->cam_iosched, DA_WORK_TUR);
daschedule(periph);
}
diff --git a/sys/cam/scsi/scsi_enc.c b/sys/cam/scsi/scsi_enc.c
index b59e8a398be3..bb412c6fffc8 100644
--- a/sys/cam/scsi/scsi_enc.c
+++ b/sys/cam/scsi/scsi_enc.c
@@ -267,7 +267,7 @@ enc_open(struct cdev *dev, int flags, int fmt, struct thread *td)
int error = 0;
periph = (struct cam_periph *)dev->si_drv1;
- if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) != 0)
return (ENXIO);
cam_periph_lock(periph);
@@ -859,7 +859,7 @@ enc_kproc_init(enc_softc_t *enc)
callout_init_mtx(&enc->status_updater, cam_periph_mtx(enc->periph), 0);
- if (cam_periph_acquire(enc->periph) != CAM_REQ_CMP)
+ if (cam_periph_acquire(enc->periph) != 0)
return (ENXIO);
result = kproc_create(enc_daemon, enc, &enc->enc_daemon, /*flags*/0,
@@ -975,7 +975,7 @@ enc_ctor(struct cam_periph *periph, void *arg)
* instance for it. We'll release this reference once the devfs
* instance has been freed.
*/
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
xpt_print(periph->path, "%s: lost periph during "
"registration!\n", __func__);
cam_periph_lock(periph);
diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c
index 160f6b118867..82546b78073b 100644
--- a/sys/cam/scsi/scsi_pass.c
+++ b/sys/cam/scsi/scsi_pass.c
@@ -518,7 +518,6 @@ passasync(void *callback_arg, u_int32_t code,
buftype = (uintptr_t)arg;
if (buftype == CDAI_TYPE_PHYS_PATH) {
struct pass_softc *softc;
- cam_status status;
softc = (struct pass_softc *)periph->softc;
/*
@@ -527,8 +526,7 @@ passasync(void *callback_arg, u_int32_t code,
* a situation where the periph goes away before
* the task queue has a chance to run.
*/
- status = cam_periph_acquire(periph);
- if (status != CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) != 0)
break;
taskqueue_enqueue(taskqueue_thread,
@@ -626,7 +624,7 @@ passregister(struct cam_periph *periph, void *arg)
* Acquire a reference to the periph that we can release once we've
* cleaned up the kqueue.
*/
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
xpt_print(periph->path, "%s: lost periph during "
"registration!\n", __func__);
cam_periph_lock(periph);
@@ -638,7 +636,7 @@ passregister(struct cam_periph *periph, void *arg)
* instance for it. We'll release this reference once the devfs
* instance has been freed.
*/
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
xpt_print(periph->path, "%s: lost periph during "
"registration!\n", __func__);
cam_periph_lock(periph);
@@ -665,7 +663,7 @@ passregister(struct cam_periph *periph, void *arg)
* Hold a reference to the periph before we create the physical
* path alias so it can't go away.
*/
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
xpt_print(periph->path, "%s: lost periph during "
"registration!\n", __func__);
cam_periph_lock(periph);
@@ -705,7 +703,7 @@ passopen(struct cdev *dev, int flags, int fmt, struct thread *td)
int error;
periph = (struct cam_periph *)dev->si_drv1;
- if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) != 0)
return (ENXIO);
cam_periph_lock(periph);
diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c
index 6ff8fc07cda4..39784b04a3f4 100644
--- a/sys/cam/scsi/scsi_pt.c
+++ b/sys/cam/scsi/scsi_pt.c
@@ -142,7 +142,7 @@ ptopen(struct cdev *dev, int flags, int fmt, struct thread *td)
int error = 0;
periph = (struct cam_periph *)dev->si_drv1;
- if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) != 0)
return (ENXIO);
softc = (struct pt_softc *)periph->softc;
diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c
index cdfa93e2c1dd..1be9d9bac1b8 100644
--- a/sys/cam/scsi/scsi_sa.c
+++ b/sys/cam/scsi/scsi_sa.c
@@ -657,7 +657,7 @@ saopen(struct cdev *dev, int flags, int fmt, struct thread *td)
int error;
periph = (struct cam_periph *)dev->si_drv1;
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
return (ENXIO);
}
@@ -2495,7 +2495,7 @@ saregister(struct cam_periph *periph, void *arg)
* instances for it. We'll release this reference once the devfs
* instances have been freed.
*/
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
xpt_print(periph->path, "%s: lost periph during "
"registration!\n", __func__);
cam_periph_lock(periph);
diff --git a/sys/cam/scsi/scsi_sg.c b/sys/cam/scsi/scsi_sg.c
index e75020f02d74..4fd665a7124e 100644
--- a/sys/cam/scsi/scsi_sg.c
+++ b/sys/cam/scsi/scsi_sg.c
@@ -353,7 +353,7 @@ sgregister(struct cam_periph *periph, void *arg)
* instance for it. We'll release this reference once the devfs
* instance has been freed.
*/
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ if (cam_periph_acquire(periph) != 0) {
xpt_print(periph->path, "%s: lost periph during "
"registration!\n", __func__);
cam_periph_lock(periph);
@@ -439,7 +439,7 @@ sgopen(struct cdev *dev, int flags, int fmt, struct thread *td)
int error = 0;
periph = (struct cam_periph *)dev->si_drv1;
- if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) != 0)
return (ENXIO);
/*
diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c
index 2b44b1d7564e..05f773c79512 100644
--- a/sys/cam/scsi/scsi_xpt.c
+++ b/sys/cam/scsi/scsi_xpt.c
@@ -657,7 +657,6 @@ static cam_status
proberegister(struct cam_periph *periph, void *arg)
{
union ccb *request_ccb; /* CCB representing the probe request */
- cam_status status;
probe_softc *softc;
request_ccb = (union ccb *)arg;
@@ -681,10 +680,9 @@ proberegister(struct cam_periph *periph, void *arg)
periph->softc = softc;
softc->periph = periph;
softc->action = PROBE_INVALID;
- status = cam_periph_acquire(periph);
- if (status != CAM_REQ_CMP) {
- return (status);
- }
+ if (cam_periph_acquire(periph) != 0)
+ return (CAM_REQ_CMP_ERR);
+
CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe started\n"));
scsi_devise_transport(periph->path);