aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_stub.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-10-02 05:23:38 -0400
committerDave Airlie <airlied@redhat.com>2013-10-09 01:55:27 -0400
commitc3a49737ef7db0bdd4fcf6cf0b7140a883e32b2a (patch)
tree94ce7f5c10bcc289b42d58e57462ad56aaa4e2fe /drivers/gpu/drm/drm_stub.c
parent0dc8fe5985e01f238e7dc64ff1733cc0291811e8 (diff)
drm: move device unregistration into drm_dev_unregister()
Analog to drm_dev_register(), we now provide drm_dev_unregister() which does the reverse. drm_dev_put() is still in place and combines the calls to drm_dev_unregister() and drm_dev_free() so buses don't have to change. *_get() and *_put() are used for reference-counting in the kernel. However, drm_dev_put() definitely does not do any kind of ref-counting. Hence, use the more appropriate *_register(), *_unregister(), *_alloc() and *_free() names. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_stub.c')
-rw-r--r--drivers/gpu/drm/drm_stub.c61
1 files changed, 36 insertions, 25 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 3b5b07482de8..2badef766d20 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -363,8 +363,6 @@ static void drm_unplug_minor(struct drm_minor *minor)
363 */ 363 */
364void drm_put_dev(struct drm_device *dev) 364void drm_put_dev(struct drm_device *dev)
365{ 365{
366 struct drm_map_list *r_list, *list_temp;
367
368 DRM_DEBUG("\n"); 366 DRM_DEBUG("\n");
369 367
370 if (!dev) { 368 if (!dev) {
@@ -372,29 +370,7 @@ void drm_put_dev(struct drm_device *dev)
372 return; 370 return;
373 } 371 }
374 372
375 drm_lastclose(dev); 373 drm_dev_unregister(dev);
376
377 if (dev->driver->unload)
378 dev->driver->unload(dev);
379
380 if (dev->driver->bus->agp_destroy)
381 dev->driver->bus->agp_destroy(dev);
382
383 drm_vblank_cleanup(dev);
384
385 list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head)
386 drm_rmmap(dev, r_list->map);
387
388 if (drm_core_check_feature(dev, DRIVER_MODESET))
389 drm_put_minor(&dev->control);
390
391 if (dev->render)
392 drm_put_minor(&dev->render);
393
394 drm_put_minor(&dev->primary);
395
396 list_del(&dev->driver_item);
397
398 drm_dev_free(dev); 374 drm_dev_free(dev);
399} 375}
400EXPORT_SYMBOL(drm_put_dev); 376EXPORT_SYMBOL(drm_put_dev);
@@ -595,3 +571,38 @@ out_unlock:
595 return ret; 571 return ret;
596} 572}
597EXPORT_SYMBOL(drm_dev_register); 573EXPORT_SYMBOL(drm_dev_register);
574
575/**
576 * drm_dev_unregister - Unregister DRM device
577 * @dev: Device to unregister
578 *
579 * Unregister the DRM device from the system. This does the reverse of
580 * drm_dev_register() but does not deallocate the device. The caller must call
581 * drm_dev_free() to free all resources.
582 */
583void drm_dev_unregister(struct drm_device *dev)
584{
585 struct drm_map_list *r_list, *list_temp;
586
587 drm_lastclose(dev);
588
589 if (dev->driver->unload)
590 dev->driver->unload(dev);
591
592 if (dev->driver->bus->agp_destroy)
593 dev->driver->bus->agp_destroy(dev);
594
595 drm_vblank_cleanup(dev);
596
597 list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head)
598 drm_rmmap(dev, r_list->map);
599
600 if (dev->control)
601 drm_put_minor(&dev->control);
602 if (dev->render)
603 drm_put_minor(&dev->render);
604 drm_put_minor(&dev->primary);
605
606 list_del(&dev->driver_item);
607}
608EXPORT_SYMBOL(drm_dev_unregister);