From ae134807172ce96a6ad14e9bb3d611f856550772 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 23 Jul 2021 09:43:02 -0700 Subject: [PATCH] Allow libx52 calls to return TRY_AGAIN Some libx52 APIs, notably the clock related ones, can return LIBX52_ERROR_TRY_AGAIN. This is not a real error, but it is useful information. It indicates to the application that there is no change applied to the internal state, and that it should wait until trying again. Given that the clock thread calls the libx52_set_clock method every second, treating the TRY_AGAIN state as a failure and logging it causes a lot of spurious noise in the logs. This change ensures that the API returns a real error before logging it. --- daemon/x52d_device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/daemon/x52d_device.c b/daemon/x52d_device.c index f20eddb..4c88508 100644 --- a/daemon/x52d_device.c +++ b/daemon/x52d_device.c @@ -132,8 +132,10 @@ void x52d_dev_exit(void) rc = func; \ pthread_mutex_unlock(&device_mutex); \ if (rc != LIBX52_SUCCESS) { \ - PINELOG_ERROR(_("Error %d when updating X52 parameter: %s"), \ - rc, libx52_strerror(rc)); \ + if (rc != LIBX52_ERROR_TRY_AGAIN) { \ + PINELOG_ERROR(_("Error %d when updating X52 parameter: %s"), \ + rc, libx52_strerror(rc)); \ + } \ } else { \ device_update_needed = true; \ } \