[PATCH 03/13] drm: get rid of direct property value access
Daniel Vetter
daniel at ffwll.ch
Wed Dec 17 05:37:02 PST 2014
On Tue, Dec 16, 2014 at 06:05:31PM -0500, Rob Clark wrote:
> 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: Rob Clark <robdclark at gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/drm_crtc.c | 19 +++++++++++++++----
> include/drm/drm_crtc.h | 3 +++
> 2 files changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 2780a08..481bb25 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -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);
> for (i = 0; i < connector->properties.count; 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)) {
> ret = -EFAULT;
> goto out;
> }
> - if (put_user(connector->properties.values[i],
> - prop_values + copied)) {
> + if (put_user(val, prop_values + copied)) {
> ret = -EFAULT;
> goto out;
> }
> @@ -4413,12 +4418,18 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
> (arg->prop_values_ptr);
> for (i = 0; i < props_count; 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)) {
> ret = -EFAULT;
> goto out;
> }
> - if (put_user(obj->properties->values[i],
> - prop_values_ptr + copied)) {
> +
> + if (put_user(val, prop_values_ptr + copied)) {
> ret = -EFAULT;
> goto out;
> }
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 02758e8..61ab3e5 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -70,6 +70,9 @@ struct drm_object_properties {
> * dangling property pointers:
> */
> 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];
> };
>
> --
> 2.1.0
>
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the dri-devel
mailing list