mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/7] clk: mux: fix mask/width confusion in clk_hw_register_mux
Date: Tue, 22 Apr 2025 09:56:33 +0200	[thread overview]
Message-ID: <20250422075637.220688-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250422075637.220688-1-a.fatoum@pengutronix.de>

From: Ahmad Fatoum <a.fatoum@barebox.org>

In Linux __clk_hw_register_mux takes a mask argument, while
clk_hw_register_mux expects a width.

Align barebox with this API to fix the bugs in the STM32MP1 and STM32F4
clock drivers, which are the only two making use of this macro so far.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 include/linux/clk.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/clk.h b/include/linux/clk.h
index 883b1a314688..74802fde4572 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -662,11 +662,12 @@ struct clk_hw *__clk_hw_register_mux(struct device *dev,
 				     spinlock_t *lock);
 
 #define clk_hw_register_mux(dev, name, parent_names,                  \
-		num_parents, flags, reg, shift, mask,                 \
+		num_parents, flags, reg, shift, width,                \
 		clk_mux_flags, lock)                                  \
 	__clk_hw_register_mux((dev), (name), (num_parents),           \
 				     (parent_names),                  \
-				     (flags), (reg), (shift), (mask), \
+				     (flags), (reg),                  \
+				     (shift), BIT((width)) - 1,       \
 				     (clk_mux_flags), NULL, (lock))
 
 #define clk_hw_register_mux_table(dev, name, parent_names, num_parents,	  \
-- 
2.39.5




  parent reply	other threads:[~2025-04-22  8:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22  7:56 [PATCH 1/7] clk: add compatibility for prepare/unprepare/is_prepared Ahmad Fatoum
2025-04-22  7:56 ` [PATCH 2/7] clk: mux: replace width member with mask as in Linux Ahmad Fatoum
2025-04-22  7:56 ` Ahmad Fatoum [this message]
2025-04-22  7:56 ` [PATCH 4/7] clk: gate: underscore-prefix barebox-specific parent member Ahmad Fatoum
2025-04-22  7:56 ` [PATCH 5/7] clk: gate: add bit_idx member as in Linux Ahmad Fatoum
2025-04-22  7:56 ` [PATCH 6/7] clk: composite: change mux/rate/gate members to clk_hw Ahmad Fatoum
2025-04-22  7:56 ` [PATCH 7/7] clk: move struct clk_composite definition to header Ahmad Fatoum
2025-04-22  9:18 ` [PATCH 1/7] clk: add compatibility for prepare/unprepare/is_prepared Sascha Hauer

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=20250422075637.220688-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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