svn commit: r191060 - in head/sys/dev: twa twe

Ed Schouten ed at FreeBSD.org
Tue Apr 14 14:02:45 UTC 2009


Author: ed
Date: Tue Apr 14 14:02:43 2009
New Revision: 191060
URL: http://svn.freebsd.org/changeset/base/191060

Log:
  Use si_drv1 instead of dev2unit() in twe(4) and twa(4)
  
  Reviewed by:	scottl

Modified:
  head/sys/dev/twa/tw_osl_freebsd.c
  head/sys/dev/twe/twe_freebsd.c

Modified: head/sys/dev/twa/tw_osl_freebsd.c
==============================================================================
--- head/sys/dev/twa/tw_osl_freebsd.c	Tue Apr 14 13:43:09 2009	(r191059)
+++ head/sys/dev/twa/tw_osl_freebsd.c	Tue Apr 14 14:02:43 2009	(r191060)
@@ -88,8 +88,7 @@ static devclass_t	twa_devclass;
 static TW_INT32
 twa_open(struct cdev *dev, TW_INT32 flags, TW_INT32 fmt, d_thread_t *proc)
 {
-	TW_INT32		unit = dev2unit(dev);
-	struct twa_softc	*sc = devclass_get_softc(twa_devclass, unit);
+	struct twa_softc	*sc = (struct twa_softc *)(dev->si_drv1);
 
 	tw_osli_dbg_dprintf(5, sc, "entered");
 	sc->state |= TW_OSLI_CTLR_STATE_OPEN;
@@ -114,8 +113,7 @@ twa_open(struct cdev *dev, TW_INT32 flag
 static TW_INT32
 twa_close(struct cdev *dev, TW_INT32 flags, TW_INT32 fmt, d_thread_t *proc)
 {
-	TW_INT32		unit = dev2unit(dev);
-	struct twa_softc	*sc = devclass_get_softc(twa_devclass, unit);
+	struct twa_softc	*sc = (struct twa_softc *)(dev->si_drv1);
 
 	tw_osli_dbg_dprintf(5, sc, "entered");
 	sc->state &= ~TW_OSLI_CTLR_STATE_OPEN;

Modified: head/sys/dev/twe/twe_freebsd.c
==============================================================================
--- head/sys/dev/twe/twe_freebsd.c	Tue Apr 14 13:43:09 2009	(r191059)
+++ head/sys/dev/twe/twe_freebsd.c	Tue Apr 14 14:02:43 2009	(r191060)
@@ -81,8 +81,7 @@ static struct cdevsw twe_cdevsw = {
 static int
 twe_open(struct cdev *dev, int flags, int fmt, d_thread_t *td)
 {
-    int			unit = dev2unit(dev);
-    struct twe_softc	*sc = devclass_get_softc(twe_devclass, unit);
+    struct twe_softc		*sc = (struct twe_softc *)dev->si_drv1;
 
     sc->twe_state |= TWE_STATE_OPEN;
     return(0);
@@ -94,8 +93,7 @@ twe_open(struct cdev *dev, int flags, in
 static int
 twe_close(struct cdev *dev, int flags, int fmt, d_thread_t *td)
 {
-    int			unit = dev2unit(dev);
-    struct twe_softc	*sc = devclass_get_softc(twe_devclass, unit);
+    struct twe_softc		*sc = (struct twe_softc *)dev->si_drv1;
 
     sc->twe_state &= ~TWE_STATE_OPEN;
     return (0);


More information about the svn-src-head mailing list