diff options
author | imp <imp@FreeBSD.org> | 2002-09-08 22:18:06 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2002-09-08 22:18:06 +0000 |
commit | 2ea68b67d43ee5c3c9196a9a0e870dd677aed689 (patch) | |
tree | c81ed28cd23852cce6b01766295bb297a9a26759 | |
parent | b8afb5b84c985ed1b86b8ed69ed3a6c3d8d57168 (diff) | |
download | FreeBSD-src-2ea68b67d43ee5c3c9196a9a0e870dd677aed689.zip FreeBSD-src-2ea68b67d43ee5c3c9196a9a0e870dd677aed689.tar.gz |
Change the order that we look for free memory windows from 0 -> MAX-1
to MAX-1 -> 0. This should allow for less potential for conflict
between pccardd/pccardc and drivers. As far as I can tell no drivers
try to use window 4, so this should be a no-op for them.
-rw-r--r-- | sys/pccard/pccard.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index b145317..5500f5e 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -384,10 +384,10 @@ crdread(dev_t dev, struct uio *uio, int ioflag) return (ENXIO); if (pccard_mem == 0) return (ENOMEM); - for (win = 0; win < slt->ctrl->maxmem; win++) + for (win = slt->ctrl->maxmem - 1; win >= 0; win--) if ((slt->mem[win].flags & MDF_ACTIVE) == 0) break; - if (win >= slt->ctrl->maxmem) + if (win < 0) return (EBUSY); mp = &slt->mem[win]; oldmap = *mp; @@ -430,10 +430,10 @@ crdwrite(dev_t dev, struct uio *uio, int ioflag) return (ENXIO); if (pccard_mem == 0) return (ENOMEM); - for (win = 0; win < slt->ctrl->maxmem; win++) + for (win = slt->ctrl->maxmem - 1; win >= 0; win--) if ((slt->mem[win].flags & MDF_ACTIVE) == 0) break; - if (win >= slt->ctrl->maxmem) + if (win < 0) return (EBUSY); mp = &slt->mem[win]; oldmap = *mp; |