Module Name: src Committed By: msaitoh Date: Mon Mar 25 07:34:13 UTC 2019
Modified Files: src/sys/dev/mii: amhphy.c dmphy.c exphy.c glxtphy.c gphyter.c igphy.c ihphy.c ikphy.c makphy.c micphy.c mii_physubr.c mii_verbose.c mvphy.c Log Message: KNF. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/dev/mii/amhphy.c cvs rdiff -u -r1.41 -r1.42 src/sys/dev/mii/dmphy.c cvs rdiff -u -r1.55 -r1.56 src/sys/dev/mii/exphy.c cvs rdiff -u -r1.28 -r1.29 src/sys/dev/mii/glxtphy.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/mii/gphyter.c cvs rdiff -u -r1.30 -r1.31 src/sys/dev/mii/igphy.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/mii/ihphy.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/mii/ikphy.c cvs rdiff -u -r1.58 -r1.59 src/sys/dev/mii/makphy.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/mii/micphy.c cvs rdiff -u -r1.84 -r1.85 src/sys/dev/mii/mii_physubr.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/mii/mii_verbose.c cvs rdiff -u -r1.12 -r1.13 src/sys/dev/mii/mvphy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/mii/amhphy.c diff -u src/sys/dev/mii/amhphy.c:1.22 src/sys/dev/mii/amhphy.c:1.23 --- src/sys/dev/mii/amhphy.c:1.22 Sun Feb 24 17:22:21 2019 +++ src/sys/dev/mii/amhphy.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: amhphy.c,v 1.22 2019/02/24 17:22:21 christos Exp $ */ +/* $NetBSD: amhphy.c,v 1.23 2019/03/25 07:34:13 msaitoh Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.22 2019/02/24 17:22:21 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.23 2019/03/25 07:34:13 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -82,9 +82,9 @@ amhphymatch(device_t parent, cfdata_t ma struct mii_attach_args *ma = aux; if (mii_phy_match(ma, amhphys) != NULL) - return (10); + return 10; - return (0); + return 0; } static void @@ -127,11 +127,9 @@ amhphy_service(struct mii_softc *sc, str switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ + /* If we're not polling our PHY instance, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; break; case MII_MEDIACHG: @@ -142,12 +140,10 @@ amhphy_service(struct mii_softc *sc, str if (IFM_INST(ife->ifm_media) != sc->mii_inst) { PHY_READ(sc, MII_BMCR, ®); PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); + return 0; } - /* - * If the interface is not up, don't do anything. - */ + /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; @@ -155,19 +151,17 @@ amhphy_service(struct mii_softc *sc, str break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ + /* If we're not currently selected, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; if (mii_phy_tick(sc) == EJUSTRETURN) - return (0); + return 0; break; case MII_DOWN: mii_phy_down(sc); - return (0); + return 0; } /* Update the media status. */ @@ -175,7 +169,7 @@ amhphy_service(struct mii_softc *sc, str /* Callback if something changed. */ mii_phy_update(sc, cmd); - return (0); + return 0; } static void @@ -218,9 +212,8 @@ amhphy_status(struct mii_softc *sc) if (ssr & SSR_S) { /* * This should't really ever happen, since it's - * a 10BASE-T only PHY. But the bit exists, - * according to the documentation, so we pay - * attention to it. + * a 10BASE-T only PHY. But the bit exists, according + * to the documentation, so we pay attention to it. */ mii->mii_media_active |= IFM_100_TX; } else Index: src/sys/dev/mii/dmphy.c diff -u src/sys/dev/mii/dmphy.c:1.41 src/sys/dev/mii/dmphy.c:1.42 --- src/sys/dev/mii/dmphy.c:1.41 Mon Mar 18 02:52:23 2019 +++ src/sys/dev/mii/dmphy.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: dmphy.c,v 1.41 2019/03/18 02:52:23 msaitoh Exp $ */ +/* $NetBSD: dmphy.c,v 1.42 2019/03/25 07:34:13 msaitoh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dmphy.c,v 1.41 2019/03/18 02:52:23 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dmphy.c,v 1.42 2019/03/25 07:34:13 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -108,9 +108,9 @@ dmphymatch(device_t parent, cfdata_t mat struct mii_attach_args *ma = aux; if (mii_phy_match(ma, dmphys) != NULL) - return (10); + return 10; - return (0); + return 0; } static void @@ -153,11 +153,9 @@ dmphy_service(struct mii_softc *sc, stru switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ + /* If we're not polling our PHY instance, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; break; case MII_MEDIACHG: @@ -168,12 +166,10 @@ dmphy_service(struct mii_softc *sc, stru if (IFM_INST(ife->ifm_media) != sc->mii_inst) { PHY_READ(sc, MII_BMCR, ®); PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); + return 0; } - /* - * If the interface is not up, don't do anything. - */ + /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; @@ -181,19 +177,17 @@ dmphy_service(struct mii_softc *sc, stru break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ + /* If we're not currently selected, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; if (mii_phy_tick(sc) == EJUSTRETURN) - return (0); + return 0; break; case MII_DOWN: mii_phy_down(sc); - return (0); + return 0; } /* Update the media status. */ @@ -201,7 +195,7 @@ dmphy_service(struct mii_softc *sc, stru /* Callback if something changed. */ mii_phy_update(sc, cmd); - return (0); + return 0; } static void Index: src/sys/dev/mii/exphy.c diff -u src/sys/dev/mii/exphy.c:1.55 src/sys/dev/mii/exphy.c:1.56 --- src/sys/dev/mii/exphy.c:1.55 Tue Jan 22 03:42:27 2019 +++ src/sys/dev/mii/exphy.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: exphy.c,v 1.55 2019/01/22 03:42:27 msaitoh Exp $ */ +/* $NetBSD: exphy.c,v 1.56 2019/03/25 07:34:13 msaitoh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: exphy.c,v 1.55 2019/01/22 03:42:27 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exphy.c,v 1.56 2019/03/25 07:34:13 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -97,15 +97,15 @@ exphymatch(device_t parent, cfdata_t mat */ if (MII_OUI(ma->mii_id1, ma->mii_id2) != 0 && MII_MODEL(ma->mii_id2) != 0) - return (0); + return 0; /* * Make sure the parent is an `ex'. */ if (!device_is_a(parent, "ex")) - return (0); + return 0; - return (10); + return 10; } static void @@ -155,9 +155,7 @@ exphy_service(struct mii_softc *sc, stru { struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - /* - * We can't isolate the 3Com PHY, so it has to be the only one! - */ + /* We can't isolate the 3Com PHY, so it has to be the only one! */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) panic("exphy_service: can't isolate 3Com PHY"); @@ -166,9 +164,7 @@ exphy_service(struct mii_softc *sc, stru break; case MII_MEDIACHG: - /* - * If the interface is not up, don't do anything. - */ + /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; @@ -176,19 +172,17 @@ exphy_service(struct mii_softc *sc, stru break; case MII_TICK: - /* - * Only used for autonegotiation. - */ + /* Only used for autonegotiation. */ if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) break; if (mii_phy_tick(sc) == EJUSTRETURN) - return (0); + return 0; break; case MII_DOWN: mii_phy_down(sc); - return (0); + return 0; } /* Update the media status. */ @@ -196,7 +190,7 @@ exphy_service(struct mii_softc *sc, stru /* Callback if something changed. */ mii_phy_update(sc, cmd); - return (0); + return 0; } static void @@ -209,5 +203,5 @@ exphy_reset(struct mii_softc *sc) * XXX 3Com PHY doesn't set the BMCR properly after * XXX reset, which breaks autonegotiation. */ - PHY_WRITE(sc, MII_BMCR, BMCR_S100|BMCR_AUTOEN|BMCR_FDX); + PHY_WRITE(sc, MII_BMCR, BMCR_S100 | BMCR_AUTOEN | BMCR_FDX); } Index: src/sys/dev/mii/glxtphy.c diff -u src/sys/dev/mii/glxtphy.c:1.28 src/sys/dev/mii/glxtphy.c:1.29 --- src/sys/dev/mii/glxtphy.c:1.28 Sun Feb 24 17:22:21 2019 +++ src/sys/dev/mii/glxtphy.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: glxtphy.c,v 1.28 2019/02/24 17:22:21 christos Exp $ */ +/* $NetBSD: glxtphy.c,v 1.29 2019/03/25 07:34:13 msaitoh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: glxtphy.c,v 1.28 2019/02/24 17:22:21 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: glxtphy.c,v 1.29 2019/03/25 07:34:13 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -97,15 +97,14 @@ static const struct mii_phydesc glxtphys }; static int -glxtphymatch(device_t parent, cfdata_t match, - void *aux) +glxtphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; if (mii_phy_match(ma, glxtphys) != NULL) - return (10); + return 10; - return (0); + return 0; } static void @@ -152,11 +151,9 @@ glxtphy_service(struct mii_softc *sc, st switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ + /* If we're not polling our PHY instance, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; break; case MII_MEDIACHG: @@ -167,12 +164,10 @@ glxtphy_service(struct mii_softc *sc, st if (IFM_INST(ife->ifm_media) != sc->mii_inst) { PHY_READ(sc, MII_BMCR, ®); PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); + return 0; } - /* - * If the interface is not up, don't do anything. - */ + /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; @@ -180,19 +175,17 @@ glxtphy_service(struct mii_softc *sc, st break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ + /* If we're not currently selected, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; if (mii_phy_tick(sc) == EJUSTRETURN) - return (0); + return 0; break; case MII_DOWN: mii_phy_down(sc); - return (0); + return 0; } /* Update the media status. */ @@ -200,7 +193,7 @@ glxtphy_service(struct mii_softc *sc, st /* Callback if something changed. */ mii_phy_update(sc, cmd); - return (0); + return 0; } static void Index: src/sys/dev/mii/gphyter.c diff -u src/sys/dev/mii/gphyter.c:1.32 src/sys/dev/mii/gphyter.c:1.33 --- src/sys/dev/mii/gphyter.c:1.32 Sun Feb 24 17:22:21 2019 +++ src/sys/dev/mii/gphyter.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: gphyter.c,v 1.32 2019/02/24 17:22:21 christos Exp $ */ +/* $NetBSD: gphyter.c,v 1.33 2019/03/25 07:34:13 msaitoh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gphyter.c,v 1.32 2019/02/24 17:22:21 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gphyter.c,v 1.33 2019/03/25 07:34:13 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -111,9 +111,9 @@ gphytermatch(device_t parent, cfdata_t m struct mii_attach_args *ma = aux; if (mii_phy_match(ma, gphyters) != NULL) - return (10); + return 10; - return (0); + return 0; } static void @@ -145,10 +145,9 @@ gphyterattach(device_t parent, device_t PHY_READ(sc, MII_EXTSR, &sc->mii_extcapabilities); /* - * The Gig PHYTER seems to have the 10baseT BMSR bits - * hard-wired to 0, even though the device supports - * 10baseT. What we do instead is read the post-reset - * ANAR, who's 10baseT-related bits are set by strapping + * The Gig PHYTER seems to have the 10baseT BMSR bits hard-wired to 0, + * even though the device supports 10baseT. What we do instead is read + * the post-reset ANAR, who's 10baseT-related bits are set by strapping * pin 180, and fake the BMSR bits. */ PHY_READ(sc, MII_ANAR, &anar); @@ -181,11 +180,9 @@ gphyter_service(struct mii_softc *sc, st switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ + /* If we're not polling our PHY instance, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; break; case MII_MEDIACHG: @@ -196,12 +193,10 @@ gphyter_service(struct mii_softc *sc, st if (IFM_INST(ife->ifm_media) != sc->mii_inst) { PHY_READ(sc, MII_BMCR, ®); PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); + return 0; } - /* - * If the interface is not up, don't do anything. - */ + /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; @@ -209,19 +204,17 @@ gphyter_service(struct mii_softc *sc, st break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ + /* If we're not currently selected, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; if (mii_phy_tick(sc) == EJUSTRETURN) - return (0); + return 0; break; case MII_DOWN: mii_phy_down(sc); - return (0); + return 0; } /* Update the media status. */ @@ -229,7 +222,7 @@ gphyter_service(struct mii_softc *sc, st /* Callback if something changed. */ mii_phy_update(sc, cmd); - return (0); + return 0; } static void @@ -313,12 +306,12 @@ gphyter_reset(struct mii_softc *sc) PHY_WRITE(sc, MII_BMCR, reg); /* - * It is best to allow a little time for the reset to settle - * in before we start polling the BMCR again. Notably, the - * DP83840A manual states that there should be a 500us delay - * between asserting software reset and attempting MII serial - * operations. Also, a DP83815 can get into a bad state on - * cable removal and reinsertion if we do not delay here. + * It is best to allow a little time for the reset to settle in before + * we start polling the BMCR again. Notably, the DP83840A manual + * states that there should be a 500us delay between asserting software + * reset and attempting MII serial operations. Also, a DP83815 can get + * into a bad state on cable removal and reinsertion if we do not + * delay here. */ delay(500); Index: src/sys/dev/mii/igphy.c diff -u src/sys/dev/mii/igphy.c:1.30 src/sys/dev/mii/igphy.c:1.31 --- src/sys/dev/mii/igphy.c:1.30 Sun Feb 24 17:22:21 2019 +++ src/sys/dev/mii/igphy.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: igphy.c,v 1.30 2019/02/24 17:22:21 christos Exp $ */ +/* $NetBSD: igphy.c,v 1.31 2019/03/25 07:34:13 msaitoh Exp $ */ /* * The Intel copyright applies to the analog register setup, and the @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.30 2019/02/24 17:22:21 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.31 2019/03/25 07:34:13 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_mii.h" @@ -135,7 +135,7 @@ igphyattach(device_t parent, device_t se struct mii_attach_args *ma = aux; struct mii_data *mii = ma->mii_data; const struct mii_phydesc *mpd; - struct igphy_softc *igsc = (struct igphy_softc *) sc; + struct igphy_softc *igsc = (struct igphy_softc *)sc; prop_dictionary_t dict; mpd = mii_phy_match(ma, igphys); @@ -237,7 +237,7 @@ static const dspcode igp3code[] = { static void igphy_load_dspcode(struct mii_softc *sc) { - struct igphy_softc *igsc = (struct igphy_softc *) sc; + struct igphy_softc *igsc = (struct igphy_softc *)sc; const dspcode *code; uint16_t reg; int i; @@ -300,7 +300,7 @@ igphy_load_dspcode_igp3(struct mii_softc static void igphy_reset(struct mii_softc *sc) { - struct igphy_softc *igsc = (struct igphy_softc *) sc; + struct igphy_softc *igsc = (struct igphy_softc *)sc; uint16_t fused, fine, coarse; mii_phy_reset(sc); @@ -357,11 +357,9 @@ igphy_service(struct mii_softc *sc, stru switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ + /* If we're not polling our PHY instance, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; break; case MII_MEDIACHG: @@ -372,12 +370,10 @@ igphy_service(struct mii_softc *sc, stru if (IFM_INST(ife->ifm_media) != sc->mii_inst) { PHY_READ(sc, MII_BMCR, ®); PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); + return 0; } - /* - * If the interface is not up, don't do anything. - */ + /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; @@ -395,21 +391,19 @@ igphy_service(struct mii_softc *sc, stru break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ + /* If we're not currently selected, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; igphy_smartspeed_workaround(sc); if (mii_phy_tick(sc) == EJUSTRETURN) - return (0); + return 0; break; case MII_DOWN: mii_phy_down(sc); - return (0); + return 0; } /* Update the media status. */ @@ -417,7 +411,7 @@ igphy_service(struct mii_softc *sc, stru /* Callback if something changed. */ mii_phy_update(sc, cmd); - return (0); + return 0; } @@ -449,10 +443,7 @@ igphy_status(struct mii_softc *sc) PHY_READ(sc, MII_BMSR, &bmsr); PHY_READ(sc, MII_BMSR, &bmsr); - /* - * XXX can't check if the info is valid, no - * 'negotiation done' bit? - */ + /* XXX can't check if the info is valid, no 'negotiation done' bit? */ if (bmcr & BMCR_AUTOEN) { if ((bmsr & BMSR_ACOMP) == 0) { mii->mii_media_active |= IFM_NONE; @@ -492,7 +483,7 @@ igphy_status(struct mii_softc *sc) static void igphy_smartspeed_workaround(struct mii_softc *sc) { - struct igphy_softc *igsc = (struct igphy_softc *) sc; + struct igphy_softc *igsc = (struct igphy_softc *)sc; uint16_t reg, gtsr, gtcr; /* This workaround is only for 82541 and 82547 */ Index: src/sys/dev/mii/ihphy.c diff -u src/sys/dev/mii/ihphy.c:1.13 src/sys/dev/mii/ihphy.c:1.14 --- src/sys/dev/mii/ihphy.c:1.13 Sun Feb 24 17:22:21 2019 +++ src/sys/dev/mii/ihphy.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ihphy.c,v 1.13 2019/02/24 17:22:21 christos Exp $ */ +/* $NetBSD: ihphy.c,v 1.14 2019/03/25 07:34:13 msaitoh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.13 2019/02/24 17:22:21 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.14 2019/03/25 07:34:13 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -151,9 +151,7 @@ ihphyattach(device_t parent, device_t se mii_phy_add_media(sc); aprint_normal("\n"); - /* - * Link setup (as done by Intel's Linux driver for the 82577). - */ + /* Link setup (as done by Intel's Linux driver for the 82577). */ PHY_READ(sc, IHPHY_MII_CFG, ®); reg |= IHPHY_CFG_TX_CRS; reg |= IHPHY_CFG_DOWN_SHIFT; @@ -168,9 +166,7 @@ ihphy_service(struct mii_softc *sc, stru switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ + /* If we're not polling our PHY instance, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) return 0; break; @@ -186,15 +182,11 @@ ihphy_service(struct mii_softc *sc, stru return 0; } - /* - * If the interface is not up, don't do anything. - */ + /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; - /* - * If media is deselected, disable link (standby). - */ + /* If media is deselected, disable link (standby). */ PHY_READ(sc, IHPHY_MII_ECR, ®); if (IFM_SUBTYPE(ife->ifm_media) == IFM_NONE) reg &= ~IHPHY_ECR_LNK_EN; @@ -202,17 +194,13 @@ ihphy_service(struct mii_softc *sc, stru reg |= IHPHY_ECR_LNK_EN; PHY_WRITE(sc, IHPHY_MII_ECR, reg); - /* - * XXX Adjust MDI/MDIX configuration? Other settings? - */ + /* XXX Adjust MDI/MDIX configuration? Other settings? */ mii_phy_setmedia(sc); break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ + /* If we're not currently selected, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) return 0; Index: src/sys/dev/mii/ikphy.c diff -u src/sys/dev/mii/ikphy.c:1.14 src/sys/dev/mii/ikphy.c:1.15 --- src/sys/dev/mii/ikphy.c:1.14 Sun Feb 24 17:22:21 2019 +++ src/sys/dev/mii/ikphy.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ikphy.c,v 1.14 2019/02/24 17:22:21 christos Exp $ */ +/* $NetBSD: ikphy.c,v 1.15 2019/03/25 07:34:13 msaitoh Exp $ */ /******************************************************************************* Copyright (c) 2001-2005, Intel Corporation @@ -59,7 +59,7 @@ POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ikphy.c,v 1.14 2019/02/24 17:22:21 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ikphy.c,v 1.15 2019/03/25 07:34:13 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -102,9 +102,9 @@ ikphymatch(device_t parent, cfdata_t mat struct mii_attach_args *ma = aux; if (mii_phy_match(ma, ikphys) != NULL) - return (10); + return 10; - return (0); + return 0; } static void @@ -153,11 +153,9 @@ ikphy_service(struct mii_softc *sc, stru switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ + /* If we're not polling our PHY instance, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; break; case MII_MEDIACHG: @@ -168,12 +166,10 @@ ikphy_service(struct mii_softc *sc, stru if (IFM_INST(ife->ifm_media) != sc->mii_inst) { PHY_READ(sc, MII_BMCR, ®); PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); + return 0; } - /* - * If the interface is not up, don't do anything. - */ + /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; @@ -181,19 +177,17 @@ ikphy_service(struct mii_softc *sc, stru break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ + /* If we're not currently selected, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; if (mii_phy_tick(sc) == EJUSTRETURN) - return (0); + return 0; break; case MII_DOWN: mii_phy_down(sc); - return (0); + return 0; } /* Update the media status. */ @@ -201,7 +195,7 @@ ikphy_service(struct mii_softc *sc, stru /* Callback if something changed. */ mii_phy_update(sc, cmd); - return (0); + return 0; } static void @@ -257,7 +251,7 @@ ikphy_setmedia(struct mii_softc *sc) mii_phy_setmedia(sc); if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) { /* - * when not in auto mode, we need to restart nego + * When not in auto mode, we need to restart nego * anyway, or a switch from a fixed mode to another * fixed mode may not be seen by the switch. */ Index: src/sys/dev/mii/makphy.c diff -u src/sys/dev/mii/makphy.c:1.58 src/sys/dev/mii/makphy.c:1.59 --- src/sys/dev/mii/makphy.c:1.58 Mon Mar 25 05:39:51 2019 +++ src/sys/dev/mii/makphy.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: makphy.c,v 1.58 2019/03/25 05:39:51 msaitoh Exp $ */ +/* $NetBSD: makphy.c,v 1.59 2019/03/25 07:34:13 msaitoh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.58 2019/03/25 05:39:51 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.59 2019/03/25 07:34:13 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -145,7 +145,7 @@ makphymatch(device_t parent, cfdata_t ma if (makphy_isi210(parent, ma)) return 10; - + return 0; } @@ -319,9 +319,7 @@ makphy_service(struct mii_softc *sc, str switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ + /* If we're not polling our PHY instance, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) return 0; break; @@ -337,9 +335,7 @@ makphy_service(struct mii_softc *sc, str return 0; } - /* - * If the interface is not up, don't do anything. - */ + /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; @@ -362,9 +358,7 @@ makphy_service(struct mii_softc *sc, str break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ + /* If we're not currently selected, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) return 0; Index: src/sys/dev/mii/micphy.c diff -u src/sys/dev/mii/micphy.c:1.7 src/sys/dev/mii/micphy.c:1.8 --- src/sys/dev/mii/micphy.c:1.7 Sun Feb 24 17:22:21 2019 +++ src/sys/dev/mii/micphy.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: micphy.c,v 1.7 2019/02/24 17:22:21 christos Exp $ */ +/* $NetBSD: micphy.c,v 1.8 2019/03/25 07:34:13 msaitoh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: micphy.c,v 1.7 2019/02/24 17:22:21 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: micphy.c,v 1.8 2019/03/25 07:34:13 msaitoh Exp $"); #include "opt_mii.h" @@ -157,10 +157,11 @@ micphy_reset(struct mii_softc *sc) uint16_t reg; /* - * The 8081 has no "sticky bits" that survive a soft reset; several bits - * in the Phy Control Register 2 must be preserved across the reset. - * These bits are set up by the bootloader; they control how the phy - * interfaces to the board (such as clock frequency and LED behavior). + * The 8081 has no "sticky bits" that survive a soft reset; several + * bits in the Phy Control Register 2 must be preserved across the + * reset. These bits are set up by the bootloader; they control how the + * phy interfaces to the board (such as clock frequency and LED + * behavior). */ if (sc->mii_mpd_model == MII_MODEL_MICREL_KSZ8081) PHY_READ(sc, MII_KSZ8081_PHYCTL2, ®); @@ -177,9 +178,7 @@ micphy_service(struct mii_softc *sc, str switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ + /* If we're not polling our PHY instance, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) return 0; break; @@ -195,9 +194,7 @@ micphy_service(struct mii_softc *sc, str return 0; } - /* - * If the interface is not up, don't do anything. - */ + /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; @@ -205,9 +202,7 @@ micphy_service(struct mii_softc *sc, str break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ + /* If we're not currently selected, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) return 0; @@ -237,7 +232,8 @@ micphy_service(struct mii_softc *sc, str #define REG_RGMII_CLOCK_AND_CONTROL 0x104 #define REG_RGMII_RX_DATA 0x105 -static void micphy_writexreg(struct mii_softc *sc, uint32_t reg, uint32_t wval) +static void +micphy_writexreg(struct mii_softc *sc, uint32_t reg, uint32_t wval) { uint16_t rval __debugused; @@ -256,7 +252,8 @@ micphy_fixup(struct mii_softc *sc, int m if (!device_is_a(parent, "cpsw")) break; - aprint_normal_dev(sc->mii_dev, "adjusting RGMII signal timing for cpsw\n"); + aprint_normal_dev(sc->mii_dev, + "adjusting RGMII signal timing for cpsw\n"); // RGMII RX Data Pad Skew micphy_writexreg(sc, REG_RGMII_RX_DATA, 0x0000); @@ -265,6 +262,8 @@ micphy_fixup(struct mii_softc *sc, int m micphy_writexreg(sc, REG_RGMII_CLOCK_AND_CONTROL, 0x9090); break; + default: + break; } return; Index: src/sys/dev/mii/mii_physubr.c diff -u src/sys/dev/mii/mii_physubr.c:1.84 src/sys/dev/mii/mii_physubr.c:1.85 --- src/sys/dev/mii/mii_physubr.c:1.84 Tue Jan 22 03:42:27 2019 +++ src/sys/dev/mii/mii_physubr.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: mii_physubr.c,v 1.84 2019/01/22 03:42:27 msaitoh Exp $ */ +/* $NetBSD: mii_physubr.c,v 1.85 2019/03/25 07:34:13 msaitoh 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.84 2019/01/22 03:42:27 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.85 2019/03/25 07:34:13 msaitoh Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -57,7 +57,8 @@ const char *(*mii_get_descr)(int, int) = int mii_verbose_loaded = 0; -const char *mii_get_descr_stub(int oui, int model) +const char * +mii_get_descr_stub(int oui, int model) { mii_load_verbose(); if (mii_verbose_loaded) @@ -69,7 +70,8 @@ const char *mii_get_descr_stub(int oui, /* * Routine to load the miiverbose kernel module as needed */ -void mii_load_verbose(void) +void +mii_load_verbose(void) { if (mii_verbose_loaded == 0) module_autoload("miiverbose", MODULE_CLASS_MISC); @@ -146,9 +148,7 @@ mii_phy_setmedia(struct mii_softc *sc) return; } - /* - * Table index is stored in the media entry. - */ + /* Table index is stored in the media entry. */ #ifdef DIAGNOSTIC if (/* ife->ifm_data < 0 || */ ife->ifm_data >= MII_NMEDIA) @@ -189,11 +189,10 @@ mii_phy_setmedia(struct mii_softc *sc) PHY_WRITE(sc, MII_ANAR, anar); if (sc->mii_flags & MIIF_HAVE_GTCR) PHY_WRITE(sc, MII_100T2CR, gtcr); - if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { + if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) mii_phy_auto(sc, 0); - } else { + else PHY_WRITE(sc, MII_BMCR, bmcr); - } } int @@ -243,7 +242,8 @@ mii_phy_auto(struct mii_softc *sc, int w * 1000-base-T with the link partner. */ if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { - anar &= ~(ANAR_T4|ANAR_TX_FD|ANAR_TX|ANAR_10_FD|ANAR_10); + anar &= ~(ANAR_T4 | ANAR_TX_FD | ANAR_TX | + ANAR_10_FD | ANAR_10); } PHY_WRITE(sc, MII_ANAR, anar); @@ -268,16 +268,15 @@ mii_phy_auto(struct mii_softc *sc, int w PHY_READ(sc, MII_BMSR, &bmsr); if (bmsr & BMSR_ACOMP) - return (0); + return 0; delay(1000); } /* - * Don't need to worry about clearing MIIF_DOINGAUTO. - * If that's set, a timeout is pending, and it will - * clear the flag. + * Don't need to worry about clearing MIIF_DOINGAUTO. If that's + * set, a timeout is pending, and it will clear the flag. */ - return (EIO); + return EIO; } /* @@ -294,7 +293,7 @@ mii_phy_auto(struct mii_softc *sc, int w callout_reset(&sc->mii_nway_ch, hz >> 1, mii_phy_auto_timeout, sc); } - return (EJUSTRETURN); + return EJUSTRETURN; } static void @@ -323,13 +322,12 @@ mii_phy_tick(struct mii_softc *sc) /* Just bail now if the interface is down. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) - return (EJUSTRETURN); + return EJUSTRETURN; /* - * If we're not doing autonegotiation, we don't need to do - * any extra work here. However, we need to check the link - * status so we can generate an announcement by returning - * with 0 if the status changes. + * If we're not doing autonegotiation, we don't need to do any extra + * work here. However, we need to check the link status so we can + * generate an announcement by returning with 0 if the status changes. */ if ((IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) && (IFM_SUBTYPE(ife->ifm_media) != IFM_1000_T)) { @@ -338,7 +336,7 @@ mii_phy_tick(struct mii_softc *sc) * the future autonegotiation start with 0. */ sc->mii_ticks = 0; - return (0); + return 0; } /* Read the status register twice; BMSR_LINK is latch-low. */ @@ -351,7 +349,7 @@ mii_phy_tick(struct mii_softc *sc) */ sc->mii_ticks = 0; /* See above. */ - return (0); + return 0; } /* @@ -360,25 +358,25 @@ mii_phy_tick(struct mii_softc *sc) * 0 to update the status. */ if (sc->mii_ticks++ == 0) - return (0); + return 0; /* * Only retry autonegotiation every N seconds. */ KASSERT(sc->mii_anegticks != 0); if (sc->mii_ticks <= sc->mii_anegticks) - return (EJUSTRETURN); + return EJUSTRETURN; PHY_RESET(sc); if (mii_phy_auto(sc, 0) == EJUSTRETURN) - return (EJUSTRETURN); + return EJUSTRETURN; /* * Might need to generate a status message if autonegotiation * failed. */ - return (0); + return 0; } void @@ -621,7 +619,7 @@ mii_phy_detach(device_t self, int flags) mii_phy_delete_media(sc); LIST_REMOVE(sc, mii_list); - return (0); + return 0; } const struct mii_phydesc * @@ -631,9 +629,9 @@ mii_phy_match(const struct mii_attach_ar for (; mpd->mpd_name != NULL; mpd++) { if (MII_OUI(ma->mii_id1, ma->mii_id2) == mpd->mpd_oui && MII_MODEL(ma->mii_id2) == mpd->mpd_model) - return (mpd); + return mpd; } - return (NULL); + return NULL; } /* @@ -645,7 +643,7 @@ mii_phy_flowstatus(struct mii_softc *sc) uint16_t anar, anlpar; if ((sc->mii_flags & MIIF_DOPAUSE) == 0) - return (0); + return 0; PHY_READ(sc, MII_ANAR, &anar); PHY_READ(sc, MII_ANLPAR, &anlpar); @@ -657,32 +655,32 @@ mii_phy_flowstatus(struct mii_softc *sc) } if ((anar & ANAR_PAUSE_SYM) & (anlpar & ANLPAR_PAUSE_SYM)) - return (IFM_FLOW|IFM_ETH_TXPAUSE|IFM_ETH_RXPAUSE); + return (IFM_FLOW | IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE); if ((anar & ANAR_PAUSE_SYM) == 0) { if ((anar & ANAR_PAUSE_ASYM) && ((anlpar & ANLPAR_PAUSE_TOWARDS) == ANLPAR_PAUSE_TOWARDS)) - return (IFM_FLOW|IFM_ETH_TXPAUSE); + return (IFM_FLOW | IFM_ETH_TXPAUSE); else - return (0); + return 0; } if ((anar & ANAR_PAUSE_ASYM) == 0) { if (anlpar & ANLPAR_PAUSE_SYM) - return (IFM_FLOW|IFM_ETH_TXPAUSE|IFM_ETH_RXPAUSE); + return (IFM_FLOW | IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE); else - return (0); + return 0; } switch ((anlpar & ANLPAR_PAUSE_TOWARDS)) { case ANLPAR_PAUSE_NONE: - return (0); + return 0; case ANLPAR_PAUSE_ASYM: - return (IFM_FLOW|IFM_ETH_RXPAUSE); + return (IFM_FLOW | IFM_ETH_RXPAUSE); default: - return (IFM_FLOW|IFM_ETH_RXPAUSE|IFM_ETH_TXPAUSE); + return (IFM_FLOW | IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE); } /* NOTREACHED */ } Index: src/sys/dev/mii/mii_verbose.c diff -u src/sys/dev/mii/mii_verbose.c:1.4 src/sys/dev/mii/mii_verbose.c:1.5 --- src/sys/dev/mii/mii_verbose.c:1.4 Tue Jan 8 03:14:51 2019 +++ src/sys/dev/mii/mii_verbose.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: mii_verbose.c,v 1.4 2019/01/08 03:14:51 msaitoh Exp $ */ +/* $NetBSD: mii_verbose.c,v 1.5 2019/03/25 07:34:13 msaitoh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -55,9 +55,11 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mii_verbose.c,v 1.4 2019/01/08 03:14:51 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mii_verbose.c,v 1.5 2019/03/25 07:34:13 msaitoh Exp $"); #include <sys/module.h> +#include <dev/mii/miidevs.h> +#include <dev/mii/miidevs_data.h> #include <dev/mii/mii_verbose.h> struct mii_knowndev { @@ -65,8 +67,6 @@ struct mii_knowndev { int model; const char *descr; }; -#include <dev/mii/miidevs.h> -#include <dev/mii/miidevs_data.h> const char * mii_get_descr_real(int, int); @@ -93,12 +93,13 @@ miiverbose_modcmd(modcmd_t cmd, void *ar } const char * -mii_get_descr_real(int oui, int model) { +mii_get_descr_real(int oui, int model) +{ int i; for (i = 0; mii_knowndevs[i].descr != NULL; i++) if (mii_knowndevs[i].oui == oui && mii_knowndevs[i].model == model) break; - return (mii_knowndevs[i].descr); + return mii_knowndevs[i].descr; } Index: src/sys/dev/mii/mvphy.c diff -u src/sys/dev/mii/mvphy.c:1.12 src/sys/dev/mii/mvphy.c:1.13 --- src/sys/dev/mii/mvphy.c:1.12 Sun Feb 24 17:22:21 2019 +++ src/sys/dev/mii/mvphy.c Mon Mar 25 07:34:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: mvphy.c,v 1.12 2019/02/24 17:22:21 christos Exp $ */ +/* $NetBSD: mvphy.c,v 1.13 2019/03/25 07:34:13 msaitoh Exp $ */ /*- * Copyright (c) 2006 Sam Leffler, Errno Consulting @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mvphy.c,v 1.12 2019/02/24 17:22:21 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvphy.c,v 1.13 2019/03/25 07:34:13 msaitoh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -168,9 +168,9 @@ mvphymatch(device_t parent, cfdata_t mat struct mii_attach_args *ma = aux; if (mii_phy_match(ma, mvphys) != NULL) - return (10); + return 10; - return (0); + return 0; } static void @@ -222,11 +222,9 @@ mvphy_service(struct mii_softc *sc, stru switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ + /* If we're not polling our PHY instance, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; break; case MII_MEDIACHG: @@ -236,12 +234,10 @@ mvphy_service(struct mii_softc *sc, stru */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) { /* XXX? */ - return (0); + return 0; } - /* - * If the interface is not up, don't do anything. - */ + /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; @@ -249,19 +245,17 @@ mvphy_service(struct mii_softc *sc, stru break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ + /* If we're not currently selected, just return. */ if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); + return 0; if (mii_phy_tick(sc) == EJUSTRETURN) - return (0); + return 0; break; case MII_DOWN: mii_phy_down(sc); - return (0); + return 0; } /* Update the media status. */ @@ -269,7 +263,7 @@ mvphy_service(struct mii_softc *sc, stru /* Callback if something changed. */ mii_phy_update(sc, cmd); - return (0); + return 0; } static void @@ -323,7 +317,8 @@ mvphy_switchconfig(struct mii_softc *sc, conf->vlanSetting); /* XXX administrative control of port enable? */ MV_WRITE(sc, conf->switchPortAddr, MV_PORT_CONTROL, conf->portControl); - MV_WRITE(sc, conf->switchPortAddr, MV_PORT_ASSOCIATION_VECTOR, 1<<port); + MV_WRITE(sc, conf->switchPortAddr, MV_PORT_ASSOCIATION_VECTOR, + 1 << port); } /*