From patchwork Wed Sep 9 15:17:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 7147261 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B6C3C9F314 for ; Wed, 9 Sep 2015 15:13:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD46A209EC for ; Wed, 9 Sep 2015 15:13:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E389F209E8 for ; Wed, 9 Sep 2015 15:13:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B3BB6EC24; Wed, 9 Sep 2015 08:13:34 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id 340C86EC24 for ; Wed, 9 Sep 2015 08:13:33 -0700 (PDT) Received: by wicgb1 with SMTP id gb1so120608508wic.1 for ; Wed, 09 Sep 2015 08:13:31 -0700 (PDT) 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=ZZvpMhi87FxYbYNohrRU4cDjO+TnkN+NgHqMYjxsXb8=; b=qVkiqvRNOse8SEHvg5pgbJzDD7ZPN4rbZCTAUKrGmcsWb1PRv5Ce/wNPGK+msierDf 2rydiCmTdLmHBhAIdI20+XMzaATYsNYvzZGicfHxaz7JwMZ7n0oko7MTX//daOLrPKKC QyIG1IYvM1UIEPriMyayRbBiQpTJO+1h4rTQ7PXKWvvYhx19hBa+9Y7BAA+NYJzzfmj7 S8syYlRB2c+iLCdmY/FyzFQvWP4ZnAoACz6SQeaaeak2vBBvVvv23ElzUG6M6a9g0MM1 hpS9Pkp9IF2Rbw76nazevLRK0NPCya1xS1dOjriq8WDxrx05VI/K3eX7E3IROGSVnsk3 PyUg== X-Received: by 10.194.172.130 with SMTP id bc2mr63512133wjc.85.1441811611689; Wed, 09 Sep 2015 08:13:31 -0700 (PDT) Received: from arch-x220.localdomain (cpc12-croy20-2-0-cust52.croy.cable.virginm.net. [82.44.54.53]) by smtp.gmail.com with ESMTPSA id o9sm10741169wja.29.2015.09.09.08.13.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Sep 2015 08:13:30 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm] tests/dristat: don't include C files Date: Wed, 9 Sep 2015 16:17:45 +0100 Message-Id: <1441811865-10396-1-git-send-email-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: References: Cc: emil.l.velikov@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_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 Remove the hack of including xf86drm.c (and friends), by reworking the only requirement drmOpenMinor() to an open(buf...). After all we do know the exact name of the device we're going to open, so might as well use it. Replace hard-coded 16 with DRM_MAX_MINOR while we're here. Note that this does drop the explicit creation of the device node (create == 1). Modern users should not need this as they either 1) use udev which manages the device node(s) or 2) you're in BSD land where you either have udev equivalent, or explicitly manage things yourself. This also removes the -lm link, which is no longer needed. Signed-off-by: Emil Velikov --- tests/Makefile.am | 2 -- tests/dristat.c | 11 ++++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index a511d28..9a2d932 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -33,8 +33,6 @@ check_PROGRAMS = \ dristat \ drmstat -dristat_LDADD = -lm - if HAVE_NOUVEAU SUBDIRS += nouveau endif diff --git a/tests/dristat.c b/tests/dristat.c index cca4b03..cc23e16 100644 --- a/tests/dristat.c +++ b/tests/dristat.c @@ -31,13 +31,14 @@ # include #endif +#include +#include #include #include +#include +#include #include #include "xf86drm.h" -#include "xf86drmRandom.c" -#include "xf86drmHash.c" -#include "xf86drm.c" #define DRM_VERSION 0x00000001 #define DRM_MEMORY 0x00000002 @@ -267,9 +268,9 @@ int main(int argc, char **argv) return 1; } - for (i = 0; i < 16; i++) if (!minor || i == minor) { + for (i = 0; i < DRM_MAX_MINOR; i++) if (!minor || i == minor) { sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, i); - fd = drmOpenMinor(i, 1, DRM_NODE_PRIMARY); + fd = open(buf, O_RDWR, 0); if (fd >= 0) { printf("%s\n", buf); if (mask & DRM_BUSID) getbusid(fd);