diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-08-29 10:27:52 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-08-29 15:37:18 +0200 |
commit | f094d881954982b559e98e90aca1bf6f45141420 (patch) | |
tree | a1dcb754d2a2aa548d24fe4b22534e77d68e56fc /drivers/gpu/drm/drm_mode_object.c | |
parent | 949619f32eee37a6385de1e976523501c8256768 (diff) | |
download | op-kernel-dev-f094d881954982b559e98e90aca1bf6f45141420.zip op-kernel-dev-f094d881954982b559e98e90aca1bf6f45141420.tar.gz |
drm: Remove drm_mode_object->atomic_count
It's only used in drm_mode_object_get_properties, and we can compute
it there directly with a bit of code shuffling.
Reviewed-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20160829082757.17913-4-daniel.vetter@ffwll.ch
Diffstat (limited to 'drivers/gpu/drm/drm_mode_object.c')
-rw-r--r-- | drivers/gpu/drm/drm_mode_object.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c index cef9104..a92aeed 100644 --- a/drivers/gpu/drm/drm_mode_object.c +++ b/drivers/gpu/drm/drm_mode_object.c @@ -209,8 +209,6 @@ void drm_object_attach_property(struct drm_mode_object *obj, obj->properties->properties[count] = property; obj->properties->values[count] = init_val; obj->properties->count++; - if (property->flags & DRM_MODE_PROP_ATOMIC) - obj->properties->atomic_count++; } EXPORT_SYMBOL(drm_object_attach_property); @@ -288,35 +286,30 @@ int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic, uint64_t __user *prop_values, uint32_t *arg_count_props) { - int props_count; - int i, ret, copied; + int i, ret, count; - props_count = obj->properties->count; - if (!atomic) - props_count -= obj->properties->atomic_count; + for (i = 0, count = 0; i < obj->properties->count; i++) { + struct drm_property *prop = obj->properties->properties[i]; + uint64_t val; - if ((*arg_count_props >= props_count) && props_count) { - for (i = 0, copied = 0; copied < props_count; i++) { - struct drm_property *prop = obj->properties->properties[i]; - uint64_t val; - - if ((prop->flags & DRM_MODE_PROP_ATOMIC) && !atomic) - continue; + if ((prop->flags & DRM_MODE_PROP_ATOMIC) && !atomic) + continue; + if (*arg_count_props > count) { ret = drm_object_property_get_value(obj, prop, &val); if (ret) return ret; - if (put_user(prop->base.id, prop_ptr + copied)) + if (put_user(prop->base.id, prop_ptr + count)) return -EFAULT; - if (put_user(val, prop_values + copied)) + if (put_user(val, prop_values + count)) return -EFAULT; - - copied++; } + + count++; } - *arg_count_props = props_count; + *arg_count_props = count; return 0; } |