From patchwork Thu Feb 6 15:04:52 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: 3596671 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 BF69AC02E3 for ; Thu, 6 Feb 2014 15:06:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EE674201B4 for ; Thu, 6 Feb 2014 15:06:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2A72F20181 for ; Thu, 6 Feb 2014 15:06:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 85667FB8CD; Thu, 6 Feb 2014 07:06:04 -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 C0218FB8D9 for ; Thu, 6 Feb 2014 07:06:01 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 06 Feb 2014 07:05:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,793,1384329600"; d="scan'208";a="450771575" Received: from sagar-desktop.iind.intel.com ([10.223.82.31]) by orsmga001.jf.intel.com with ESMTP; 06 Feb 2014 07:05:55 -0800 From: sagar.a.kamble@intel.com To: intel-gfx@lists.freedesktop.org Date: Thu, 6 Feb 2014 20:34:52 +0530 Message-Id: <1391699093-12625-12-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.8.5 In-Reply-To: <1391699093-12625-1-git-send-email-sagar.a.kamble@intel.com> References: <1391699093-12625-1-git-send-email-sagar.a.kamble@intel.com> Cc: Sagar Kamble Subject: [Intel-gfx] [PATCH v3 11/12] 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.7 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;