Author: ed
Date: Tue Apr 14 11:57:26 2009
New Revision: 191056
URL: http://svn.freebsd.org/changeset/base/191056

Log:
  Let tdfx(4) use si_drv1 instead of using dev2unit().

Modified:
  head/sys/dev/tdfx/tdfx_pci.c

Modified: head/sys/dev/tdfx/tdfx_pci.c
==============================================================================
--- head/sys/dev/tdfx/tdfx_pci.c        Tue Apr 14 11:39:56 2009        
(r191055)
+++ head/sys/dev/tdfx/tdfx_pci.c        Tue Apr 14 11:57:26 2009        
(r191056)
@@ -255,6 +255,7 @@ tdfx_attach(device_t dev) { 
         */
        tdfx_info->devt = make_dev(&tdfx_cdev, device_get_unit(dev),
                UID_ROOT, GID_WHEEL, 0600, "3dfx%x", device_get_unit(dev));
+       tdfx_info->devt->si_drv1 = tdfx_info;
        
        return 0;
 }
@@ -393,8 +394,7 @@ tdfx_open(struct cdev *dev, int flags, i
         *      The open cdev method handles open(2) calls to /dev/3dfx[n] 
         * We can pretty much allow any opening of the device.
         */
-       struct tdfx_softc *tdfx_info = devclass_get_softc(tdfx_devclass, 
-                       UNIT(dev2unit(dev)));
+       struct tdfx_softc *tdfx_info = dev->si_drv1;
        if(tdfx_info->busy != 0) return EBUSY;
 #ifdef DEBUG
        printf("3dfx: Opened by #%d\n", td->td_proc->p_pid);
@@ -411,8 +411,7 @@ tdfx_close(struct cdev *dev, int fflag, 
         *      The close cdev method handles close(2) calls to /dev/3dfx[n] 
         * We'll always want to close the device when it's called.
         */
-       struct tdfx_softc *tdfx_info = devclass_get_softc(tdfx_devclass, 
-               UNIT(dev2unit(dev)));
+       struct tdfx_softc *tdfx_info = dev->si_drv1;
        if(tdfx_info->busy == 0) return EBADF;
        tdfx_info->busy = 0;
 #ifdef DEBUG
@@ -434,8 +433,7 @@ tdfx_mmap(struct cdev *dev, vm_offset_t 
        /* struct tdfx_softc* tdfx_info; */
        
        /* Get the configuration for our card XXX*/
-       /*tdfx_info = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass,
-                       UNIT(dev2unit(dev)));*/
+       /*tdfx_info = dev->si_drv1; */
        /************************/
 
        struct tdfx_softc* tdfx_info[2];
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to