Commit 661a3755 authored by Daniel Vetter's avatar Daniel Vetter

drm: Fix locking cargo-cult in encoder/plane init/cleanup

Encoders&planes can't be hotplugged, we dont need locking for this
since it's all single-threaded driver setup/teardown code. CRTCs
already don't grab locks.

While at it I noticed that plane's are missing the
drm_modeset_lock_fini() call, so add it.
Reviewed-by: default avatarFrank Binns <frank.binns@imgtec.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161129094538.9650-1-daniel.vetter@ffwll.ch
parent b07c4254
...@@ -110,11 +110,9 @@ int drm_encoder_init(struct drm_device *dev, ...@@ -110,11 +110,9 @@ int drm_encoder_init(struct drm_device *dev,
{ {
int ret; int ret;
drm_modeset_lock_all(dev);
ret = drm_mode_object_get(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER); ret = drm_mode_object_get(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER);
if (ret) if (ret)
goto out_unlock; return ret;
encoder->dev = dev; encoder->dev = dev;
encoder->encoder_type = encoder_type; encoder->encoder_type = encoder_type;
...@@ -142,9 +140,6 @@ int drm_encoder_init(struct drm_device *dev, ...@@ -142,9 +140,6 @@ int drm_encoder_init(struct drm_device *dev,
if (ret) if (ret)
drm_mode_object_unregister(dev, &encoder->base); drm_mode_object_unregister(dev, &encoder->base);
out_unlock:
drm_modeset_unlock_all(dev);
return ret; return ret;
} }
EXPORT_SYMBOL(drm_encoder_init); EXPORT_SYMBOL(drm_encoder_init);
...@@ -164,12 +159,10 @@ void drm_encoder_cleanup(struct drm_encoder *encoder) ...@@ -164,12 +159,10 @@ void drm_encoder_cleanup(struct drm_encoder *encoder)
* the indices on the drm_encoder after us in the encoder_list. * the indices on the drm_encoder after us in the encoder_list.
*/ */
drm_modeset_lock_all(dev);
drm_mode_object_unregister(dev, &encoder->base); drm_mode_object_unregister(dev, &encoder->base);
kfree(encoder->name); kfree(encoder->name);
list_del(&encoder->head); list_del(&encoder->head);
dev->mode_config.num_encoder--; dev->mode_config.num_encoder--;
drm_modeset_unlock_all(dev);
memset(encoder, 0, sizeof(*encoder)); memset(encoder, 0, sizeof(*encoder));
} }
......
...@@ -221,7 +221,8 @@ void drm_plane_cleanup(struct drm_plane *plane) ...@@ -221,7 +221,8 @@ void drm_plane_cleanup(struct drm_plane *plane)
{ {
struct drm_device *dev = plane->dev; struct drm_device *dev = plane->dev;
drm_modeset_lock_all(dev); drm_modeset_lock_fini(&plane->mutex);
kfree(plane->format_types); kfree(plane->format_types);
drm_mode_object_unregister(dev, &plane->base); drm_mode_object_unregister(dev, &plane->base);
...@@ -236,7 +237,6 @@ void drm_plane_cleanup(struct drm_plane *plane) ...@@ -236,7 +237,6 @@ void drm_plane_cleanup(struct drm_plane *plane)
dev->mode_config.num_total_plane--; dev->mode_config.num_total_plane--;
if (plane->type == DRM_PLANE_TYPE_OVERLAY) if (plane->type == DRM_PLANE_TYPE_OVERLAY)
dev->mode_config.num_overlay_plane--; dev->mode_config.num_overlay_plane--;
drm_modeset_unlock_all(dev);
WARN_ON(plane->state && !plane->funcs->atomic_destroy_state); WARN_ON(plane->state && !plane->funcs->atomic_destroy_state);
if (plane->state && plane->funcs->atomic_destroy_state) if (plane->state && plane->funcs->atomic_destroy_state)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment