summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-12-15 12:44:47 +0900
committerMichel Dänzer <michel.daenzer@amd.com>2016-12-15 12:44:47 +0900
commit92fc387a6256ce3c95d62142735783ea07162c54 (patch)
tree8031ea06ee8a748294b3d47040d88dc8c4a09b24 /src
parent404c64752774d23a2db9aa3134f6ada3155708c9 (diff)
Simplify drmmode_handle_uevents
No functional change intended. Reviewed-by: Jim Qu <Jim.Qu@amd.com> (Cherry picked from amdgpu commit edd276185d42962a13faf9ec9eeebc754ef284e7.)
Diffstat (limited to 'src')
-rw-r--r--src/drmmode_display.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index b183a20c..ce806464 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2717,21 +2717,15 @@ 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);