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.
This commit is contained in:
Warner Losh 2002-09-08 22:18:06 +00:00
parent aec0ec7779
commit 223e8ce62d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103106

View File

@ -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;