Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/mii mii_phy_add_media() automatically install power ...



details:   https://anonhg.NetBSD.org/src/rev/44c6c981016a
branches:  trunk
changeset: 997371:44c6c981016a
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Mar 05 02:13:15 2019 +0000

description:
mii_phy_add_media() automatically install power handler, but if_media_add()
doesn't. When mii_phy_add_media() isn't used, call pmf_device_register().

diffstat:

 sys/dev/mii/tlphy.c |  21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diffs (43 lines):

diff -r 0335daee964e -r 44c6c981016a sys/dev/mii/tlphy.c
--- a/sys/dev/mii/tlphy.c       Tue Mar 05 01:35:52 2019 +0000
+++ b/sys/dev/mii/tlphy.c       Tue Mar 05 02:13:15 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tlphy.c,v 1.64 2019/02/24 17:22:21 christos Exp $      */
+/*     $NetBSD: tlphy.c,v 1.65 2019/03/05 02:13:15 msaitoh Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tlphy.c,v 1.64 2019/02/24 17:22:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tlphy.c,v 1.65 2019/03/05 02:13:15 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -180,12 +180,19 @@
        if (sc->mii_capabilities & BMSR_MEDIAMASK) {
                aprint_normal("%s", sep);
                mii_phy_add_media(sc);
-       } else if ((tsc->sc_tlphycap &
+       } else {
+               if ((tsc->sc_tlphycap &
                    (TLPHY_MEDIA_10_2 | TLPHY_MEDIA_10_5)) == 0)
-               aprint_error("no media present");
-       else if (!pmf_device_register(self, NULL, mii_phy_resume)) {
-               aprint_normal("\n");
-               aprint_error_dev(self, "couldn't establish power handler");
+                       aprint_error("no media present");
+               /*
+                * mii_phy_add_media() automatically install power handler,
+                * but if_media_add() doesn't. Do it now.
+                */
+               if (!pmf_device_register(self, NULL, mii_phy_resume)) {
+                       aprint_normal("\n");
+                       aprint_error_dev(self,
+                           "couldn't establish power handler");
+               }
        }
        aprint_normal("\n");
 #undef ADD



Home | Main Index | Thread Index | Old Index