Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm/dist/bsd-core on netbsd with the single...



details:   https://anonhg.NetBSD.org/src/rev/f07f8332cef7
branches:  trunk
changeset: 746902:f07f8332cef7
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Aug 23 08:55:16 2009 +0000

description:
on netbsd with the single final close() action, make sure we clean up
all the files attached to dev->files.  we check for one per "open_count"
that is above 1.  could perhaps assert() that we are empty afterwards.

this fixes restarting X + drm after actually using drm.

diffstat:

 sys/external/bsd/drm/dist/bsd-core/drm_drv.c |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (22 lines):

diff -r 345d1fccedce -r f07f8332cef7 sys/external/bsd/drm/dist/bsd-core/drm_drv.c
--- a/sys/external/bsd/drm/dist/bsd-core/drm_drv.c      Sun Aug 23 08:51:56 2009 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/drm_drv.c      Sun Aug 23 08:55:16 2009 +0000
@@ -932,7 +932,17 @@
 #if defined(__NetBSD__)
        /* On NetBSD, close will only be called once */
        DRM_DEBUG("setting open_count %d to 1\n", (int)dev->open_count);
-       dev->open_count = 1;
+       while (dev->open_count != 1) {
+               /*
+                * XXXMRG probably should assert that we are freeing
+                * one of these each time.  i think.
+                */
+               if (!TAILQ_EMPTY(&dev->files)) {
+                       file_priv = TAILQ_FIRST(&dev->files);
+                       TAILQ_REMOVE(&dev->files, file_priv, link);
+               }
+               dev->open_count--;
+       }
 #endif
        if (--dev->open_count == 0) {
                retcode = drm_lastclose(dev);



Home | Main Index | Thread Index | Old Index