From patchwork Sun Mar 22 22:03:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 6067781 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 62C8A9F2A9 for ; Sun, 22 Mar 2015 22:00:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9010B2024D for ; Sun, 22 Mar 2015 22:00:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id ABF4C2022D for ; Sun, 22 Mar 2015 22:00:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1E476E3C8; Sun, 22 Mar 2015 15:00:42 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by gabe.freedesktop.org (Postfix) with ESMTP id 82A466E3CE for ; Sun, 22 Mar 2015 15:00:41 -0700 (PDT) Received: by wixw10 with SMTP id w10so24367708wix.0 for ; Sun, 22 Mar 2015 15:00:40 -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=p8LVzuvlZg7N8pTtu3V0w15Ko0+ulkX2cUlaWoY6VPo=; b=FduyZuwz9gcXN/fV8Ogx0kpZ5BD4eP7t3BrUbQRDgap4gJ4/ww0/t7xuup6Jca5i4P gN76fZmqd5bAkfb0vekFGrgrWGUx3b7/f1B15QdMhvkEQiqYfRAoRlrJWe56pTfs92wS Og3+FooJHXc7Hqj4SDlCtTgIfLeOhpZYtwEyFeJciJe1WT7+IeKog0B8e2nYiwUVEOW4 4QfaT2ofTPd6QyqXkBrmX0EFL9HxRLEbUQiCTHgvgYeWmfvotfV0U4c6pC1Zjkr/k04/ W7AI/I1MTJ6qNKfJoOh2WHH2BkHoznL5b9DOsaZwp62eYdB2aehmAryM85NCLX6ooWDN etEA== X-Received: by 10.194.62.198 with SMTP id a6mr182333131wjs.90.1427061640924; Sun, 22 Mar 2015 15:00:40 -0700 (PDT) Received: from arch-x220.localdomain (cpc12-croy20-2-0-cust52.croy.cable.virginm.net. [82.44.54.53]) by mx.google.com with ESMTPSA id dq8sm8281654wib.9.2015.03.22.15.00.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Mar 2015 15:00:40 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 1/9] tests/dristat: don't include C files Date: Sun, 22 Mar 2015 22:03:37 +0000 Message-Id: <1427061825-27470-2-git-send-email-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.3.1 In-Reply-To: <1427061825-27470-1-git-send-email-emil.l.velikov@gmail.com> References: <1427061825-27470-1-git-send-email-emil.l.velikov@gmail.com> 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 C files, 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. Signed-off-by: Emil Velikov --- tests/dristat.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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);