This warning was meant to address the case that a poller repeatedly
takes too long that interactive usage is impacted.

I frequently see this warning during initial USB gadget set up and that
is not really useful to show every user and developers can use the
poller command, so let's wait until we are on our third (2nd when
counting from 0) overtime to print the one time warning.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 common/Kconfig  | 2 +-
 common/poller.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index d923d4c4b628..c6a7f2feabd3 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1104,7 +1104,7 @@ config POLLER_WARN_OVERTIME
        help
          Pollers are meant to poll and quickly execute actions.
          exceeding the maximum runtime of POLLER_MAX_RUNTIME_MS
-         will trigger a one-time warning.
+         three times will trigger a one-time warning.
 
 config BTHREAD
        bool "barebox co-operative (green) thread infrastructure"
diff --git a/common/poller.c b/common/poller.c
index 5dc2be97211d..ca0d68d6cb27 100644
--- a/common/poller.c
+++ b/common/poller.c
@@ -135,8 +135,8 @@ void poller_call(void)
                duration_ms = ktime_ms_delta(ktime_get(), start);
                if (duration_ms > POLLER_MAX_RUNTIME_MS) {
                        if (IS_ENABLED(CONFIG_POLLER_WARN_OVERTIME) &&
-                           !poller->overtime)
-                               pr_warn("'%s' took unexpectedly long: %llums\n",
+                           poller->overtime == 2)
+                               pr_warn("'%s' takes unexpectedly long: 
%llums\n",
                                        poller->name, duration_ms);
 
                        if (poller->overtime < U16_MAX)
-- 
2.47.3


Reply via email to