diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c index 084ef8d940dd..56ef020ca6eb 100644 --- a/sys/i386/apm/apm.c +++ b/sys/i386/apm/apm.c @@ -13,7 +13,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.30 1996/03/18 22:40:57 nate Exp $ + * $Id: apm.c,v 1.31 1996/03/18 22:47:16 nate Exp $ */ #include "apm.h" @@ -539,7 +539,9 @@ apm_timeout(void *arg) struct apm_softc *sc = arg; apm_processevent(sc); - timeout(apm_timeout, (void *)sc, hz - 1 ); /* More than 1 Hz */ + if (sc->active == 1) { + timeout(apm_timeout, (void *)sc, hz - 1 ); /* More than 1 Hz */ + } } /* enable APM BIOS */ @@ -825,7 +827,11 @@ apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p) #endif switch (cmd) { case APMIO_SUSPEND: - apm_suspend(); + if ( sc->active) { + apm_suspend(); + } else { + error = EINVAL; + } break; case APMIO_GETINFO: if (apm_get_info(sc, (apm_info_t)addr)) { diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index 084ef8d940dd..56ef020ca6eb 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -13,7 +13,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.30 1996/03/18 22:40:57 nate Exp $ + * $Id: apm.c,v 1.31 1996/03/18 22:47:16 nate Exp $ */ #include "apm.h" @@ -539,7 +539,9 @@ apm_timeout(void *arg) struct apm_softc *sc = arg; apm_processevent(sc); - timeout(apm_timeout, (void *)sc, hz - 1 ); /* More than 1 Hz */ + if (sc->active == 1) { + timeout(apm_timeout, (void *)sc, hz - 1 ); /* More than 1 Hz */ + } } /* enable APM BIOS */ @@ -825,7 +827,11 @@ apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p) #endif switch (cmd) { case APMIO_SUSPEND: - apm_suspend(); + if ( sc->active) { + apm_suspend(); + } else { + error = EINVAL; + } break; case APMIO_GETINFO: if (apm_get_info(sc, (apm_info_t)addr)) {