[PATCH 3/7] clk: mux: fix mask/width confusion in clk_hw_register_mux

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 22 00:56:33 PDT 2025


From: Ahmad Fatoum <a.fatoum at 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 at 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




More information about the barebox mailing list