Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Francois Dugast <francois.dugast@intel.com>,
	Peter Senna Tschudin <peter.senna@linux.intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t 2/4] lib/igt_sysfs: Fix close when rebinding
Date: Tue, 17 Dec 2024 21:13:22 -0800	[thread overview]
Message-ID: <20241218051324.2696557-3-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20241218051324.2696557-1-lucas.demarchi@intel.com>

This function could be de-multiplexed and use single functions to each
action (e.g. igt_kmod_unbind already exists). However, with the aim of
simply fixing the bug, make sure the fd is closed with
__drm_close_driver(), otherwise the cached fd is not invalidated and
later drm_open_driver() fails because the driver is considered already
opened.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 lib/igt_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index eaf8fd882..9427767b0 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -1530,7 +1530,7 @@ int xe_sysfs_driver_do(int xe_device, char pci_slot[], enum xe_sysfs_driver_acti
 		 * We need to close the client for a proper release, before
 		 * binding back again.
 		 */
-		close(xe_device);
+		__drm_close_driver(xe_device);
 
 		igt_assert(igt_sysfs_set(sysfs, "bind", pci_slot));
 		close(sysfs);
-- 
2.47.0


  parent reply	other threads:[~2024-12-18  5:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18  5:13 [PATCH i-g-t 0/4] Device scan fixes Lucas De Marchi
2024-12-18  5:13 ` [PATCH i-g-t 1/4] lib/drmtest: Fix drm_close_driver() Lucas De Marchi
2024-12-18  5:13 ` Lucas De Marchi [this message]
2024-12-18  5:13 ` [PATCH i-g-t 3/4] lib/igt_sysfs: Move close to be common to all actions Lucas De Marchi
2024-12-18  5:13 ` [PATCH i-g-t 4/4] lib/igt_device_scan: Fix scan vs bind/unbind/reload Lucas De Marchi
2024-12-18  6:07   ` Peter Senna Tschudin
2024-12-18  6:17   ` Zbigniew Kempczyński
2024-12-20 19:10     ` Lucas De Marchi
2024-12-18  6:34   ` Zbigniew Kempczyński
2024-12-19 16:35     ` Lucas De Marchi
2024-12-20  6:59       ` Zbigniew Kempczyński
2024-12-20 18:52         ` Lucas De Marchi
2024-12-18  8:20   ` Kamil Konieczny
2024-12-18  8:16 ` [PATCH i-g-t 0/4] Device scan fixes Peter Senna Tschudin
2024-12-18 22:04   ` Lucas De Marchi
2024-12-19  8:44     ` Peter Senna Tschudin
2024-12-18 20:55 ` ✓ i915.CI.BAT: success for " Patchwork
2024-12-18 23:00 ` ✓ Xe.CI.BAT: " Patchwork
2024-12-19 10:18 ` ✗ i915.CI.Full: failure " Patchwork
2024-12-19 14:13 ` ✗ Xe.CI.Full: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241218051324.2696557-3-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=francois.dugast@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=peter.senna@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox