PERFORCE change 96608 for review

Warner Losh imp at FreeBSD.org
Wed May 3 19:37:52 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=96608

Change 96608 by imp at 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;
 }
 
 


More information about the p4-projects mailing list