Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm When a media change is requested, don't just al...
details: https://anonhg.NetBSD.org/src/rev/6a6014bb02d7
branches: trunk
changeset: 849016:6a6014bb02d7
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Feb 19 02:51:54 2020 +0000
description:
When a media change is requested, don't just all (*if_init)(). That's
needlessly disruptive and incompatible with future locking changes.
We can use both ether_mediachange() and ether_mediastatus() instead.
diffstat:
sys/arch/arm/at91/at91emac.c | 29 ++++-------------------------
sys/arch/arm/ep93xx/epe.c | 15 +++------------
2 files changed, 7 insertions(+), 37 deletions(-)
diffs (114 lines):
diff -r 77917f69826e -r 6a6014bb02d7 sys/arch/arm/at91/at91emac.c
--- a/sys/arch/arm/at91/at91emac.c Tue Feb 18 21:29:39 2020 +0000
+++ b/sys/arch/arm/at91/at91emac.c Wed Feb 19 02:51:54 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: at91emac.c,v 1.31 2020/02/11 15:09:14 skrll Exp $ */
+/* $NetBSD: at91emac.c,v 1.32 2020/02/19 02:51:54 thorpej Exp $ */
/*
* Copyright (c) 2007 Embedtronics Oy
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at91emac.c,v 1.31 2020/02/11 15:09:14 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at91emac.c,v 1.32 2020/02/19 02:51:54 thorpej Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -93,8 +93,6 @@
static void emac_init(struct emac_softc *);
static int emac_intr(void* arg);
static int emac_gctx(struct emac_softc *);
-static int emac_mediachange(struct ifnet *);
-static void emac_mediastatus(struct ifnet *, struct ifmediareq *);
int emac_mii_readreg (device_t, int, int, uint16_t *);
int emac_mii_writereg (device_t, int, int, uint16_t);
void emac_statchg (struct ifnet *);
@@ -467,8 +465,8 @@
mii->mii_writereg = emac_mii_writereg;
mii->mii_statchg = emac_statchg;
sc->sc_ec.ec_mii = mii;
- ifmedia_init(&mii->mii_media, IFM_IMASK, emac_mediachange,
- emac_mediastatus);
+ ifmedia_init(&mii->mii_media, IFM_IMASK, ether_mediachange,
+ ether_mediastatus);
mii_attach((device_t )sc, mii, 0xffffffff, MII_PHY_ANY,
MII_OFFSET_ANY, 0);
ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_AUTO);
@@ -506,25 +504,6 @@
ether_ifattach(ifp, (sc)->sc_enaddr);
}
-static int
-emac_mediachange(struct ifnet *ifp)
-{
- if (ifp->if_flags & IFF_UP)
- emac_ifinit(ifp);
- return (0);
-}
-
-static void
-emac_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
-{
- struct emac_softc *sc = ifp->if_softc;
-
- mii_pollstat(&sc->sc_mii);
- ifmr->ifm_active = sc->sc_mii.mii_media_active;
- ifmr->ifm_status = sc->sc_mii.mii_media_status;
-}
-
-
int
emac_mii_readreg(device_t self, int phy, int reg, uint16_t *val)
{
diff -r 77917f69826e -r 6a6014bb02d7 sys/arch/arm/ep93xx/epe.c
--- a/sys/arch/arm/ep93xx/epe.c Tue Feb 18 21:29:39 2020 +0000
+++ b/sys/arch/arm/ep93xx/epe.c Wed Feb 19 02:51:54 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: epe.c,v 1.47 2020/02/03 13:58:05 skrll Exp $ */
+/* $NetBSD: epe.c,v 1.48 2020/02/19 02:51:54 thorpej Exp $ */
/*
* Copyright (c) 2004 Jesse Off
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: epe.c,v 1.47 2020/02/03 13:58:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: epe.c,v 1.48 2020/02/19 02:51:54 thorpej Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -96,7 +96,6 @@
static void epe_init(struct epe_softc *);
static int epe_intr(void* arg);
static int epe_gctx(struct epe_softc *);
-static int epe_mediachange(struct ifnet *);
int epe_mii_readreg (device_t, int, int, uint16_t *);
int epe_mii_writereg (device_t, int, int, uint16_t);
void epe_statchg (struct ifnet *);
@@ -401,7 +400,7 @@
mii->mii_writereg = epe_mii_writereg;
mii->mii_statchg = epe_statchg;
sc->sc_ec.ec_mii = mii;
- ifmedia_init(&mii->mii_media, IFM_IMASK, epe_mediachange,
+ ifmedia_init(&mii->mii_media, IFM_IMASK, ether_mediachange,
ether_mediastatus);
mii_attach(sc->sc_dev, mii, 0xffffffff, MII_PHY_ANY,
MII_OFFSET_ANY, 0);
@@ -440,14 +439,6 @@
ether_ifattach(ifp, (sc)->sc_enaddr);
}
-static int
-epe_mediachange(struct ifnet *ifp)
-{
- if (ifp->if_flags & IFF_UP)
- epe_ifinit(ifp);
- return 0;
-}
-
int
epe_mii_readreg(device_t self, int phy, int reg, uint16_t *val)
{
Home |
Main Index |
Thread Index |
Old Index