From patchwork Fri Feb 7 13:45:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: sagar.a.kamble@intel.com X-Patchwork-Id: 3605101 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 323619F2E9 for ; Fri, 7 Feb 2014 13:46:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6B07A200F3 for ; Fri, 7 Feb 2014 13:46:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 839A820125 for ; Fri, 7 Feb 2014 13:46:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 237F5105758; Fri, 7 Feb 2014 05:46:00 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 83E0710575E; Fri, 7 Feb 2014 05:45:58 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 07 Feb 2014 05:41:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,800,1384329600"; d="scan'208";a="479633076" Received: from sagar-desktop.iind.intel.com ([10.223.82.31]) by orsmga002.jf.intel.com with ESMTP; 07 Feb 2014 05:45:50 -0800 From: sagar.a.kamble@intel.com To: intel-gfx@lists.freedesktop.org Date: Fri, 7 Feb 2014 19:15:07 +0530 Message-Id: <1391780716-21896-3-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.8.5 In-Reply-To: <1391780716-21896-1-git-send-email-sagar.a.kamble@intel.com> References: <1391780716-21896-1-git-send-email-sagar.a.kamble@intel.com> MIME-Version: 1.0 Cc: airlied@linux.ie, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, tomi.valkeinen@ti.com, archit@ti.com, dri-devel@lists.freedesktop.org, gregkh@linuxfoundation.org, joe@perches.com, airlied@redhat.com Subject: [Intel-gfx] [PATCH v4 02/11] drm: Add support_bits parameter to drm_property_create_bitmask() 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: , 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: Ville Syrjälä Make drm_property_create_bitmask() a bit more generic by allowing the caller to specify which bits are in fact supported. This allows multiple callers to use the same enum list, but still create different versions of the same property with different list of supported bits. Signed-off-by: Ville Syrjälä Tested-by: Sagar Kamble Reviewed-by: Rob Clark --- drivers/gpu/drm/drm_crtc.c | 6 +++++- include/drm/drm_crtc.h | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 3b7d32d..628d3d3 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -2906,7 +2906,8 @@ EXPORT_SYMBOL(drm_property_create_enum); struct drm_property *drm_property_create_bitmask(struct drm_device *dev, int flags, const char *name, const struct drm_prop_enum_list *props, - int num_values) + int num_values, + unsigned int supported_bits) { struct drm_property *property; int i, ret; @@ -2918,6 +2919,9 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev, return NULL; for (i = 0; i < num_values; i++) { + if (!(supported_bits & (1 << i))) + continue; + ret = drm_property_add_enum(property, i, props[i].type, props[i].name); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index d5c46c1..41b86d2 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1070,7 +1070,8 @@ extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int struct drm_property *drm_property_create_bitmask(struct drm_device *dev, int flags, const char *name, const struct drm_prop_enum_list *props, - int num_values); + int num_values, + unsigned int supported_bits); struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, const char *name, uint64_t min, uint64_t max);