From: sagar.a.kamble@intel.com Subject: [PATCH 11/11] drm: Set property to return invalid for unsupported arguments for bitmask property Date: Sat, 1 Feb 2014 00:40:47 +0530 Message-ID: <1391195447-8744-12-git-send-email-sagar.a.kamble@intel.com> References: <1391195447-8744-1-git-send-email-sagar.a.kamble@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A5231062E8 for ; Fri, 31 Jan 2014 11:10:39 -0800 (PST) In-Reply-To: <1391195447-8744-1-git-send-email-sagar.a.kamble@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org Cc: Sagar Kamble List-Id: intel-gfx@lists.freedesktop.org From: Sagar Kamble DRM will not propagate the set_property call for bitmask drm properties if they are not supported by underlying driver. Signed-off-by: Sagar Kamble Tested-by: Sagar Kamble --- drivers/gpu/drm/drm_crtc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 4f5e408..4c92741 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -3420,6 +3420,8 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, struct drm_mode_object *arg_obj; struct drm_mode_object *prop_obj; struct drm_property *property; + struct drm_property_enum *prop_enum; + bool supported_val = false; int ret = -EINVAL; int i; @@ -3451,6 +3453,22 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, } property = obj_to_property(prop_obj); + if (property->flags | DRM_MODE_PROP_BITMASK) { + if (!list_empty(&property->enum_blob_list)) { + list_for_each_entry(prop_enum, + &property->enum_blob_list, head) { + if (BIT(prop_enum->value) == arg->value) { + supported_val = true; + break; + } + } + } + if (!supported_val) { + ret = -EINVAL; + goto out; + } + } + if (!drm_property_change_is_valid(property, arg->value)) goto out; -- 1.8.5