dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Emil Velikov
	<emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH libdrm 3/9] amdgpu: Rename fd_mutex/list to dev_mutex/list
Date: Mon, 24 Jun 2019 18:54:00 +0200	[thread overview]
Message-ID: <20190624165406.13682-4-michel@daenzer.net> (raw)
In-Reply-To: <20190624165406.13682-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>

From: Michel Dänzer <michel.daenzer@amd.com>

Seems to better reflect what they're for.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 amdgpu/amdgpu_device.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index 362494b1..76b4e5eb 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -43,8 +43,8 @@
 
 #define PTR_TO_UINT(x) ((unsigned)((intptr_t)(x)))
 
-static pthread_mutex_t fd_mutex = PTHREAD_MUTEX_INITIALIZER;
-static amdgpu_device_handle fd_list;
+static pthread_mutex_t dev_mutex = PTHREAD_MUTEX_INITIALIZER;
+static amdgpu_device_handle dev_list;
 
 static int fd_compare(int fd1, int fd2)
 {
@@ -95,13 +95,13 @@ static int amdgpu_get_auth(int fd, int *auth)
 
 static void amdgpu_device_free_internal(amdgpu_device_handle dev)
 {
-	amdgpu_device_handle *node = &fd_list;
+	amdgpu_device_handle *node = &dev_list;
 
-	pthread_mutex_lock(&fd_mutex);
+	pthread_mutex_lock(&dev_mutex);
 	while (*node != dev && (*node)->next)
 		node = &(*node)->next;
 	*node = (*node)->next;
-	pthread_mutex_unlock(&fd_mutex);
+	pthread_mutex_unlock(&dev_mutex);
 
 	close(dev->fd);
 	if ((dev->flink_fd >= 0) && (dev->fd != dev->flink_fd))
@@ -155,16 +155,16 @@ drm_public int amdgpu_device_initialize(int fd,
 
 	*device_handle = NULL;
 
-	pthread_mutex_lock(&fd_mutex);
+	pthread_mutex_lock(&dev_mutex);
 	r = amdgpu_get_auth(fd, &flag_auth);
 	if (r) {
 		fprintf(stderr, "%s: amdgpu_get_auth (1) failed (%i)\n",
 			__func__, r);
-		pthread_mutex_unlock(&fd_mutex);
+		pthread_mutex_unlock(&dev_mutex);
 		return r;
 	}
 
-	for (dev = fd_list; dev; dev = dev->next)
+	for (dev = dev_list; dev; dev = dev->next)
 		if (fd_compare(dev->fd, fd) == 0)
 			break;
 
@@ -173,7 +173,7 @@ drm_public int amdgpu_device_initialize(int fd,
 		if (r) {
 			fprintf(stderr, "%s: amdgpu_get_auth (2) failed (%i)\n",
 				__func__, r);
-			pthread_mutex_unlock(&fd_mutex);
+			pthread_mutex_unlock(&dev_mutex);
 			return r;
 		}
 		if ((flag_auth) && (!flag_authexist)) {
@@ -182,14 +182,14 @@ drm_public int amdgpu_device_initialize(int fd,
 		*major_version = dev->major_version;
 		*minor_version = dev->minor_version;
 		amdgpu_device_reference(device_handle, dev);
-		pthread_mutex_unlock(&fd_mutex);
+		pthread_mutex_unlock(&dev_mutex);
 		return 0;
 	}
 
 	dev = calloc(1, sizeof(struct amdgpu_device));
 	if (!dev) {
 		fprintf(stderr, "%s: calloc failed\n", __func__);
-		pthread_mutex_unlock(&fd_mutex);
+		pthread_mutex_unlock(&dev_mutex);
 		return -ENOMEM;
 	}
 
@@ -265,9 +265,9 @@ drm_public int amdgpu_device_initialize(int fd,
 	*major_version = dev->major_version;
 	*minor_version = dev->minor_version;
 	*device_handle = dev;
-	dev->next = fd_list;
-	fd_list = dev;
-	pthread_mutex_unlock(&fd_mutex);
+	dev->next = dev_list;
+	dev_list = dev;
+	pthread_mutex_unlock(&dev_mutex);
 
 	return 0;
 
@@ -275,7 +275,7 @@ cleanup:
 	if (dev->fd >= 0)
 		close(dev->fd);
 	free(dev);
-	pthread_mutex_unlock(&fd_mutex);
+	pthread_mutex_unlock(&dev_mutex);
 	return r;
 }
 
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2019-06-24 16:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24 16:53 [PATCH libdrm 0/9] amdgpu: Michel Dänzer
2019-06-24 16:54 ` [PATCH libdrm 4/9] amdgpu: Add struct amdgpu_core_device and amdgpu_core_bo Michel Dänzer
2019-06-24 16:54 ` [PATCH libdrm 5/9] amdgpu: Add amdgpu_bo_handle_type_kms_user Michel Dänzer
2019-06-24 16:54 ` [PATCH libdrm 6/9] amdgpu: Re-use an existing amdgpu_device when possible Michel Dänzer
2019-06-24 16:54 ` [PATCH libdrm 7/9] amdgpu: Use normal integers for device / core BO reference counting Michel Dänzer
     [not found] ` <20190624165406.13682-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-06-24 16:53   ` [PATCH libdrm 1/9] amdgpu: Pass file descriptor directly to amdgpu_close_kms_handle Michel Dänzer
2019-06-28 17:11     ` Emil Velikov
2019-06-24 16:53   ` [PATCH libdrm 2/9] amdgpu: Add BO handle to table in amdgpu_bo_create Michel Dänzer
2019-06-24 16:54   ` Michel Dänzer [this message]
2019-06-24 16:54   ` [PATCH libdrm 8/9] amdgpu: Drop refcount member from struct amdgpu_core_bo/device Michel Dänzer
2019-06-24 16:54   ` [PATCH mesa 9/9] winsys/amdgpu: Use amdgpu_bo_handle_type_kms_user for API KMS handles Michel Dänzer
2019-06-24 17:31 ` [PATCH libdrm 0/9] amdgpu: Christian König
     [not found]   ` <b48aae10-c1db-b76b-ddde-9c0a47028633-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-06-25  8:02     ` Michel Dänzer
2019-06-25  9:44       ` Koenig, Christian
     [not found]         ` <78d5a7c1-8534-7917-58bc-1827dff106c8-5C7GfCeVMHo@public.gmane.org>
2019-06-25 10:07           ` Michel Dänzer

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=20190624165406.13682-4-michel@daenzer.net \
    --to=michel-otuistvhuppr7s880joybq@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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