Author: scottl
Date: Tue Feb  6 06:42:25 2018
New Revision: 328918
URL: https://svnweb.freebsd.org/changeset/base/328918

Log:
  Return a C errno for cam_periph_acquire().
  
  There's no compelling reason to return a cam_status type for this
  function and doing so only creates confusion with normal C
  coding practices. It's technically an API change, but the periph API
  isn't widely used. No efffective change to operation.
  
  Reviewed by:  imp, mav, ken
  Sponsored by: Netflix
  Differential Revision:        D14063

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/ata/ata_pmp.c
  head/sys/cam/ata/ata_xpt.c
  head/sys/cam/cam_periph.c
  head/sys/cam/cam_periph.h
  head/sys/cam/ctl/scsi_ctl.c
  head/sys/cam/mmc/mmc_da.c
  head/sys/cam/mmc/mmc_xpt.c
  head/sys/cam/nvme/nvme_da.c
  head/sys/cam/nvme/nvme_xpt.c
  head/sys/cam/scsi/scsi_cd.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/cam/scsi/scsi_enc.c
  head/sys/cam/scsi/scsi_pass.c
  head/sys/cam/scsi/scsi_pt.c
  head/sys/cam/scsi/scsi_sa.c
  head/sys/cam/scsi/scsi_sg.c
  head/sys/cam/scsi/scsi_xpt.c

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c   Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/ata/ata_da.c   Tue Feb  6 06:42:25 2018        (r328918)
@@ -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);
 
        /*

Modified: head/sys/cam/ata/ata_pmp.c
==============================================================================
--- head/sys/cam/ata/ata_pmp.c  Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/ata/ata_pmp.c  Tue Feb  6 06:42:25 2018        (r328918)
@@ -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;

Modified: head/sys/cam/ata/ata_xpt.c
==============================================================================
--- head/sys/cam/ata/ata_xpt.c  Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/ata/ata_xpt.c  Tue Feb  6 06:42:25 2018        (r328918)
@@ -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);

Modified: head/sys/cam/cam_periph.c
==============================================================================
--- head/sys/cam/cam_periph.c   Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/cam_periph.c   Tue Feb  6 06:42:25 2018        (r328918)
@@ -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 priorit
         * 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);

Modified: head/sys/cam/cam_periph.h
==============================================================================
--- head/sys/cam/cam_periph.h   Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/cam_periph.h   Tue Feb  6 06:42:25 2018        (r328918)
@@ -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);

Modified: head/sys/cam/ctl/scsi_ctl.c
==============================================================================
--- head/sys/cam/ctl/scsi_ctl.c Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/ctl/scsi_ctl.c Tue Feb  6 06:42:25 2018        (r328918)
@@ -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) {

Modified: head/sys/cam/mmc/mmc_da.c
==============================================================================
--- head/sys/cam/mmc/mmc_da.c   Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/mmc/mmc_da.c   Tue Feb  6 06:42:25 2018        (r328918)
@@ -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);

Modified: head/sys/cam/mmc/mmc_xpt.c
==============================================================================
--- head/sys/cam/mmc/mmc_xpt.c  Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/mmc/mmc_xpt.c  Tue Feb  6 06:42:25 2018        (r328918)
@@ -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"));
 

Modified: head/sys/cam/nvme/nvme_da.c
==============================================================================
--- head/sys/cam/nvme/nvme_da.c Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/nvme/nvme_da.c Tue Feb  6 06:42:25 2018        (r328918)
@@ -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);
 
        /*

Modified: head/sys/cam/nvme/nvme_xpt.c
==============================================================================
--- head/sys/cam/nvme/nvme_xpt.c        Tue Feb  6 04:28:21 2018        
(r328917)
+++ head/sys/cam/nvme/nvme_xpt.c        Tue Feb  6 06:42:25 2018        
(r328918)
@@ -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 *a
        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);

Modified: head/sys/cam/scsi/scsi_cd.c
==============================================================================
--- head/sys/cam/scsi/scsi_cd.c Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/scsi/scsi_cd.c Tue Feb  6 06:42:25 2018        (r328918)
@@ -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);
                }

Modified: head/sys/cam/scsi/scsi_da.c
==============================================================================
--- head/sys/cam/scsi/scsi_da.c Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/scsi/scsi_da.c Tue Feb  6 06:42:25 2018        (r328918)
@@ -1565,7 +1565,7 @@ da_periph_acquire(struct cam_periph *periph, da_ref_to
        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);
                }

Modified: head/sys/cam/scsi/scsi_enc.c
==============================================================================
--- head/sys/cam/scsi/scsi_enc.c        Tue Feb  6 04:28:21 2018        
(r328917)
+++ head/sys/cam/scsi/scsi_enc.c        Tue Feb  6 06:42:25 2018        
(r328918)
@@ -267,7 +267,7 @@ enc_open(struct cdev *dev, int flags, int fmt, struct 
        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);

Modified: head/sys/cam/scsi/scsi_pass.c
==============================================================================
--- head/sys/cam/scsi/scsi_pass.c       Tue Feb  6 04:28:21 2018        
(r328917)
+++ head/sys/cam/scsi/scsi_pass.c       Tue Feb  6 06:42:25 2018        
(r328918)
@@ -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 
        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);

Modified: head/sys/cam/scsi/scsi_pt.c
==============================================================================
--- head/sys/cam/scsi/scsi_pt.c Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/scsi/scsi_pt.c Tue Feb  6 06:42:25 2018        (r328918)
@@ -142,7 +142,7 @@ ptopen(struct cdev *dev, int flags, int fmt, struct th
        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;

Modified: head/sys/cam/scsi/scsi_sa.c
==============================================================================
--- head/sys/cam/scsi/scsi_sa.c Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/scsi/scsi_sa.c Tue Feb  6 06:42:25 2018        (r328918)
@@ -657,7 +657,7 @@ saopen(struct cdev *dev, int flags, int fmt, struct th
        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);

Modified: head/sys/cam/scsi/scsi_sg.c
==============================================================================
--- head/sys/cam/scsi/scsi_sg.c Tue Feb  6 04:28:21 2018        (r328917)
+++ head/sys/cam/scsi/scsi_sg.c Tue Feb  6 06:42:25 2018        (r328918)
@@ -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 th
        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);
 
        /*

Modified: head/sys/cam/scsi/scsi_xpt.c
==============================================================================
--- head/sys/cam/scsi/scsi_xpt.c        Tue Feb  6 04:28:21 2018        
(r328917)
+++ head/sys/cam/scsi/scsi_xpt.c        Tue Feb  6 06:42:25 2018        
(r328918)
@@ -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);
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to