Module Name: src
Committed By: mrg
Date: Sun Aug 23 08:55:16 UTC 2009
Modified Files:
src/sys/external/bsd/drm/dist/bsd-core: drm_drv.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c
diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.14 src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.15
--- src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c:1.14 Wed Jun 24 08:09:26 2009
+++ src/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Sun Aug 23 08:55:16 2009
@@ -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);