Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 May 2006 19:37:51 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 96608 for review
Message-ID:  <200605031937.k43Jbpc7094229@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96608

Change 96608 by imp@imp_hammer on 2006/05/03 19:37:50

	Save about 40 bytes by not being stupid.  Note: The register that's
	being read is specific to some board that isn't this board, so some
	care needs to be taken in fixing this right...

Affected files ...

.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#11 edit

Differences ...

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#11 (text+ko) ====

@@ -367,27 +367,17 @@
 MII_GetLinkSpeed(AT91PS_EMAC pEmac)
 {
 	unsigned short stat2; 
-	unsigned update = 0;
+	unsigned update;
   
 	stat2 = AT91F_MII_ReadPhy(pEmac, MII_STS2_REG);
-
-	if (!(stat2 & 0x400)) {
+	if (!(stat2 & 0x400))
 		return ;
-
-	} else if (stat2 & 0x4000) {
-
+	update = pEmac->EMAC_CFG & ~(AT91C_EMAC_SPD | AT91C_EMAC_FD);
+	if (stat2 & 0x4000)
 		update |= AT91C_EMAC_SPD;
-
-		if (stat2 & 0x200) {
-			update |= AT91C_EMAC_FD;
-		}
-
-	} else if (stat2 & 0x200) {
+	if (stat2 & 0x200)
 		update |= AT91C_EMAC_FD;
-	}
-
-	pEmac->EMAC_CFG =
-		(pEmac->EMAC_CFG & ~(AT91C_EMAC_SPD | AT91C_EMAC_FD)) | update;
+	pEmac->EMAC_CFG = update;
 }
 
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605031937.k43Jbpc7094229>