Commit 22b8b13b authored by Rob Clark's avatar Rob Clark Committed by Daniel Vetter

drm: get rid of direct property value access

For atomic drivers, we won't use the values array but instead shunt
things off to obj->atomic_get_property().  So to simplify things make
all read/write of properties values go through the accessors.
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent b17cd757
...@@ -2106,12 +2106,17 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, ...@@ -2106,12 +2106,17 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
prop_values = (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr); prop_values = (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr);
for (i = 0; i < connector->properties.count; i++) { for (i = 0; i < connector->properties.count; i++) {
struct drm_property *prop = connector->properties.properties[i]; struct drm_property *prop = connector->properties.properties[i];
uint64_t val;
ret = drm_object_property_get_value(&connector->base, prop, &val);
if (ret)
goto out;
if (put_user(prop->base.id, prop_ptr + copied)) { if (put_user(prop->base.id, prop_ptr + copied)) {
ret = -EFAULT; ret = -EFAULT;
goto out; goto out;
} }
if (put_user(connector->properties.values[i], if (put_user(val, prop_values + copied)) {
prop_values + copied)) {
ret = -EFAULT; ret = -EFAULT;
goto out; goto out;
} }
...@@ -4413,12 +4418,18 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, ...@@ -4413,12 +4418,18 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
(arg->prop_values_ptr); (arg->prop_values_ptr);
for (i = 0; i < props_count; i++) { for (i = 0; i < props_count; i++) {
struct drm_property *prop = obj->properties->properties[i]; struct drm_property *prop = obj->properties->properties[i];
uint64_t val;
ret = drm_object_property_get_value(obj, prop, &val);
if (ret)
goto out;
if (put_user(prop->base.id, props_ptr + copied)) { if (put_user(prop->base.id, props_ptr + copied)) {
ret = -EFAULT; ret = -EFAULT;
goto out; goto out;
} }
if (put_user(obj->properties->values[i],
prop_values_ptr + copied)) { if (put_user(val, prop_values_ptr + copied)) {
ret = -EFAULT; ret = -EFAULT;
goto out; goto out;
} }
......
...@@ -70,6 +70,9 @@ struct drm_object_properties { ...@@ -70,6 +70,9 @@ struct drm_object_properties {
* dangling property pointers: * dangling property pointers:
*/ */
struct drm_property *properties[DRM_OBJECT_MAX_PROPERTY]; struct drm_property *properties[DRM_OBJECT_MAX_PROPERTY];
/* do not read/write values directly, but use drm_object_property_get_value()
* and drm_object_property_set_value():
*/
uint64_t values[DRM_OBJECT_MAX_PROPERTY]; uint64_t values[DRM_OBJECT_MAX_PROPERTY];
}; };
......
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