Rev 6102 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6102 | Rev 6125 | ||
---|---|---|---|
Line 150... | Line 150... | ||
150 | } |
150 | } |
Line 151... | Line 151... | ||
151 | 151 | ||
152 | static inline void |
152 | static inline void |
153 | drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) |
153 | drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) |
154 | { |
- | |
155 | if (obj && !atomic_add_unless(&obj->refcount.refcount, -1, 1)) { |
154 | { |
Line -... | Line 155... | ||
- | 155 | struct drm_device *dev; |
|
156 | struct drm_device *dev = obj->dev; |
156 | |
- | 157 | if (!obj) |
|
157 | 158 | return; |
|
158 | mutex_lock(&dev->struct_mutex); |
159 | |
159 | if (likely(atomic_dec_and_test(&obj->refcount.refcount))) |
160 | dev = obj->dev; |
160 | drm_gem_object_free(&obj->refcount); |
161 | if (kref_put_mutex(&obj->refcount, drm_gem_object_free, &dev->struct_mutex)) |
- | 162 | mutex_unlock(&dev->struct_mutex); |
|
161 | mutex_unlock(&dev->struct_mutex); |
163 | else |
Line 162... | Line 164... | ||
162 | } |
164 | might_lock(&dev->struct_mutex); |
163 | } |
165 | } |
164 | 166 |