From patchwork Fri Aug 28 07:59:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11742303 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F5B6913 for ; Fri, 28 Aug 2020 07:59:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB18D2078A for ; Fri, 28 Aug 2020 07:59:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB18D2078A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D89B6EB7C; Fri, 28 Aug 2020 07:59:46 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 23FAB6EB84; Fri, 28 Aug 2020 07:59:44 +0000 (UTC) IronPort-SDR: w2D0VfN2EXRIXRgPasIxdqQv7Ia3ifCjX8hkqNnQgwO+R7go0rv1Oj27G06YNJuHpEgwhPhvGx svsljNBn8bvQ== X-IronPort-AV: E=McAfee;i="6000,8403,9726"; a="136690191" X-IronPort-AV: E=Sophos;i="5.76,362,1592895600"; d="scan'208";a="136690191" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2020 00:59:43 -0700 IronPort-SDR: WURIw/EycNJMF0ZyhFdIjSzX6AJt+8hlaWllEZyq1c9tvBLZfLrQlyFHelV7q2MvpIHVDVM+K4 immb2kyN9NzA== X-IronPort-AV: E=Sophos;i="5.76,362,1592895600"; d="scan'208";a="444755792" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2020 00:59:41 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Fri, 28 Aug 2020 09:59:07 +0200 Message-Id: <20200828075927.17061-2-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200828075927.17061-1-janusz.krzysztofik@linux.intel.com> References: <20200828075927.17061-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v5 01/21] tests/core_hotunplug: Use igt_assert_fd() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Micha=C5=82_Winiarski?= , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" There is a new library helper that asserts validity of open file descriptors. Use it instead of open coding. Signed-off-by: Janusz Krzysztofik Reviewed-by: MichaƂ Winiarski --- tests/core_hotunplug.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index e03f3b945..7431346b1 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -57,7 +57,7 @@ static void prepare_for_unbind(struct hotunplug *priv, char *buf, int buflen) priv->fd.sysfs_drv = openat(priv->fd.sysfs_dev, "device/driver", O_DIRECTORY); - igt_assert(priv->fd.sysfs_drv >= 0); + igt_assert_fd(priv->fd.sysfs_drv); len = readlinkat(priv->fd.sysfs_dev, "device", buf, buflen - 1); buf[len] = '\0'; @@ -72,10 +72,10 @@ static void prepare(struct hotunplug *priv, char *buf, int buflen) { igt_debug("opening device\n"); priv->fd.drm = __drm_open_driver(DRIVER_ANY); - igt_assert(priv->fd.drm >= 0); + igt_assert_fd(priv->fd.drm); priv->fd.sysfs_dev = igt_sysfs_open(priv->fd.drm); - igt_assert(priv->fd.sysfs_dev >= 0); + igt_assert_fd(priv->fd.sysfs_dev); if (buf) { prepare_for_unbind(priv, buf, buflen); @@ -83,7 +83,7 @@ static void prepare(struct hotunplug *priv, char *buf, int buflen) /* prepare for bus rescan */ priv->fd.sysfs_bus = openat(priv->fd.sysfs_dev, "device/subsystem", O_DIRECTORY); - igt_assert(priv->fd.sysfs_bus >= 0); + igt_assert_fd(priv->fd.sysfs_bus); } } @@ -261,7 +261,7 @@ igt_main * a device file descriptor open for exit handler use. */ fd_drm = __drm_open_driver(DRIVER_ANY); - igt_assert(fd_drm >= 0); + igt_assert_fd(fd_drm); if (is_i915_device(fd_drm)) igt_require_gem(fd_drm);