Author: mav
Date: Thu Apr 14 09:11:50 2011
New Revision: 220618
URL: http://svn.freebsd.org/changeset/base/220618

Log:
  Fix typo in write_cache tunable name and move TUNABLE_INT_FETCH() out of
  the SIM lock to fix WITNESS warning.
  
  Reported by:  jh

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c   Thu Apr 14 08:53:04 2011        (r220617)
+++ head/sys/cam/ata/ata_da.c   Thu Apr 14 09:11:50 2011        (r220618)
@@ -773,10 +773,6 @@ adaregister(struct cam_periph *periph, v
                softc->quirks = ((struct ada_quirk_entry *)match)->quirks;
        else
                softc->quirks = ADA_Q_NONE;
-       softc->write_cache = -1;
-       snprintf(announce_buf, sizeof(announce_buf),
-           "kern.cam.ada.%d.writa_cache", periph->unit_number);
-       TUNABLE_INT_FETCH(announce_buf, &softc->write_cache);
 
        bzero(&cpi, sizeof(cpi));
        xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE);
@@ -788,7 +784,12 @@ adaregister(struct cam_periph *periph, v
        /*
         * Register this media as a disk
         */
+       (void)cam_periph_hold(periph, PRIBIO);
        mtx_unlock(periph->sim->mtx);
+       softc->write_cache = -1;
+       snprintf(announce_buf, sizeof(announce_buf),
+           "kern.cam.ada.%d.write_cache", periph->unit_number);
+       TUNABLE_INT_FETCH(announce_buf, &softc->write_cache);
        adagetparams(periph, cgd);
        softc->disk = disk_alloc();
        softc->disk->d_open = adaopen;
@@ -841,6 +842,7 @@ adaregister(struct cam_periph *periph, v
 
        disk_create(softc->disk, DISK_VERSION);
        mtx_lock(periph->sim->mtx);
+       cam_periph_unhold(periph);
 
        dp = &softc->params;
        snprintf(announce_buf, sizeof(announce_buf),
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to