Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/mii use media_table instead of replicating code
details: https://anonhg.NetBSD.org/src/rev/132e88ac41e8
branches: trunk
changeset: 781826:132e88ac41e8
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Wed Oct 03 07:08:58 2012 +0000
description:
use media_table instead of replicating code
diffstat:
sys/dev/mii/mii_physubr.c | 30 ++++++++----------------------
1 files changed, 8 insertions(+), 22 deletions(-)
diffs (51 lines):
diff -r dc138c61da7c -r 132e88ac41e8 sys/dev/mii/mii_physubr.c
--- a/sys/dev/mii/mii_physubr.c Wed Oct 03 07:07:04 2012 +0000
+++ b/sys/dev/mii/mii_physubr.c Wed Oct 03 07:08:58 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mii_physubr.c,v 1.74 2012/07/22 14:33:00 matt Exp $ */
+/* $NetBSD: mii_physubr.c,v 1.75 2012/10/03 07:08:58 mlelstv Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.74 2012/07/22 14:33:00 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.75 2012/10/03 07:08:58 mlelstv Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -680,26 +680,12 @@
{
int rv;
- switch (media & (IFM_TMASK|IFM_NMASK|IFM_FDX)) {
- case IFM_ETHER|IFM_10_T:
- rv = ANAR_10|ANAR_CSMA;
- break;
- case IFM_ETHER|IFM_10_T|IFM_FDX:
- rv = ANAR_10_FD|ANAR_CSMA;
- break;
- case IFM_ETHER|IFM_100_TX:
- rv = ANAR_TX|ANAR_CSMA;
- break;
- case IFM_ETHER|IFM_100_TX|IFM_FDX:
- rv = ANAR_TX_FD|ANAR_CSMA;
- break;
- case IFM_ETHER|IFM_100_T4:
- rv = ANAR_T4|ANAR_CSMA;
- break;
- default:
- rv = 0;
- break;
- }
+#ifdef DIAGNOSTIC
+ if (/* media < 0 || */ media >= MII_NMEDIA)
+ panic("mii_anar");
+#endif
+
+ rv = mii_media_table[media].mm_anar;
return rv;
}
Home |
Main Index |
Thread Index |
Old Index