aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2001-11-27 14:12:21 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2001-11-27 14:12:21 +0000
commit3e0cee70d701f1c9ce08e9e3fdd796f43dcd631b (patch)
tree76de5defc3f0588e762d5ef00026ad2b1dd89451
parentc79ae091de414f8f7e26e62785bc79880efee396 (diff)
Notes
-rw-r--r--sys/dev/agp/agp.c16
-rw-r--r--sys/pci/agp.c16
2 files changed, 12 insertions, 20 deletions
diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c
index 138fe4505ab2..a93805575609 100644
--- a/sys/dev/agp/agp.c
+++ b/sys/dev/agp/agp.c
@@ -531,7 +531,6 @@ static int
agp_release_helper(device_t dev, enum agp_acquire_state state)
{
struct agp_softc *sc = device_get_softc(dev);
- struct agp_memory *mem;
if (sc->as_state == AGP_ACQUIRE_FREE)
return 0;
@@ -539,15 +538,6 @@ agp_release_helper(device_t dev, enum agp_acquire_state state)
if (sc->as_state != state)
return EBUSY;
- /*
- * Clear out the aperture and free any outstanding memory blocks.
- */
- while ((mem = TAILQ_FIRST(&sc->as_memory)) != 0) {
- if (mem->am_is_bound)
- AGP_UNBIND_MEMORY(dev, mem);
- AGP_FREE_MEMORY(dev, mem);
- }
-
sc->as_state = AGP_ACQUIRE_FREE;
return 0;
}
@@ -663,10 +653,16 @@ agp_close(dev_t kdev, int fflag, int devtype, struct thread *td)
{
device_t dev = KDEV2DEV(kdev);
struct agp_softc *sc = device_get_softc(dev);
+ struct agp_memory *mem;
/*
* Clear the GATT and force release on last close
*/
+ while ((mem = TAILQ_FIRST(&sc->as_memory)) != 0) {
+ if (mem->am_is_bound)
+ AGP_UNBIND_MEMORY(dev, mem);
+ AGP_FREE_MEMORY(dev, mem);
+ }
if (sc->as_state == AGP_ACQUIRE_USER)
agp_release_helper(dev, AGP_ACQUIRE_USER);
sc->as_isopen = 0;
diff --git a/sys/pci/agp.c b/sys/pci/agp.c
index 138fe4505ab2..a93805575609 100644
--- a/sys/pci/agp.c
+++ b/sys/pci/agp.c
@@ -531,7 +531,6 @@ static int
agp_release_helper(device_t dev, enum agp_acquire_state state)
{
struct agp_softc *sc = device_get_softc(dev);
- struct agp_memory *mem;
if (sc->as_state == AGP_ACQUIRE_FREE)
return 0;
@@ -539,15 +538,6 @@ agp_release_helper(device_t dev, enum agp_acquire_state state)
if (sc->as_state != state)
return EBUSY;
- /*
- * Clear out the aperture and free any outstanding memory blocks.
- */
- while ((mem = TAILQ_FIRST(&sc->as_memory)) != 0) {
- if (mem->am_is_bound)
- AGP_UNBIND_MEMORY(dev, mem);
- AGP_FREE_MEMORY(dev, mem);
- }
-
sc->as_state = AGP_ACQUIRE_FREE;
return 0;
}
@@ -663,10 +653,16 @@ agp_close(dev_t kdev, int fflag, int devtype, struct thread *td)
{
device_t dev = KDEV2DEV(kdev);
struct agp_softc *sc = device_get_softc(dev);
+ struct agp_memory *mem;
/*
* Clear the GATT and force release on last close
*/
+ while ((mem = TAILQ_FIRST(&sc->as_memory)) != 0) {
+ if (mem->am_is_bound)
+ AGP_UNBIND_MEMORY(dev, mem);
+ AGP_FREE_MEMORY(dev, mem);
+ }
if (sc->as_state == AGP_ACQUIRE_USER)
agp_release_helper(dev, AGP_ACQUIRE_USER);
sc->as_isopen = 0;