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 Use Linux atomics, n...
details: https://anonhg.NetBSD.org/src/rev/94aae3f176ed
branches: riastradh-drm2
changeset: 788548:94aae3f176ed
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Sep 08 16:08:38 2013 +0000
description:
Use Linux atomics, not spinlocks or NetBSD atomics in drm_auth.c.
Removes an #ifdef __NetBSD__.
diffstat:
sys/external/bsd/drm2/dist/drm/drm_auth.c | 15 ++-------------
1 files changed, 2 insertions(+), 13 deletions(-)
diffs (32 lines):
diff -r a8561e0c4f83 -r 94aae3f176ed sys/external/bsd/drm2/dist/drm/drm_auth.c
--- a/sys/external/bsd/drm2/dist/drm/drm_auth.c Sun Sep 08 16:07:29 2013 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_auth.c Sun Sep 08 16:08:38 2013 +0000
@@ -141,10 +141,7 @@
*/
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
+ static atomic_t sequence = ATOMIC_INIT(0);
struct drm_auth *auth = data;
/* Find unique magic */
@@ -152,15 +149,7 @@
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
+ auth->magic = atomic_inc_return(&sequence);
} 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