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(9): Make mii_phy_down clear the flag if it p...
details: https://anonhg.NetBSD.org/src/rev/85270a7a3135
branches: trunk
changeset: 369599:85270a7a3135
user: riastradh <riastradh%NetBSD.org@localhost>
date: Tue Aug 23 01:05:50 2022 +0000
description:
mii(9): Make mii_phy_down clear the flag if it prevented the callout.
This fixes a bug in the previous change to make mii_down wait for the
mii auto timeout to complete.
diffstat:
sys/dev/mii/mii_physubr.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diffs (37 lines):
diff -r 656149d75a3d -r 85270a7a3135 sys/dev/mii/mii_physubr.c
--- a/sys/dev/mii/mii_physubr.c Mon Aug 22 18:30:50 2022 +0000
+++ b/sys/dev/mii/mii_physubr.c Tue Aug 23 01:05:50 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mii_physubr.c,v 1.100 2022/08/20 11:12:46 riastradh Exp $ */
+/* $NetBSD: mii_physubr.c,v 1.101 2022/08/23 01:05:50 riastradh 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.100 2022/08/20 11:12:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.101 2022/08/23 01:05:50 riastradh Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -441,9 +441,15 @@
sc->mii_pdata->mii_media.ifm_lock);
}
} else {
- if (sc->mii_flags & MIIF_DOINGAUTO) {
- callout_halt(&sc->mii_nway_ch,
- sc->mii_pdata->mii_media.ifm_lock);
+ if ((sc->mii_flags & MIIF_DOINGAUTO) != 0 &&
+ callout_halt(&sc->mii_nway_ch,
+ sc->mii_pdata->mii_media.ifm_lock) == 0) {
+ /*
+ * The callout was scheduled, and we prevented
+ * it from running before it expired, so we are
+ * now responsible for clearing the flag.
+ */
+ sc->mii_flags &= ~MIIF_DOINGAUTO;
}
}
KASSERT((sc->mii_flags & MIIF_DOINGAUTO) == 0);
Home |
Main Index |
Thread Index |
Old Index