提交 8f6599da 编写于 作者: D David Herrmann 提交者: Dave Airlie

drm: delay minor destruction to drm_dev_free()

Instead of freeing minors in drm_dev_unregister(), we only unplug them and
delay the free to drm_dev_free(). Note that if drm_dev_register() has
never been called, minors are NULL and this has no effect.

This change is needed to allow early device unregistration. If we want to
call drm_dev_unregister() on live devices, we need to guarantee that
minors are still valid (but unplugged). This way, any open file can still
access file_priv->minor->dev to get the DRM device. However, the minor is
unplugged so no new users can occur.
Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 f67e946b
...@@ -487,6 +487,10 @@ EXPORT_SYMBOL(drm_dev_alloc); ...@@ -487,6 +487,10 @@ EXPORT_SYMBOL(drm_dev_alloc);
*/ */
void drm_dev_free(struct drm_device *dev) void drm_dev_free(struct drm_device *dev)
{ {
drm_put_minor(dev->control);
drm_put_minor(dev->render);
drm_put_minor(dev->primary);
if (dev->driver->driver_features & DRIVER_GEM) if (dev->driver->driver_features & DRIVER_GEM)
drm_gem_destroy(dev); drm_gem_destroy(dev);
...@@ -601,9 +605,9 @@ void drm_dev_unregister(struct drm_device *dev) ...@@ -601,9 +605,9 @@ void drm_dev_unregister(struct drm_device *dev)
list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head)
drm_rmmap(dev, r_list->map); drm_rmmap(dev, r_list->map);
drm_put_minor(dev->control); drm_unplug_minor(dev->control);
drm_put_minor(dev->render); drm_unplug_minor(dev->render);
drm_put_minor(dev->primary); drm_unplug_minor(dev->primary);
list_del(&dev->driver_item); list_del(&dev->driver_item);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册