[PATCH rtems-libbsd 2/5] mv643xx_nexus.c: removed unlocked mve_init(), mve_start()

Vijay Kumar Banerjee vijay at rtems.org
Tue Mar 30 01:30:12 UTC 2021


From: till straumann <till.straumann at alumni.tu-berlin.de>

The recursive lock takes care of this...

Update #4345
---
 rtemsbsd/sys/dev/mve/mv643xx_nexus.c | 37 +++++++---------------------
 1 file changed, 9 insertions(+), 28 deletions(-)

diff --git a/rtemsbsd/sys/dev/mve/mv643xx_nexus.c b/rtemsbsd/sys/dev/mve/mv643xx_nexus.c
index 804c3e7f..3b443583 100644
--- a/rtemsbsd/sys/dev/mve/mv643xx_nexus.c
+++ b/rtemsbsd/sys/dev/mve/mv643xx_nexus.c
@@ -23,13 +23,13 @@
  * ----------
  * This software (mv643xx ethernet driver for RTEMS) was
  *     created by Till Straumann <strauman at slac.stanford.edu>, 2005-2007,
- * 	   Stanford Linear Accelerator Center, Stanford University.
+ *     Stanford Linear Accelerator Center, Stanford University.
  *
  * Acknowledgement of sponsorship
  * ------------------------------
  * The 'mv643xx ethernet driver for RTEMS' was produced by
  *     the Stanford Linear Accelerator Center, Stanford University,
- * 	   under Contract DE-AC03-76SFO0515 with the Department of Energy.
+ *     under Contract DE-AC03-76SFO0515 with the Department of Energy.
  *
  * Government disclaimer of liability
  * ----------------------------------
@@ -615,9 +615,10 @@ int msk           = IFM_AVALID | IFM_ACTIVE;
 }
 
 static void
-mve_init_unlocked(struct mve_enet_softc *sc)
+mve_init(void *arg)
 {
-struct ifnet		  *ifp                 = sc->ifp;
+struct mve_enet_softc  *sc                 = (struct mve_enet_softc*)arg;
+struct ifnet           *ifp                = sc->ifp;
 int                    lowLevelMediaStatus = 0;
 int                    promisc;
 
@@ -625,7 +626,6 @@ int                    promisc;
 	printk(DRVNAME": mve_init (entering)\n");
 #endif
 
-
 	if ( sc->mii_softc ) {
 		mii_pollstat( sc->mii_softc );
 		lowLevelMediaStatus = xlateMediaFlags( sc->mii_softc );
@@ -649,33 +649,16 @@ int                    promisc;
 	if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0);
 }
 
-static void
-mve_init(void *arg)
-{
-struct mve_enet_softc *sc = (struct mve_enet_softc*)arg;
-	mve_lock( sc, "mve_init" );
-		mve_init_unlocked( sc );
-	mve_unlock( sc, "mve_init" );
-}
-
-static void
-mve_start_unlocked(struct ifnet *ifp)
-{
-struct mve_enet_softc *sc  = (struct mve_enet_softc*)ifp->if_softc;
-	if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
-	mve_send_event( sc, TX_EVENT );
-}
-
 static void
 mve_start(struct ifnet *ifp)
 {
 struct mve_enet_softc *sc  = (struct mve_enet_softc*)ifp->if_softc;
 	mve_lock( sc, "mve_start" );
-		mve_start_unlocked( ifp );
+		if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
 	mve_unlock( sc, "mve_start" );
+	mve_send_event( sc, TX_EVENT );
 }
 
-
 static int
 mve_ioctl(struct ifnet *ifp, ioctl_command_t cmd, caddr_t data)
 {
@@ -696,7 +679,7 @@ int                      f, df;
 			df = if_getdrvflags( ifp );
 			if ( (f & IFF_UP) ) {
 				if ( ! ( df & IFF_DRV_RUNNING ) ) {
-					mve_init_unlocked(sc);
+					mve_init( (void*)sc );
 				} else {
 					if ( (f & IFF_PROMISC) != (sc->oif_flags & IFF_PROMISC) ) {
 						mve_set_filters(ifp);
@@ -761,7 +744,7 @@ int              lowLevelMediaStatus;
 	if ( (lowLevelMediaStatus & MV643XX_MEDIA_LINK) ) {
 		BSP_mve_update_serial_port( sc->mp, lowLevelMediaStatus );
 		if_setdrvflagbits( sc->ifp, 0, IFF_DRV_OACTIVE );
-        mve_start_unlocked( sc->ifp );
+        mve_start( sc->ifp );
 	} else {
 		if_setdrvflagbits( sc->ifp, IFF_DRV_OACTIVE, 0 );
 	}
@@ -808,7 +791,6 @@ struct mii_data        *mii = sc->mii_softc;
 		ifmr->ifm_active = mii->mii_media_active;
 		ifmr->ifm_status = mii->mii_media_status;
 	}
-
 }
 
 static int
@@ -865,7 +847,6 @@ int                     tx_q_size    = MV643XX_TX_QUEUE_SIZE;
 
 	sc->mp = mp;
 
-
 	BSP_mve_read_eaddr( mp, hwaddr );
 
 	if ( 0 == mii_attach( sc->dev,
-- 
2.26.2



More information about the devel mailing list