From 61f1690226e40593c25cefe0d4adc5ba9d9bbe0c Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 27 Jul 2010 22:39:59 +0000 Subject: [PATCH] ca_activate handler for suspend/resume. untested -- if someone tests this let me know. --- sys/dev/pci/if_alc.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/if_alc.c b/sys/dev/pci/if_alc.c index 95936997560..1d1a63e1993 100644 --- a/sys/dev/pci/if_alc.c +++ b/sys/dev/pci/if_alc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_alc.c,v 1.5 2010/04/08 00:23:53 tedu Exp $ */ +/* $OpenBSD: if_alc.c,v 1.6 2010/07/27 22:39:59 deraadt Exp $ */ /*- * Copyright (c) 2009, Pyun YongHyeon * All rights reserved. @@ -79,6 +79,7 @@ int alc_match(struct device *, void *, void *); void alc_attach(struct device *, struct device *, void *); int alc_detach(struct device *, int); +int alc_activate(struct device *, int); int alc_init(struct ifnet *); void alc_start(struct ifnet *); @@ -128,7 +129,8 @@ const struct pci_matchid alc_devices[] = { }; struct cfattach alc_ca = { - sizeof (struct alc_softc), alc_match, alc_attach + sizeof (struct alc_softc), alc_match, alc_attach, NULL, + alc_activate }; struct cfdriver alc_cd = { @@ -675,6 +677,28 @@ alc_detach(struct device *self, int flags) return (0); } +int +alc_activate(struct device *self, int act) +{ + struct alc_softc *sc = (struct alc_softc *)self; + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + int rv = 0; + + switch (act) { + case DVACT_SUSPEND: + if (ifp->if_flags & IFF_RUNNING) + alc_stop(sc); + rv = config_activate_children(self, act); + break; + case DVACT_RESUME: + rv = config_activate_children(self, act); + if (ifp->if_flags & IFF_UP) + alc_init(ifp); + break; + } + return rv; +} + int alc_dma_alloc(struct alc_softc *sc) { -- 2.20.1