mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Russell King <linux@armlinux.org.uk>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Tero Kristo <t-kristo@ti.com>,
	Tony Lindgren <tony@atomide.com>, Keerthy <j-keerthy@ti.com>,
	Russ Dill <Russ.Dill@ti.com>
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH 2/3] clk: Merge prepare and unprepare sections
Date: Mon,  1 Dec 2025 10:42:27 +0100	[thread overview]
Message-ID: <c6bf644391dc28803a0ac1e331f196fc2c3c36de.1764582057.git.geert@linux-m68k.org> (raw)
In-Reply-To: <8066e45dbdd9acca29c0f9b578922a091a5c31fd.1764582057.git.geert@linux-m68k.org>

<linux/clk.h> contains two consecutive #ifdef/#else/#endif sections
that check for CONFIG_HAVE_CLK_PREPARE: one for prepare-related
functionality, and a second for unprepare-related functionality.
Reduce #ifdef clutter by merging them.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 include/linux/clk.h | 46 ++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/include/linux/clk.h b/include/linux/clk.h
index 64ff118ffb1a1d7d..9e5291f37c50c78a 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -329,8 +329,21 @@ static inline void clk_restore_context(void) {}
  * Must not be called from within atomic context.
  */
 int clk_prepare(struct clk *clk);
+
+/**
+ * clk_unprepare - undo preparation of a clock source
+ * @clk: clock source
+ *
+ * This undoes a previously prepared clock.  The caller must balance
+ * the number of prepare and unprepare calls.
+ *
+ * Must not be called from within atomic context.
+ */
+void clk_unprepare(struct clk *clk);
+
 int __must_check clk_bulk_prepare(int num_clks,
 				  const struct clk_bulk_data *clks);
+void clk_bulk_unprepare(int num_clks, const struct clk_bulk_data *clks);
 
 /**
  * clk_is_enabled_when_prepared - indicate if preparing a clock also enables it.
@@ -355,41 +368,28 @@ static inline int clk_prepare(struct clk *clk)
 	return 0;
 }
 
-static inline int __must_check
-clk_bulk_prepare(int num_clks, const struct clk_bulk_data *clks)
+static inline void clk_unprepare(struct clk *clk)
 {
 	might_sleep();
-	return 0;
 }
 
-static inline bool clk_is_enabled_when_prepared(struct clk *clk)
-{
-	return false;
-}
-#endif
-
-/**
- * clk_unprepare - undo preparation of a clock source
- * @clk: clock source
- *
- * This undoes a previously prepared clock.  The caller must balance
- * the number of prepare and unprepare calls.
- *
- * Must not be called from within atomic context.
- */
-#ifdef CONFIG_HAVE_CLK_PREPARE
-void clk_unprepare(struct clk *clk);
-void clk_bulk_unprepare(int num_clks, const struct clk_bulk_data *clks);
-#else
-static inline void clk_unprepare(struct clk *clk)
+static inline int __must_check
+clk_bulk_prepare(int num_clks, const struct clk_bulk_data *clks)
 {
 	might_sleep();
+	return 0;
 }
+
 static inline void clk_bulk_unprepare(int num_clks,
 				      const struct clk_bulk_data *clks)
 {
 	might_sleep();
 }
+
+static inline bool clk_is_enabled_when_prepared(struct clk *clk)
+{
+	return false;
+}
 #endif
 
 #ifdef CONFIG_HAVE_CLK
-- 
2.43.0


  reply	other threads:[~2025-12-01  9:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01  9:42 [PATCH 0/3] clk: <linux/clk.h> fixes and improvements Geert Uytterhoeven
2025-12-01  9:42 ` [PATCH 1/3] clk: Move clk_{save,restore}_context() to COMMON_CLK section Geert Uytterhoeven
2025-12-01  9:42   ` Geert Uytterhoeven [this message]
2026-01-16  2:51     ` [PATCH 2/3] clk: Merge prepare and unprepare sections Stephen Boyd
2025-12-01  9:42   ` [PATCH 3/3] clk: Annotate #else and #endif Geert Uytterhoeven
2026-01-16  2:52     ` Stephen Boyd
2026-01-16  2:51   ` [PATCH 1/3] clk: Move clk_{save,restore}_context() to COMMON_CLK section Stephen Boyd

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=c6bf644391dc28803a0ac1e331f196fc2c3c36de.1764582057.git.geert@linux-m68k.org \
    --to=geert@linux-m68k.org \
    --cc=Russ.Dill@ti.com \
    --cc=j-keerthy@ti.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=t-kristo@ti.com \
    --cc=tony@atomide.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®