Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/adm5120/dev Fix admsw_mediachange(). Not tested.



details:   https://anonhg.NetBSD.org/src/rev/1948ba4f8b81
branches:  trunk
changeset: 967276:1948ba4f8b81
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Dec 04 05:19:10 2019 +0000

description:
Fix admsw_mediachange(). Not tested.

 ifmedia_change() is used to change the device's media setting from
user-selected media. The user-selected media is not
sc->sc_ifmedia[port]->ifm_media but sc->sc_ifmedia[port].ifm_cur->ifm_media.

diffstat:

 sys/arch/mips/adm5120/dev/if_admsw.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (47 lines):

diff -r 4b709588da89 -r 1948ba4f8b81 sys/arch/mips/adm5120/dev/if_admsw.c
--- a/sys/arch/mips/adm5120/dev/if_admsw.c      Wed Dec 04 04:45:42 2019 +0000
+++ b/sys/arch/mips/adm5120/dev/if_admsw.c      Wed Dec 04 05:19:10 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_admsw.c,v 1.24 2019/05/28 07:41:47 msaitoh Exp $ */
+/* $NetBSD: if_admsw.c,v 1.25 2019/12/04 05:19:10 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.24 2019/05/28 07:41:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.25 2019/12/04 05:19:10 msaitoh Exp $");
 
 
 #include <sys/param.h>
@@ -1242,21 +1242,21 @@
 {
        struct admsw_softc *sc = ifp->if_softc;
        int port = (struct ethercom *)ifp - sc->sc_ethercom;    /* XXX */
-       struct ifmedia *ifm = &sc->sc_ifmedia[port];
+       struct ifmedia_entry *ife = sc->sc_ifmedia[port].ifm_cur;
        int old, new, val;
 
-       if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
+       if (IFM_TYPE(ife->ifm_media) != IFM_ETHER)
                return EINVAL;
 
-       if (IFM_SUBTYPE(ifm->ifm_media) == IFM_AUTO) {
+       if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
                val = PHY_CNTL2_AUTONEG | PHY_CNTL2_100M | PHY_CNTL2_FDX;
-       } else if (IFM_SUBTYPE(ifm->ifm_media) == IFM_100_TX) {
-               if ((ifm->ifm_media & IFM_FDX) != 0)
+       } else if (IFM_SUBTYPE(ife->ifm_media) == IFM_100_TX) {
+               if ((ife->ifm_media & IFM_FDX) != 0)
                        val = PHY_CNTL2_100M | PHY_CNTL2_FDX;
                else
                        val = PHY_CNTL2_100M;
-       } else if (IFM_SUBTYPE(ifm->ifm_media) == IFM_10_T) {
-               if ((ifm->ifm_media & IFM_FDX) != 0)
+       } else if (IFM_SUBTYPE(ife->ifm_media) == IFM_10_T) {
+               if ((ife->ifm_media & IFM_FDX) != 0)
                        val = PHY_CNTL2_FDX;
                else
                        val = 0;



Home | Main Index | Thread Index | Old Index