All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <ravi@prevas.dk>
To: u-boot@lists.denx.de
Cc: Stefan Roese <sr@denx.de>, Tom Rini <trini@konsulko.com>,
	Rasmus Villemoes <ravi@prevas.dk>
Subject: [PATCH 3/3] cyclic: document new guarantees for cyclic_(un)register
Date: Wed,  7 May 2025 12:58:21 +0200	[thread overview]
Message-ID: <20250507105821.484442-4-ravi@prevas.dk> (raw)
In-Reply-To: <20250507105821.484442-1-ravi@prevas.dk>

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 doc/develop/cyclic.rst | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/doc/develop/cyclic.rst b/doc/develop/cyclic.rst
index 6f1da6f0d9b..a99b17052f5 100644
--- a/doc/develop/cyclic.rst
+++ b/doc/develop/cyclic.rst
@@ -54,3 +54,16 @@ responsible for calling all registered cyclic functions, into the
 common schedule() function. This guarantees that cyclic_run() is
 executed very often, which is necessary for the cyclic functions to
 get scheduled and executed at their configured periods.
+
+Idempotence
+-----------
+
+Both the cyclic_register() and cyclic_unregister() functions are safe
+to call on any struct cyclic_info, regardless of whether that instance
+is already registered or not.
+
+More specifically, calling cyclic_unregister() with a cyclic_info
+which is not currently registered is a no-op, while calling
+cyclic_register() with a cyclic_info which is currently registered
+results in it being automatically unregistered, and then registered
+with the new callback function and timeout parameters.
-- 
2.49.0


  parent reply	other threads:[~2025-05-07 10:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07 10:58 [PATCH 0/3] make cyclic_(un)register idempotent Rasmus Villemoes
2025-05-07 10:58 ` [PATCH 1/3] cyclic: make cyclic_unregister() idempotent Rasmus Villemoes
2025-05-08  7:26   ` Stefan Roese
2025-05-07 10:58 ` [PATCH 2/3] cyclic: make cyclic_register safe to call on already-registered info Rasmus Villemoes
2025-05-08  7:27   ` Stefan Roese
2025-05-07 10:58 ` Rasmus Villemoes [this message]
2025-05-08  7:27   ` [PATCH 3/3] cyclic: document new guarantees for cyclic_(un)register Stefan Roese
2025-05-16 16:41 ` [PATCH 0/3] make cyclic_(un)register idempotent Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250507105821.484442-4-ravi@prevas.dk \
    --to=ravi@prevas.dk \
    --cc=sr@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.