diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-08-29 04:27:56 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-08-29 09:37:41 -0400 |
commit | 77953bd136d2a70bca2dc93b3ccda07a2b37076f (patch) | |
tree | 46015885f617a683e72d12f332782181b03395b0 | |
parent | 59e71ee746a37fe077b73cecf189de1d27efd6eb (diff) |
drm: Unify handling of blob and object properties
They work exactly the same now, after the refcounting unification a bit
ago. The only reason they're distinct is backwards compat with existing
userspace.
Cc: Daniel Stone <daniels@collabora.com>
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-8-daniel.vetter@ffwll.ch
-rw-r--r-- | drivers/gpu/drm/drm_property.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index 162cc9032ae5..b5521f705b1c 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c | |||
@@ -911,20 +911,8 @@ bool drm_property_change_valid_get(struct drm_property *property, | |||
911 | for (i = 0; i < property->num_values; i++) | 911 | for (i = 0; i < property->num_values; i++) |
912 | valid_mask |= (1ULL << property->values[i]); | 912 | valid_mask |= (1ULL << property->values[i]); |
913 | return !(value & ~valid_mask); | 913 | return !(value & ~valid_mask); |
914 | } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) { | 914 | } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB) || |
915 | struct drm_property_blob *blob; | 915 | drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) { |
916 | |||
917 | if (value == 0) | ||
918 | return true; | ||
919 | |||
920 | blob = drm_property_lookup_blob(property->dev, value); | ||
921 | if (blob) { | ||
922 | *ref = &blob->base; | ||
923 | return true; | ||
924 | } else { | ||
925 | return false; | ||
926 | } | ||
927 | } else if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) { | ||
928 | /* a zero value for an object property translates to null: */ | 916 | /* a zero value for an object property translates to null: */ |
929 | if (value == 0) | 917 | if (value == 0) |
930 | return true; | 918 | return true; |
@@ -941,13 +929,12 @@ bool drm_property_change_valid_get(struct drm_property *property, | |||
941 | } | 929 | } |
942 | 930 | ||
943 | void drm_property_change_valid_put(struct drm_property *property, | 931 | void drm_property_change_valid_put(struct drm_property *property, |
944 | struct drm_mode_object *ref) | 932 | struct drm_mode_object *ref) |
945 | { | 933 | { |
946 | if (!ref) | 934 | if (!ref) |
947 | return; | 935 | return; |
948 | 936 | ||
949 | if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) { | 937 | if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT) || |
938 | drm_property_type_is(property, DRM_MODE_PROP_BLOB)) | ||
950 | drm_mode_object_unreference(ref); | 939 | drm_mode_object_unreference(ref); |
951 | } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) | ||
952 | drm_property_unreference_blob(obj_to_blob(ref)); | ||
953 | } | 940 | } |