From 7969dd25b529992828048bd117ef1fe51464f1e0 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Tue, 22 Feb 2005 09:16:52 +0000 Subject: From part of NetBSD rtw.c rev 1.36: In rtw_detach, flag the rtw as "invalid" (RTW_F_INVALID). Do not try to power-down the RF section of an invalid rtw. --- sys/dev/ic/rtw.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c index 57e2f15c6d6..7fd4c8ab7e2 100644 --- a/sys/dev/ic/rtw.c +++ b/sys/dev/ic/rtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtw.c,v 1.18 2005/02/19 03:33:30 jsg Exp $ */ +/* $OpenBSD: rtw.c,v 1.19 2005/02/22 09:16:51 jsg Exp $ */ /* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */ /*- * Copyright (c) 2004, 2005 David Young. All rights reserved. @@ -2125,9 +2125,11 @@ rtw_disable(struct rtw_softc *sc) return; /* turn off PHY */ - if ((rc = rtw_pwrstate(sc, RTW_OFF)) != 0) + if ((sc->sc_flags & RTW_F_INVALID) == 0 && + (rc = rtw_pwrstate(sc, RTW_OFF)) != 0) { printf("%s: failed to turn off PHY (%d)\n", sc->sc_dev.dv_xname, rc); + } if (sc->sc_disable != NULL) (*sc->sc_disable)(sc); @@ -3928,6 +3930,8 @@ rtw_detach(struct rtw_softc *sc) { int pri; + sc->sc_flags |= RTW_F_INVALID; + switch (sc->sc_attach_state) { case FINISHED: rtw_stop(&sc->sc_if, 1); -- cgit v1.2.3