From patchwork Fri Jan 31 19:10:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sagar.a.kamble@intel.com X-Patchwork-Id: 3563341 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EFDBDC02DC for ; Fri, 31 Jan 2014 20:02:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C4F72024F for ; Fri, 31 Jan 2014 20:02:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 33F002024D for ; Fri, 31 Jan 2014 20:02:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0423E106B82; Fri, 31 Jan 2014 12:02:50 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org 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) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 31 Jan 2014 11:10:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,759,1384329600"; d="scan'208";a="447795440" Received: from sagar-desktop.iind.intel.com ([10.223.82.31]) by orsmga001.jf.intel.com with ESMTP; 31 Jan 2014 11:10:38 -0800 From: sagar.a.kamble@intel.com To: intel-gfx@lists.freedesktop.org Date: Sat, 1 Feb 2014 00:40:47 +0530 Message-Id: <1391195447-8744-12-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.8.5 In-Reply-To: <1391195447-8744-1-git-send-email-sagar.a.kamble@intel.com> References: <1391195447-8744-1-git-send-email-sagar.a.kamble@intel.com> Cc: Sagar Kamble Subject: [Intel-gfx] [PATCH 11/11] drm: Set property to return invalid for unsupported arguments for bitmask property X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;