Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/riastradh-drm2]: src/sys/external/bsd/drm2/dist/drm Replace trivial spin...
details: https://anonhg.NetBSD.org/src/rev/6eebd4c589b9
branches: riastradh-drm2
changeset: 788050:6eebd4c589b9
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jul 24 02:00:22 2013 +0000
description:
Replace trivial spinlock by atomics in drm_getmagic.
(This whole drm_getmagic thing smells awfully fishy...)
diffstat:
sys/external/bsd/drm2/dist/drm/drm_auth.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diffs (29 lines):
diff -r d61cad16f63c -r 6eebd4c589b9 sys/external/bsd/drm2/dist/drm/drm_auth.c
--- a/sys/external/bsd/drm2/dist/drm/drm_auth.c Wed Jul 24 02:00:07 2013 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_auth.c Wed Jul 24 02:00:22 2013 +0000
@@ -142,7 +142,9 @@
int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
static drm_magic_t sequence = 0;
+#ifndef __NetBSD__
static DEFINE_SPINLOCK(lock);
+#endif
struct drm_auth *auth = data;
/* Find unique magic */
@@ -150,11 +152,15 @@
auth->magic = file_priv->magic;
} else {
do {
+#ifdef __NetBSD__
+ auth->magic = atomic_inc_uint_nv(&sequence);
+#else
spin_lock(&lock);
if (!sequence)
++sequence; /* reserve 0 */
auth->magic = sequence++;
spin_unlock(&lock);
+#endif
} while (drm_find_file(file_priv->master, auth->magic));
file_priv->magic = auth->magic;
drm_add_magic(file_priv->master, file_priv, auth->magic);
Home |
Main Index |
Thread Index |
Old Index