Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Don't use a static variable in the power hook. ...



details:   https://anonhg.NetBSD.org/src/rev/8f85c3d4557f
branches:  trunk
changeset: 517747:8f85c3d4557f
user:      augustss <augustss%NetBSD.org@localhost>
date:      Sun Nov 18 16:59:08 2001 +0000

description:
Don't use a static variable in the power hook.  It doesn't work with more
than one device.

diffstat:

 sys/dev/pci/autri.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r 630435861bad -r 8f85c3d4557f sys/dev/pci/autri.c
--- a/sys/dev/pci/autri.c       Sun Nov 18 16:48:13 2001 +0000
+++ b/sys/dev/pci/autri.c       Sun Nov 18 16:59:08 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autri.c,v 1.1 2001/11/18 03:16:02 someya Exp $ */
+/*     $NetBSD: autri.c,v 1.2 2001/11/18 16:59:08 augustss Exp $       */
 
 /*
  * Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro.
@@ -612,22 +612,22 @@
        midi_attach_mi(&autri_midi_hw_if, sc, &sc->sc_dev);
 #endif
 
+       sc->sc_old_power = PWR_RESUME;
        powerhook_establish(autri_powerhook, sc);
 }
 
 static void
-autri_powerhook(int why,void *addr)
+autri_powerhook(int why, void *addr)
 {
-       static int old = PWR_RESUME;
        struct autri_softc *sc = addr;
 
-       if (why == PWR_RESUME && old == PWR_SUSPEND) {
+       if (why == PWR_RESUME && sc->sc_old_power == PWR_SUSPEND) {
                DPRINTF(("PWR_RESUME\n"));
                autri_init(sc);
                /*autri_reset_codec(&sc->sc_codec);*/
                (sc->sc_codec.codec_if->vtbl->restore_ports)(sc->sc_codec.codec_if);
        }
-       old = why;
+       sc->sc_old_power = why;
 }
 
 int



Home | Main Index | Thread Index | Old Index