summaryrefslogtreecommitdiff
path: root/sys/dev/pcmcia
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2000-02-05 22:10:51 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2000-02-05 22:10:51 +0000
commit479a01bbe03f2bed82d0f50d2bb12844978a3f43 (patch)
treee3239f63f6c89dff4c65d3021feb871be692480b /sys/dev/pcmcia
parentdf54ef149e18337b319dde4134176c8a5376a75c (diff)
if card has an activate function, call it on apm power changes
Diffstat (limited to 'sys/dev/pcmcia')
-rw-r--r--sys/dev/pcmcia/pcmcia.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/sys/dev/pcmcia/pcmcia.c b/sys/dev/pcmcia/pcmcia.c
index d44d22cac11..24d2aefff23 100644
--- a/sys/dev/pcmcia/pcmcia.c
+++ b/sys/dev/pcmcia/pcmcia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcmcia.c,v 1.24 1999/08/16 21:46:11 fgsch Exp $ */
+/* $OpenBSD: pcmcia.c,v 1.25 2000/02/05 22:10:50 deraadt Exp $ */
/* $NetBSD: pcmcia.c,v 1.9 1998/08/13 02:10:55 eeh Exp $ */
/*
@@ -57,6 +57,7 @@ int pcmcia_submatch __P((struct device *, void *, void *));
void pcmcia_attach __P((struct device *, struct device *, void *));
int pcmcia_print __P((void *, const char *));
void pcmcia_card_detach_notify __P((struct device *, void *));
+void pcmcia_power __P((int why, void *arg));
static inline void pcmcia_socket_enable __P((pcmcia_chipset_tag_t,
pcmcia_chipset_handle_t *));
@@ -121,6 +122,32 @@ pcmcia_attach(parent, self, aux)
sc->iosize = paa->iosize;
sc->ih = NULL;
+ powerhook_establish(pcmcia_power, sc);
+}
+
+void
+pcmcia_power(why, arg)
+ int why;
+ void *arg;
+{
+ struct pcmcia_softc *sc = (struct pcmcia_softc *) arg;
+ struct pcmcia_function *pf;
+ struct device *d;
+ int act = DVACT_ACTIVATE;
+
+ if (why != PWR_RESUME)
+ act = DVACT_DEACTIVATE;
+
+ for (pf = SIMPLEQ_FIRST(&sc->card.pf_head); pf != NULL;
+ pf = SIMPLEQ_NEXT(pf, pf_list)) {
+ if (SIMPLEQ_FIRST(&pf->cfe_head) == NULL)
+ continue;
+ d = pf->child;
+ if (d == NULL)
+ continue;
+ if (d->dv_cfdata->cf_attach->ca_activate)
+ (*d->dv_cfdata->cf_attach->ca_activate)(d, act);
+ }
}
int