答复: [PATCH xf86-video-amdgpu] Simplify drmmode_handle_uevents

Submitted by Qu, Jim on Dec. 15, 2016, 4:39 a.m.

Details

Message ID BY2PR12MB0614EE80EA62E3B327D6FBDA999D0@BY2PR12MB0614.namprd12.prod.outlook.com
State New
Headers show
Series "Simplify drmmode_handle_uevents" ( rev: 2 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Qu, Jim Dec. 15, 2016, 4:39 a.m.
Reviewed-by: Jim Qu <Jim.Qu@amd.com>


Thanks
JimQu

________________________________________
发件人: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> 代表 Michel Dänzer <michel@daenzer.net>
发送时间: 2016年12月15日 11:47
收件人: amd-gfx@lists.freedesktop.org
主题: [PATCH xf86-video-amdgpu] Simplify drmmode_handle_uevents

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


No functional change intended.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

---
 src/drmmode_display.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

--
2.11.0

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

Patch hide | download patch | download mbox

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index a5b43458..63b3b076 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -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);