Commit f094d881 authored by Daniel Vetter's avatar Daniel Vetter

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: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20160829082757.17913-4-daniel.vetter@ffwll.ch
parent 949619f3
...@@ -209,8 +209,6 @@ void drm_object_attach_property(struct drm_mode_object *obj, ...@@ -209,8 +209,6 @@ void drm_object_attach_property(struct drm_mode_object *obj,
obj->properties->properties[count] = property; obj->properties->properties[count] = property;
obj->properties->values[count] = init_val; obj->properties->values[count] = init_val;
obj->properties->count++; obj->properties->count++;
if (property->flags & DRM_MODE_PROP_ATOMIC)
obj->properties->atomic_count++;
} }
EXPORT_SYMBOL(drm_object_attach_property); EXPORT_SYMBOL(drm_object_attach_property);
...@@ -288,35 +286,30 @@ int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic, ...@@ -288,35 +286,30 @@ int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
uint64_t __user *prop_values, uint64_t __user *prop_values,
uint32_t *arg_count_props) uint32_t *arg_count_props)
{ {
int props_count; int i, ret, count;
int i, ret, copied;
props_count = obj->properties->count; for (i = 0, count = 0; i < obj->properties->count; i++) {
if (!atomic) struct drm_property *prop = obj->properties->properties[i];
props_count -= obj->properties->atomic_count; uint64_t val;
if ((*arg_count_props >= props_count) && props_count) { if ((prop->flags & DRM_MODE_PROP_ATOMIC) && !atomic)
for (i = 0, copied = 0; copied < props_count; i++) { continue;
struct drm_property *prop = obj->properties->properties[i];
uint64_t val;
if ((prop->flags & DRM_MODE_PROP_ATOMIC) && !atomic)
continue;
if (*arg_count_props > count) {
ret = drm_object_property_get_value(obj, prop, &val); ret = drm_object_property_get_value(obj, prop, &val);
if (ret) if (ret)
return ret; return ret;
if (put_user(prop->base.id, prop_ptr + copied)) if (put_user(prop->base.id, prop_ptr + count))
return -EFAULT; return -EFAULT;
if (put_user(val, prop_values + copied)) if (put_user(val, prop_values + count))
return -EFAULT; return -EFAULT;
copied++;
} }
count++;
} }
*arg_count_props = props_count; *arg_count_props = count;
return 0; return 0;
} }
......
...@@ -37,7 +37,7 @@ struct drm_mode_object { ...@@ -37,7 +37,7 @@ struct drm_mode_object {
#define DRM_OBJECT_MAX_PROPERTY 24 #define DRM_OBJECT_MAX_PROPERTY 24
struct drm_object_properties { struct drm_object_properties {
int count, atomic_count; int count;
/* NOTE: if we ever start dynamically destroying properties (ie. /* NOTE: if we ever start dynamically destroying properties (ie.
* not at drm_mode_config_cleanup() time), then we'd have to do * not at drm_mode_config_cleanup() time), then we'd have to do
* a better job of detaching property from mode objects to avoid * a better job of detaching property from mode objects to avoid
......
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