Commit 798588a4 authored by Richard Hughes's avatar Richard Hughes
Browse files

Do not spin in a loop when /proc/timer_stats cannot be written

Only set up the polling once the write has succeeded.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100626
parent eb6b1b62
......@@ -626,6 +626,13 @@ up_wakeups_timerstats_enable (UpWakeups *wakeups)
g_debug ("enabling timer stats");
/* enable timer stats */
file = fopen (UP_WAKEUPS_SOURCE_USERSPACE, "w");
if (file == NULL)
return FALSE;
fprintf (file, "1\n");
fclose (file);
/* setup polls */
wakeups->priv->poll_kernel_id =
g_timeout_add_seconds (UP_WAKEUPS_POLL_INTERVAL_KERNEL,
......@@ -637,11 +644,6 @@ up_wakeups_timerstats_enable (UpWakeups *wakeups)
(GSourceFunc) up_wakeups_poll_userspace_cb, wakeups);
g_source_set_name_by_id (wakeups->priv->poll_userspace_id, "[upower] up_wakeups_poll_userspace_cb");
file = fopen (UP_WAKEUPS_SOURCE_USERSPACE, "w");
if (file == NULL)
return FALSE;
fprintf (file, "1\n");
fclose (file);
wakeups->priv->polling_enabled = TRUE;
return TRUE;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment