From patchwork Wed Dec 19 17:08:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Engestrom X-Patchwork-Id: 10737793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9163014E5 for ; Wed, 19 Dec 2018 17:09:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78A93297EB for ; Wed, 19 Dec 2018 17:09:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CDAA2B50A; Wed, 19 Dec 2018 17:09:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 23A3A297EB for ; Wed, 19 Dec 2018 17:09:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D70336F0E3; Wed, 19 Dec 2018 17:09:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4FC346F0E5 for ; Wed, 19 Dec 2018 17:09:22 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2018 09:09:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,373,1539673200"; d="scan'208";a="260775731" Received: from kszypryt-mobl.ger.corp.intel.com (HELO eengestr-dev.ger.corp.intel.com) ([10.251.83.167]) by orsmga004.jf.intel.com with ESMTP; 19 Dec 2018 09:09:19 -0800 From: Eric Engestrom To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 1/3] xf86drm: dedupe `#define`s Date: Wed, 19 Dec 2018 17:08:01 +0000 Message-Id: <20181219170803.23452-1-eric.engestrom@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Organization: Intel Corp UK X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Adapted from a local patch carried by DragonFlyBSD: https://github.com/DragonFlyBSD/DPorts/blob/bc056f88f7e4d468d8c9751f831a47b5ae1326e3/graphics/libdrm/files/patch-xf86drm.h Patch is sadly uncredited (a bot authored the commit), so I can't credit the author here either. Signed-off-by: Eric Engestrom --- xf86drm.c | 10 ---------- xf86drm.h | 16 ++++++++++------ 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index 377ddf917d2cb902899a..07425b19897d00a19e8a 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -71,16 +71,6 @@ #include "util_math.h" -#ifdef __OpenBSD__ -#define DRM_PRIMARY_MINOR_NAME "drm" -#define DRM_CONTROL_MINOR_NAME "drmC" -#define DRM_RENDER_MINOR_NAME "drmR" -#else -#define DRM_PRIMARY_MINOR_NAME "card" -#define DRM_CONTROL_MINOR_NAME "controlD" -#define DRM_RENDER_MINOR_NAME "renderD" -#endif - #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #define DRM_MAJOR 145 #endif diff --git a/xf86drm.h b/xf86drm.h index 7773d71a803084e86920..18668ff3d40d7db55c95 100644 --- a/xf86drm.h +++ b/xf86drm.h @@ -78,17 +78,21 @@ extern "C" { #ifdef __OpenBSD__ #define DRM_DIR_NAME "/dev" -#define DRM_DEV_NAME "%s/drm%d" -#define DRM_CONTROL_DEV_NAME "%s/drmC%d" -#define DRM_RENDER_DEV_NAME "%s/drmR%d" +#define DRM_PRIMARY_MINOR_NAME "drm" +#define DRM_CONTROL_MINOR_NAME "drmC" +#define DRM_RENDER_MINOR_NAME "drmR" #else #define DRM_DIR_NAME "/dev/dri" -#define DRM_DEV_NAME "%s/card%d" -#define DRM_CONTROL_DEV_NAME "%s/controlD%d" -#define DRM_RENDER_DEV_NAME "%s/renderD%d" +#define DRM_PRIMARY_MINOR_NAME "card" +#define DRM_CONTROL_MINOR_NAME "controlD" +#define DRM_RENDER_MINOR_NAME "renderD" #define DRM_PROC_NAME "/proc/dri/" /* For backward Linux compatibility */ #endif +#define DRM_DEV_NAME "%s/" DRM_PRIMARY_MINOR_NAME "%d" +#define DRM_CONTROL_DEV_NAME "%s/" DRM_CONTROL_MINOR_NAME "%d" +#define DRM_RENDER_DEV_NAME "%s/" DRM_RENDER_MINOR_NAME "%d" + #define DRM_ERR_NO_DEVICE (-1001) #define DRM_ERR_NO_ACCESS (-1002) #define DRM_ERR_NOT_ROOT (-1003)