From patchwork Wed Jan 29 14:01:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 3551261 Return-Path: X-Original-To: patchwork-dri-devel@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 5F3A59F381 for ; Wed, 29 Jan 2014 14:03:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 63F9020125 for ; Wed, 29 Jan 2014 14:03:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E19902018E for ; Wed, 29 Jan 2014 14:03:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF610436FE; Wed, 29 Jan 2014 06:03:06 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ea0-f180.google.com (mail-ea0-f180.google.com [209.85.215.180]) by gabe.freedesktop.org (Postfix) with ESMTP id 7FEDC436FE for ; Wed, 29 Jan 2014 06:02:22 -0800 (PST) Received: by mail-ea0-f180.google.com with SMTP id o10so929320eaj.25 for ; Wed, 29 Jan 2014 06:02:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=t1/smW8FINtgkzQNrr56M0LpN0pCI6dnUHvbOINKGyM=; b=oBgQF668hYqLbaM22L85N50sIbjhoblkeCmfeKZJ4IGdnkHaTldRngl5KdMq2uBsGG m7W4k0oa4Cgz9qJoB/F9G38OIk5D3cT1zjxAr/l+hAXUXAINwDoDaGS2Dh1TYs4joZzF n8Wcs7qb3wVYL0nZqALi/jlwapB4cBUgDqGL83N5DXPso5QF/byVUlTmIgiuoYIL3oLp LuIyXIgA5xjkp7MIU0DUQx9ZHvEuOWQy3tcuPCdfpD0WeN2+vnGeFJU6Pnh3RuktoR1M i8mUB/AXhzpdEtfVF0PX9B/ssksRaQizd2YIJ8z8xCfAVj9jkU8/QhfA2CTOIdhBx+VC q70Q== X-Received: by 10.15.52.194 with SMTP id p42mr9791268eew.11.1391004141503; Wed, 29 Jan 2014 06:02:21 -0800 (PST) Received: from david-ub.localdomain (stgt-5f71657e.pool.mediaWays.net. [95.113.101.126]) by mx.google.com with ESMTPSA id o13sm9094881eex.19.2014.01.29.06.02.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Jan 2014 06:02:20 -0800 (PST) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH 04/13] drm: turn DRM_MINOR_* into enum Date: Wed, 29 Jan 2014 15:01:51 +0100 Message-Id: <1391004120-687-5-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1391004120-687-1-git-send-email-dh.herrmann@gmail.com> References: <1391004120-687-1-git-send-email-dh.herrmann@gmail.com> Cc: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Use enum for DRM_MINOR_* constants to avoid hard-coding the IDs. Furthermore, add a DRM_MINOR_CNT so we can perform range-checks in follow-ups. This changes the IDs of the minor-types by -1, but they're not used as indices so this is fine. Signed-off-by: David Herrmann --- include/drm/drmP.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 89b9d58..c3aaf2d 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1005,9 +1005,12 @@ struct drm_driver { struct list_head legacy_dev_list; }; -#define DRM_MINOR_LEGACY 1 -#define DRM_MINOR_CONTROL 2 -#define DRM_MINOR_RENDER 3 +enum drm_minor_type { + DRM_MINOR_LEGACY, + DRM_MINOR_CONTROL, + DRM_MINOR_RENDER, + DRM_MINOR_CNT, +}; /** * Info file list entry. This structure represents a debugfs or proc file to