Skip to content

Commit

Permalink
drm: Replace drm_modeset_lock/unlock_all with DRM_MODESET_LOCK_ALL_* …
Browse files Browse the repository at this point in the history
…helpers

As suggested by the TODO list for the kernel DRM subsystem, replace
the deprecated functions that take/drop modeset locks with new helpers.

Signed-off-by: Michal Orzel <michalorzel.eng@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1588093804-30446-1-git-send-email-michalorzel.eng@gmail.com
  • Loading branch information
Michal Orzel authored and Daniel Vetter committed May 5, 2020
1 parent 8976eee commit 9bcaa3f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/gpu/drm/drm_mode_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,13 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
{
struct drm_mode_obj_get_properties *arg = data;
struct drm_mode_object *obj;
struct drm_modeset_acquire_ctx ctx;
int ret = 0;

if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EOPNOTSUPP;

drm_modeset_lock_all(dev);
DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);

obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
if (!obj) {
Expand All @@ -427,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
out_unref:
drm_mode_object_put(obj);
out:
drm_modeset_unlock_all(dev);
DRM_MODESET_LOCK_ALL_END(ctx, ret);
return ret;
}

Expand All @@ -449,12 +450,13 @@ static int set_property_legacy(struct drm_mode_object *obj,
{
struct drm_device *dev = prop->dev;
struct drm_mode_object *ref;
struct drm_modeset_acquire_ctx ctx;
int ret = -EINVAL;

if (!drm_property_change_valid_get(prop, prop_value, &ref))
return -EINVAL;

drm_modeset_lock_all(dev);
DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
switch (obj->type) {
case DRM_MODE_OBJECT_CONNECTOR:
ret = drm_connector_set_obj_prop(obj, prop, prop_value);
Expand All @@ -468,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
break;
}
drm_property_change_valid_put(prop, ref);
drm_modeset_unlock_all(dev);
DRM_MODESET_LOCK_ALL_END(ctx, ret);

return ret;
}
Expand Down

0 comments on commit 9bcaa3f

Please sign in to comment.