summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi/scsi_pass.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cam/scsi/scsi_pass.c')
-rw-r--r--sys/cam/scsi/scsi_pass.c36
1 files changed, 4 insertions, 32 deletions
diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c
index 5617ef0..17084e6 100644
--- a/sys/cam/scsi/scsi_pass.c
+++ b/sys/cam/scsi/scsi_pass.c
@@ -118,27 +118,12 @@ static void
passinit(void)
{
cam_status status;
- struct cam_path *path;
/*
* Install a global async callback. This callback will
* receive async callbacks like "new device found".
*/
- status = xpt_create_path(&path, /*periph*/NULL, CAM_XPT_PATH_ID,
- CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
-
- if (status == CAM_REQ_CMP) {
- struct ccb_setasync csa;
-
- xpt_setup_ccb(&csa.ccb_h, path, /*priority*/5);
- csa.ccb_h.func_code = XPT_SASYNC_CB;
- csa.event_enable = AC_FOUND_DEVICE;
- csa.callback = passasync;
- csa.callback_arg = NULL;
- xpt_action((union ccb *)&csa);
- status = csa.ccb_h.status;
- xpt_free_path(path);
- }
+ status = xpt_register_async(AC_FOUND_DEVICE, passasync, NULL, NULL);
if (status != CAM_REQ_CMP) {
printf("pass: Failed to attach master async callback "
@@ -151,20 +136,13 @@ static void
passoninvalidate(struct cam_periph *periph)
{
struct pass_softc *softc;
- struct ccb_setasync csa;
softc = (struct pass_softc *)periph->softc;
/*
* De-register any async callbacks.
*/
- xpt_setup_ccb(&csa.ccb_h, periph->path,
- /* priority */ 5);
- csa.ccb_h.func_code = XPT_SASYNC_CB;
- csa.event_enable = 0;
- csa.callback = passasync;
- csa.callback_arg = periph;
- xpt_action((union ccb *)&csa);
+ xpt_register_async(0, passasync, periph, periph->path);
softc->flags |= PASS_FLAG_INVALID;
@@ -250,7 +228,6 @@ static cam_status
passregister(struct cam_periph *periph, void *arg)
{
struct pass_softc *softc;
- struct ccb_setasync csa;
struct ccb_getdev *cgd;
int no_tags;
@@ -285,6 +262,7 @@ passregister(struct cam_periph *periph, void *arg)
* know what the blocksize of this device is, if
* it even has a blocksize.
*/
+ mtx_unlock(periph->sim->mtx);
no_tags = (cgd->inq_data.flags & SID_CmdQue) == 0;
softc->device_stats = devstat_new_entry("pass",
unit2minor(periph->unit_number), 0,
@@ -296,7 +274,6 @@ passregister(struct cam_periph *periph, void *arg)
DEVSTAT_PRIORITY_PASS);
/* Register the device */
- mtx_unlock(periph->sim->mtx);
softc->dev = make_dev(&pass_cdevsw, unit2minor(periph->unit_number),
UID_ROOT, GID_OPERATOR, 0600, "%s%d",
periph->periph_name, periph->unit_number);
@@ -307,12 +284,7 @@ passregister(struct cam_periph *periph, void *arg)
* Add an async callback so that we get
* notified if this device goes away.
*/
- xpt_setup_ccb(&csa.ccb_h, periph->path, /* priority */ 5);
- csa.ccb_h.func_code = XPT_SASYNC_CB;
- csa.event_enable = AC_LOST_DEVICE;
- csa.callback = passasync;
- csa.callback_arg = periph;
- xpt_action((union ccb *)&csa);
+ xpt_register_async(AC_LOST_DEVICE, passasync, periph, periph->path);
if (bootverbose)
xpt_announce_periph(periph, NULL);
OpenPOWER on IntegriCloud