summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1998-04-20 15:24:28 +0000
committernate <nate@FreeBSD.org>1998-04-20 15:24:28 +0000
commit56e458e6ec430e814247f07da441fe1890fff8f3 (patch)
treeecac70f0631dca0461673ac1891960edcd8fb480 /usr.sbin
parent56d762105bf1b81cf9a7dfdb3bd4b56e5e04942e (diff)
downloadFreeBSD-src-56e458e6ec430e814247f07da441fe1890fff8f3.zip
FreeBSD-src-56e458e6ec430e814247f07da441fe1890fff8f3.tar.gz
- Don't try and keep track of the previous state, since the kernel may
change it w/out informing the program. Instead, use the (now available) previous state returned by the kernel to make intelligent card removal/insertion decisions.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pccard/pccardd/cardd.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/usr.sbin/pccard/pccardd/cardd.c b/usr.sbin/pccard/pccardd/cardd.c
index 2b4d649..3449a04 100644
--- a/usr.sbin/pccard/pccardd/cardd.c
+++ b/usr.sbin/pccard/pccardd/cardd.c
@@ -26,7 +26,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: cardd.c,v 1.29 1998/03/02 20:51:06 guido Exp $";
+ "$Id: cardd.c,v 1.30 1998/03/09 05:18:50 hosokawa Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -101,7 +101,6 @@ readslots(void)
sp->fd = fd;
sp->name = newstr(name);
sp->slot = i;
- sp->state = empty;
/* Check to see if the controller memory has been set up. */
if (slots == 0) {
@@ -120,9 +119,6 @@ readslots(void)
logerr("ioctl (PIOCRWMEM)");
}
}
-#ifdef DEBUG
- printf("%p %p\n", sp, &sp->next);
-#endif
sp->next = slots;
slots = sp;
slot_change(sp);
@@ -143,27 +139,20 @@ slot_change(struct slot *sp)
logerr("ioctl (PIOCGSTATE)");
return;
}
-#ifdef DEBUG
- if (state.state == sp->state)
- logmsg("State same as before, continuing anyway");
-#endif
switch (state.state) {
case empty:
case noslot:
- card_removed(sp);
+ if (state.laststate == filled)
+ card_removed(sp);
break;
case filled:
/*
- * If state was already filled, fake a removal first to get
+ * If the previous state was suspend, fake a removal to get
* our state in sync with the kernel. This happens when the
- * systems resumes and we only get to process the state
- * change from suspend to empty after inserted() has run.
- * In that case the kernel state is perfectly normal.
- *
- * The reason for not doing nothing is that the kernel
- * has to be informed again about IRQ and IO window.
+ * system resumes, since we can only reliably process
+ * the state change after we resume.
*/
- if (state.state == sp->state)
+ if (state.laststate == suspend)
card_removed(sp);
card_inserted(sp);
break;
@@ -171,7 +160,6 @@ slot_change(struct slot *sp)
/* ignored */
break;
}
- sp->state = state.state;
}
/*
OpenPOWER on IntegriCloud