aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2015-04-02 05:39:45 -0400
committerThomas Hellstrom <thellstrom@vmware.com>2015-08-05 08:01:11 -0400
commitb9eb1a6174e58eb8beea664ffc20d152230d8004 (patch)
treec95ea95353e27545018d56b7b17f6f0cce2e5d48 /drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
parentf6b05004538ab0933c7527f10a2a6ed88c620f99 (diff)
drm/vmwgfx: Kill a bunch of sparse warnings
We're giving up all attempts to keep cpu- and device byte ordering separate. This silences sparse when compiled using make C=2 CF="-D__CHECK_ENDIAN__" Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_resource.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_resource.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index 69b471af0130..be2809aaa7cb 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -121,6 +121,7 @@ static void vmw_resource_release(struct kref *kref)
121 int id; 121 int id;
122 struct idr *idr = &dev_priv->res_idr[res->func->res_type]; 122 struct idr *idr = &dev_priv->res_idr[res->func->res_type];
123 123
124 write_lock(&dev_priv->resource_lock);
124 res->avail = false; 125 res->avail = false;
125 list_del_init(&res->lru_head); 126 list_del_init(&res->lru_head);
126 write_unlock(&dev_priv->resource_lock); 127 write_unlock(&dev_priv->resource_lock);
@@ -156,20 +157,17 @@ static void vmw_resource_release(struct kref *kref)
156 kfree(res); 157 kfree(res);
157 158
158 write_lock(&dev_priv->resource_lock); 159 write_lock(&dev_priv->resource_lock);
159
160 if (id != -1) 160 if (id != -1)
161 idr_remove(idr, id); 161 idr_remove(idr, id);
162 write_unlock(&dev_priv->resource_lock);
162} 163}
163 164
164void vmw_resource_unreference(struct vmw_resource **p_res) 165void vmw_resource_unreference(struct vmw_resource **p_res)
165{ 166{
166 struct vmw_resource *res = *p_res; 167 struct vmw_resource *res = *p_res;
167 struct vmw_private *dev_priv = res->dev_priv;
168 168
169 *p_res = NULL; 169 *p_res = NULL;
170 write_lock(&dev_priv->resource_lock);
171 kref_put(&res->kref, vmw_resource_release); 170 kref_put(&res->kref, vmw_resource_release);
172 write_unlock(&dev_priv->resource_lock);
173} 171}
174 172
175 173
@@ -260,17 +258,16 @@ void vmw_resource_activate(struct vmw_resource *res,
260 write_unlock(&dev_priv->resource_lock); 258 write_unlock(&dev_priv->resource_lock);
261} 259}
262 260
263struct vmw_resource *vmw_resource_lookup(struct vmw_private *dev_priv, 261static struct vmw_resource *vmw_resource_lookup(struct vmw_private *dev_priv,
264 struct idr *idr, int id) 262 struct idr *idr, int id)
265{ 263{
266 struct vmw_resource *res; 264 struct vmw_resource *res;
267 265
268 read_lock(&dev_priv->resource_lock); 266 read_lock(&dev_priv->resource_lock);
269 res = idr_find(idr, id); 267 res = idr_find(idr, id);
270 if (res && res->avail) 268 if (!res || !res->avail || !kref_get_unless_zero(&res->kref))
271 kref_get(&res->kref);
272 else
273 res = NULL; 269 res = NULL;
270
274 read_unlock(&dev_priv->resource_lock); 271 read_unlock(&dev_priv->resource_lock);
275 272
276 if (unlikely(res == NULL)) 273 if (unlikely(res == NULL))
@@ -1306,7 +1303,7 @@ vmw_resource_backoff_reservation(struct ttm_validate_buffer *val_buf)
1306 * @res: The resource to evict. 1303 * @res: The resource to evict.
1307 * @interruptible: Whether to wait interruptible. 1304 * @interruptible: Whether to wait interruptible.
1308 */ 1305 */
1309int vmw_resource_do_evict(struct vmw_resource *res, bool interruptible) 1306static int vmw_resource_do_evict(struct vmw_resource *res, bool interruptible)
1310{ 1307{
1311 struct ttm_validate_buffer val_buf; 1308 struct ttm_validate_buffer val_buf;
1312 const struct vmw_res_func *func = res->func; 1309 const struct vmw_res_func *func = res->func;