Skip to contentSkip to conversation

Simplify drmmode_handle_uevents

PATCH In review Michel Dänzer 2 participants 2 messages Dec 15, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Simplify drmmode_handle_uevents

From: Michel Dänzer <[email protected]>

No functional change intended.

---
 src/drmmode_display.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
src/drmmode_display.c +4 -10
index a5b43458..63b3b076 100644
@@ -2528,21 +2528,15 @@ static void drmmode_handle_uevents(int fd, void *closure)
 	ScrnInfoPtr scrn = drmmode->scrn;
 	struct udev_device *dev;
 	Bool received = FALSE;
-	struct timeval tv;
+	struct timeval tv = { 0, 0 };
 	fd_set readfd;
-	int ret;
 
 	FD_ZERO(&readfd);
 	FD_SET(fd, &readfd);
-	tv.tv_sec = 0;
-	tv.tv_usec = 0;
 
-	while (1) {
-		ret = select(fd + 1, &readfd, NULL, NULL, &tv);
-		/* Check if our file descriptor has received data. */
-		if (!(ret > 0 && FD_ISSET(fd, &readfd)))
-			break;
-		/* Make the call to receive device. select() ensured that this will not be blocked. */
+	while (select(fd + 1, &readfd, NULL, NULL, &tv) > 0 &&
+	       FD_ISSET(fd, &readfd)) {
+		/* select() ensured that this will not block */
 		dev = udev_monitor_receive_device(drmmode->uevent_monitor);
 		if (dev) {
 			udev_device_unref(dev);
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20161215034758.10645-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by Jim Qu
#2 lore raw

Thanks
JimQu

________________________________________
发件人: amd-gfx <[email protected]> 代表 Michel Dänzer <[email protected]> 发送时间: 2016年12月15日 11:47
收件人: [email protected]
主题: [PATCH xf86-video-amdgpu] Simplify drmmode_handle_uevents

From: Michel Dänzer <[email protected]>

No functional change intended.

---
 src/drmmode_display.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
src/drmmode_display.c +4 -10
index a5b43458..63b3b076 100644
@@ -2528,21 +2528,15 @@ static void drmmode_handle_uevents(int fd, void *closure)
        ScrnInfoPtr scrn = drmmode->scrn;
        struct udev_device *dev;
        Bool received = FALSE;
-       struct timeval tv;
+       struct timeval tv = { 0, 0 };
        fd_set readfd;
-       int ret;
 
        FD_ZERO(&readfd);
        FD_SET(fd, &readfd);
-       tv.tv_sec = 0;
-       tv.tv_usec = 0;
 
-       while (1) {
-               ret = select(fd + 1, &readfd, NULL, NULL, &tv);
-               /* Check if our file descriptor has received data. */
-               if (!(ret > 0 && FD_ISSET(fd, &readfd)))
-                       break;
-               /* Make the call to receive device. select() ensured that this will not be blocked. */
+       while (select(fd + 1, &readfd, NULL, NULL, &tv) > 0 &&
+              FD_ISSET(fd, &readfd)) {
+               /* select() ensured that this will not block */
                dev = udev_monitor_receive_device(drmmode->uevent_monitor);
                if (dev) {
                        udev_device_unref(dev);

--
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx