From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: [PATCH] drm/i915: use kref_put_mutex in i915_gem_request_unreference__unlocked
Date: Tue, 07 Apr 2015 11:32:02 +0200 [thread overview]
Message-ID: <5523A412.2000805@linux.intel.com> (raw)
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b13c5526a73b..7aaf8eddf19c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2146,14 +2146,14 @@ i915_gem_request_unreference(struct drm_i915_gem_request *req)
static inline void
i915_gem_request_unreference__unlocked(struct drm_i915_gem_request *req)
{
- if (req && !atomic_add_unless(&req->ref.refcount, -1, 1)) {
- struct drm_device *dev = req->ring->dev;
+ struct drm_device *dev;
+
+ if (!req)
+ return;
- mutex_lock(&dev->struct_mutex);
- if (likely(atomic_dec_and_test(&req->ref.refcount)))
- i915_gem_request_free(&req->ref);
+ dev = req->ring->dev;
+ if (kref_put_mutex(&req->ref, i915_gem_request_free, &dev->struct_mutex))
mutex_unlock(&dev->struct_mutex);
- }
}
static inline void i915_gem_request_assign(struct drm_i915_gem_request **pdst,
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next reply other threads:[~2015-04-07 9:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-07 9:32 Maarten Lankhorst [this message]
2015-04-07 13:37 ` [PATCH] drm/i915: use kref_put_mutex in i915_gem_request_unreference__unlocked Daniel Vetter
2015-04-07 13:51 ` Maarten Lankhorst
2015-04-07 14:04 ` Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5523A412.2000805@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox