diff options
Diffstat (limited to 'drivers/char/drm/drm_context.c')
-rw-r--r-- | drivers/char/drm/drm_context.c | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c index 61ad986baa8d..4037a3602f1e 100644 --- a/drivers/char/drm/drm_context.c +++ b/drivers/char/drm/drm_context.c | |||
@@ -131,7 +131,7 @@ void drm_ctxbitmap_cleanup(struct drm_device * dev) | |||
131 | * Get per-context SAREA. | 131 | * Get per-context SAREA. |
132 | * | 132 | * |
133 | * \param inode device inode. | 133 | * \param inode device inode. |
134 | * \param filp file pointer. | 134 | * \param file_priv DRM file private. |
135 | * \param cmd command. | 135 | * \param cmd command. |
136 | * \param arg user argument pointing to a drm_ctx_priv_map structure. | 136 | * \param arg user argument pointing to a drm_ctx_priv_map structure. |
137 | * \return zero on success or a negative number on failure. | 137 | * \return zero on success or a negative number on failure. |
@@ -139,11 +139,10 @@ void drm_ctxbitmap_cleanup(struct drm_device * dev) | |||
139 | * Gets the map from drm_device::ctx_idr with the handle specified and | 139 | * Gets the map from drm_device::ctx_idr with the handle specified and |
140 | * returns its handle. | 140 | * returns its handle. |
141 | */ | 141 | */ |
142 | int drm_getsareactx(struct inode *inode, struct file *filp, | 142 | int drm_getsareactx(struct inode *inode, struct drm_file *file_priv, |
143 | unsigned int cmd, unsigned long arg) | 143 | unsigned int cmd, unsigned long arg) |
144 | { | 144 | { |
145 | struct drm_file *priv = filp->private_data; | 145 | struct drm_device *dev = file_priv->head->dev; |
146 | struct drm_device *dev = priv->head->dev; | ||
147 | struct drm_ctx_priv_map __user *argp = (void __user *)arg; | 146 | struct drm_ctx_priv_map __user *argp = (void __user *)arg; |
148 | struct drm_ctx_priv_map request; | 147 | struct drm_ctx_priv_map request; |
149 | struct drm_map *map; | 148 | struct drm_map *map; |
@@ -182,7 +181,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp, | |||
182 | * Set per-context SAREA. | 181 | * Set per-context SAREA. |
183 | * | 182 | * |
184 | * \param inode device inode. | 183 | * \param inode device inode. |
185 | * \param filp file pointer. | 184 | * \param file_priv DRM file private. |
186 | * \param cmd command. | 185 | * \param cmd command. |
187 | * \param arg user argument pointing to a drm_ctx_priv_map structure. | 186 | * \param arg user argument pointing to a drm_ctx_priv_map structure. |
188 | * \return zero on success or a negative number on failure. | 187 | * \return zero on success or a negative number on failure. |
@@ -190,11 +189,10 @@ int drm_getsareactx(struct inode *inode, struct file *filp, | |||
190 | * Searches the mapping specified in \p arg and update the entry in | 189 | * Searches the mapping specified in \p arg and update the entry in |
191 | * drm_device::ctx_idr with it. | 190 | * drm_device::ctx_idr with it. |
192 | */ | 191 | */ |
193 | int drm_setsareactx(struct inode *inode, struct file *filp, | 192 | int drm_setsareactx(struct inode *inode, struct drm_file *file_priv, |
194 | unsigned int cmd, unsigned long arg) | 193 | unsigned int cmd, unsigned long arg) |
195 | { | 194 | { |
196 | struct drm_file *priv = filp->private_data; | 195 | struct drm_device *dev = file_priv->head->dev; |
197 | struct drm_device *dev = priv->head->dev; | ||
198 | struct drm_ctx_priv_map request; | 196 | struct drm_ctx_priv_map request; |
199 | struct drm_map *map = NULL; | 197 | struct drm_map *map = NULL; |
200 | struct drm_map_list *r_list = NULL; | 198 | struct drm_map_list *r_list = NULL; |
@@ -292,12 +290,12 @@ static int drm_context_switch_complete(struct drm_device * dev, int new) | |||
292 | * Reserve contexts. | 290 | * Reserve contexts. |
293 | * | 291 | * |
294 | * \param inode device inode. | 292 | * \param inode device inode. |
295 | * \param filp file pointer. | 293 | * \param file_priv DRM file private. |
296 | * \param cmd command. | 294 | * \param cmd command. |
297 | * \param arg user argument pointing to a drm_ctx_res structure. | 295 | * \param arg user argument pointing to a drm_ctx_res structure. |
298 | * \return zero on success or a negative number on failure. | 296 | * \return zero on success or a negative number on failure. |
299 | */ | 297 | */ |
300 | int drm_resctx(struct inode *inode, struct file *filp, | 298 | int drm_resctx(struct inode *inode, struct drm_file *file_priv, |
301 | unsigned int cmd, unsigned long arg) | 299 | unsigned int cmd, unsigned long arg) |
302 | { | 300 | { |
303 | struct drm_ctx_res res; | 301 | struct drm_ctx_res res; |
@@ -327,18 +325,17 @@ int drm_resctx(struct inode *inode, struct file *filp, | |||
327 | * Add context. | 325 | * Add context. |
328 | * | 326 | * |
329 | * \param inode device inode. | 327 | * \param inode device inode. |
330 | * \param filp file pointer. | 328 | * \param file_priv DRM file private. |
331 | * \param cmd command. | 329 | * \param cmd command. |
332 | * \param arg user argument pointing to a drm_ctx structure. | 330 | * \param arg user argument pointing to a drm_ctx structure. |
333 | * \return zero on success or a negative number on failure. | 331 | * \return zero on success or a negative number on failure. |
334 | * | 332 | * |
335 | * Get a new handle for the context and copy to userspace. | 333 | * Get a new handle for the context and copy to userspace. |
336 | */ | 334 | */ |
337 | int drm_addctx(struct inode *inode, struct file *filp, | 335 | int drm_addctx(struct inode *inode, struct drm_file *file_priv, |
338 | unsigned int cmd, unsigned long arg) | 336 | unsigned int cmd, unsigned long arg) |
339 | { | 337 | { |
340 | struct drm_file *priv = filp->private_data; | 338 | struct drm_device *dev = file_priv->head->dev; |
341 | struct drm_device *dev = priv->head->dev; | ||
342 | struct drm_ctx_list *ctx_entry; | 339 | struct drm_ctx_list *ctx_entry; |
343 | struct drm_ctx __user *argp = (void __user *)arg; | 340 | struct drm_ctx __user *argp = (void __user *)arg; |
344 | struct drm_ctx ctx; | 341 | struct drm_ctx ctx; |
@@ -374,7 +371,7 @@ int drm_addctx(struct inode *inode, struct file *filp, | |||
374 | 371 | ||
375 | INIT_LIST_HEAD(&ctx_entry->head); | 372 | INIT_LIST_HEAD(&ctx_entry->head); |
376 | ctx_entry->handle = ctx.handle; | 373 | ctx_entry->handle = ctx.handle; |
377 | ctx_entry->tag = priv; | 374 | ctx_entry->tag = file_priv; |
378 | 375 | ||
379 | mutex_lock(&dev->ctxlist_mutex); | 376 | mutex_lock(&dev->ctxlist_mutex); |
380 | list_add(&ctx_entry->head, &dev->ctxlist); | 377 | list_add(&ctx_entry->head, &dev->ctxlist); |
@@ -386,7 +383,7 @@ int drm_addctx(struct inode *inode, struct file *filp, | |||
386 | return 0; | 383 | return 0; |
387 | } | 384 | } |
388 | 385 | ||
389 | int drm_modctx(struct inode *inode, struct file *filp, | 386 | int drm_modctx(struct inode *inode, struct drm_file *file_priv, |
390 | unsigned int cmd, unsigned long arg) | 387 | unsigned int cmd, unsigned long arg) |
391 | { | 388 | { |
392 | /* This does nothing */ | 389 | /* This does nothing */ |
@@ -397,12 +394,12 @@ int drm_modctx(struct inode *inode, struct file *filp, | |||
397 | * Get context. | 394 | * Get context. |
398 | * | 395 | * |
399 | * \param inode device inode. | 396 | * \param inode device inode. |
400 | * \param filp file pointer. | 397 | * \param file_priv DRM file private. |
401 | * \param cmd command. | 398 | * \param cmd command. |
402 | * \param arg user argument pointing to a drm_ctx structure. | 399 | * \param arg user argument pointing to a drm_ctx structure. |
403 | * \return zero on success or a negative number on failure. | 400 | * \return zero on success or a negative number on failure. |
404 | */ | 401 | */ |
405 | int drm_getctx(struct inode *inode, struct file *filp, | 402 | int drm_getctx(struct inode *inode, struct drm_file *file_priv, |
406 | unsigned int cmd, unsigned long arg) | 403 | unsigned int cmd, unsigned long arg) |
407 | { | 404 | { |
408 | struct drm_ctx __user *argp = (void __user *)arg; | 405 | struct drm_ctx __user *argp = (void __user *)arg; |
@@ -423,18 +420,17 @@ int drm_getctx(struct inode *inode, struct file *filp, | |||
423 | * Switch context. | 420 | * Switch context. |
424 | * | 421 | * |
425 | * \param inode device inode. | 422 | * \param inode device inode. |
426 | * \param filp file pointer. | 423 | * \param file_priv DRM file private. |
427 | * \param cmd command. | 424 | * \param cmd command. |
428 | * \param arg user argument pointing to a drm_ctx structure. | 425 | * \param arg user argument pointing to a drm_ctx structure. |
429 | * \return zero on success or a negative number on failure. | 426 | * \return zero on success or a negative number on failure. |
430 | * | 427 | * |
431 | * Calls context_switch(). | 428 | * Calls context_switch(). |
432 | */ | 429 | */ |
433 | int drm_switchctx(struct inode *inode, struct file *filp, | 430 | int drm_switchctx(struct inode *inode, struct drm_file *file_priv, |
434 | unsigned int cmd, unsigned long arg) | 431 | unsigned int cmd, unsigned long arg) |
435 | { | 432 | { |
436 | struct drm_file *priv = filp->private_data; | 433 | struct drm_device *dev = file_priv->head->dev; |
437 | struct drm_device *dev = priv->head->dev; | ||
438 | struct drm_ctx ctx; | 434 | struct drm_ctx ctx; |
439 | 435 | ||
440 | if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx))) | 436 | if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx))) |
@@ -448,18 +444,17 @@ int drm_switchctx(struct inode *inode, struct file *filp, | |||
448 | * New context. | 444 | * New context. |
449 | * | 445 | * |
450 | * \param inode device inode. | 446 | * \param inode device inode. |
451 | * \param filp file pointer. | 447 | * \param file_priv DRM file private. |
452 | * \param cmd command. | 448 | * \param cmd command. |
453 | * \param arg user argument pointing to a drm_ctx structure. | 449 | * \param arg user argument pointing to a drm_ctx structure. |
454 | * \return zero on success or a negative number on failure. | 450 | * \return zero on success or a negative number on failure. |
455 | * | 451 | * |
456 | * Calls context_switch_complete(). | 452 | * Calls context_switch_complete(). |
457 | */ | 453 | */ |
458 | int drm_newctx(struct inode *inode, struct file *filp, | 454 | int drm_newctx(struct inode *inode, struct drm_file *file_priv, |
459 | unsigned int cmd, unsigned long arg) | 455 | unsigned int cmd, unsigned long arg) |
460 | { | 456 | { |
461 | struct drm_file *priv = filp->private_data; | 457 | struct drm_device *dev = file_priv->head->dev; |
462 | struct drm_device *dev = priv->head->dev; | ||
463 | struct drm_ctx ctx; | 458 | struct drm_ctx ctx; |
464 | 459 | ||
465 | if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx))) | 460 | if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx))) |
@@ -475,18 +470,17 @@ int drm_newctx(struct inode *inode, struct file *filp, | |||
475 | * Remove context. | 470 | * Remove context. |
476 | * | 471 | * |
477 | * \param inode device inode. | 472 | * \param inode device inode. |
478 | * \param filp file pointer. | 473 | * \param file_priv DRM file private. |
479 | * \param cmd command. | 474 | * \param cmd command. |
480 | * \param arg user argument pointing to a drm_ctx structure. | 475 | * \param arg user argument pointing to a drm_ctx structure. |
481 | * \return zero on success or a negative number on failure. | 476 | * \return zero on success or a negative number on failure. |
482 | * | 477 | * |
483 | * If not the special kernel context, calls ctxbitmap_free() to free the specified context. | 478 | * If not the special kernel context, calls ctxbitmap_free() to free the specified context. |
484 | */ | 479 | */ |
485 | int drm_rmctx(struct inode *inode, struct file *filp, | 480 | int drm_rmctx(struct inode *inode, struct drm_file *file_priv, |
486 | unsigned int cmd, unsigned long arg) | 481 | unsigned int cmd, unsigned long arg) |
487 | { | 482 | { |
488 | struct drm_file *priv = filp->private_data; | 483 | struct drm_device *dev = file_priv->head->dev; |
489 | struct drm_device *dev = priv->head->dev; | ||
490 | struct drm_ctx ctx; | 484 | struct drm_ctx ctx; |
491 | 485 | ||
492 | if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx))) | 486 | if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx))) |
@@ -494,7 +488,7 @@ int drm_rmctx(struct inode *inode, struct file *filp, | |||
494 | 488 | ||
495 | DRM_DEBUG("%d\n", ctx.handle); | 489 | DRM_DEBUG("%d\n", ctx.handle); |
496 | if (ctx.handle == DRM_KERNEL_CONTEXT + 1) { | 490 | if (ctx.handle == DRM_KERNEL_CONTEXT + 1) { |
497 | priv->remove_auth_on_close = 1; | 491 | file_priv->remove_auth_on_close = 1; |
498 | } | 492 | } |
499 | if (ctx.handle != DRM_KERNEL_CONTEXT) { | 493 | if (ctx.handle != DRM_KERNEL_CONTEXT) { |
500 | if (dev->driver->context_dtor) | 494 | if (dev->driver->context_dtor) |