From owner-p4-projects@FreeBSD.ORG Tue Mar 27 17:12:29 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 22F7816A403; Tue, 27 Mar 2007 17:12:29 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D5F0816A401 for ; Tue, 27 Mar 2007 17:12:28 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id C66A313C44B for ; Tue, 27 Mar 2007 17:12:28 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l2RHCSLm082802 for ; Tue, 27 Mar 2007 17:12:28 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l2RHCSOE082780 for perforce@freebsd.org; Tue, 27 Mar 2007 17:12:28 GMT (envelope-from scottl@freebsd.org) Date: Tue, 27 Mar 2007 17:12:28 GMT Message-Id: <200703271712.l2RHCSOE082780@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Cc: Subject: PERFORCE change 116676 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Mar 2007 17:12:29 -0000 http://perforce.freebsd.org/chv.cgi?CH=116676 Change 116676 by scottl@scottl-x64 on 2007/03/27 17:11:47 Lock the scsi_ch driver, remove spl markers. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_ch.c#8 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_ch.c#8 (text+ko) ==== @@ -173,8 +173,6 @@ int sc_settledelay; /* delay for settle */ }; -#define CHUNIT(x) (minor((x))) - static d_open_t chopen; static d_close_t chclose; static d_ioctl_t chioctl; @@ -213,7 +211,7 @@ static struct cdevsw ch_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, + .d_flags = 0, .d_open = chopen, .d_close = chclose, .d_ioctl = chioctl, @@ -407,23 +405,24 @@ int error; periph = (struct cam_periph *)dev->si_drv1; - if (periph == NULL) - return(ENXIO); + if (cam_periph_acquire(periph) != CAM_REQ_CMP) + return (ENXIO); softc = (struct ch_softc *)periph->softc; + cam_periph_lock(periph); + if (softc->flags & CH_FLAG_INVALID) { + cam_periph_unlock(periph); + cam_periph_release(periph); return(ENXIO); } - if ((softc->flags & CH_FLAG_OPEN) == 0) { - if (cam_periph_acquire(periph) != CAM_REQ_CMP) - return(ENXIO); + if ((softc->flags & CH_FLAG_OPEN) == 0) softc->flags |= CH_FLAG_OPEN; - } + else + cam_periph_release(periph); - cam_periph_lock(periph); - /* * Load information about this changer device into the softc. */ @@ -468,24 +467,20 @@ chstart(struct cam_periph *periph, union ccb *start_ccb) { struct ch_softc *softc; - int s; softc = (struct ch_softc *)periph->softc; switch (softc->state) { case CH_STATE_NORMAL: { - s = splbio(); if (periph->immediate_priority <= periph->pinfo.priority){ start_ccb->ccb_h.ccb_state = CH_CCB_WAITING; SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, periph_links.sle); periph->immediate_priority = CAM_PRIORITY_NONE; - splx(s); wakeup(&periph->ccb_list); - } else - splx(s); + } break; } case CH_STATE_PROBE: @@ -745,8 +740,10 @@ { int new_picker = *(int *)addr; - if (new_picker > (softc->sc_counts[CHET_MT] - 1)) - return (EINVAL); + if (new_picker > (softc->sc_counts[CHET_MT] - 1)) { + error = EINVAL; + break; + } softc->sc_picker = softc->sc_firsts[CHET_MT] + new_picker; break; }