[PATCH 03/12] clk: divider: add clk_hw registration functions
Ahmad Fatoum
a.fatoum at pengutronix.de
Sun Jan 30 23:57:16 PST 2022
Save users the hassle of opencoding by providing wrappers with the same
Linux semantics: names are duplicated, same arguments and struct clk_hw
is returned.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/clk/clk-divider.c | 21 +++++++++++++++++++++
include/linux/clk.h | 11 +++++++++++
2 files changed, 32 insertions(+)
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index 856b8a064866..fed9ad9d24b1 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -428,3 +428,24 @@ struct clk *clk_register_divider(struct device_d *dev, const char *name,
return clk_divider(name, parent_name, flags, reg, shift, width,
clk_divider_flags);
}
+
+struct clk_hw *clk_hw_register_divider_table(struct device_d *dev,
+ const char *name, const char *parent_name, unsigned long flags,
+ void __iomem *reg, u8 shift, u8 width,
+ u8 clk_divider_flags, const struct clk_div_table *table,
+ spinlock_t *lock)
+{
+ return clk_to_clk_hw(clk_register_divider_table(dev, xstrdup(name),
+ xstrdup(parent_name), flags, reg, shift, width,
+ clk_divider_flags, table, lock));
+}
+
+struct clk_hw *clk_hw_register_divider(struct device_d *dev,
+ const char *name, const char *parent_name, unsigned long flags,
+ void __iomem *reg, u8 shift, u8 width,
+ u8 clk_divider_flags, spinlock_t *lock)
+{
+ return clk_to_clk_hw(clk_register_divider(dev, xstrdup(name),
+ xstrdup(parent_name), flags, reg, shift, width,
+ clk_divider_flags, lock));
+}
diff --git a/include/linux/clk.h b/include/linux/clk.h
index f4aa5c7c57f0..6a041440e399 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -519,6 +519,17 @@ struct clk *clk_register_divider_table(struct device_d *dev, const char *name,
u8 clk_divider_flags, const struct clk_div_table *table,
spinlock_t *lock);
+struct clk_hw *clk_hw_register_divider_table(struct device_d *dev, const char *name,
+ const char *parent_name, unsigned long flags,
+ void __iomem *reg, u8 shift, u8 width,
+ u8 clk_divider_flags, const struct clk_div_table *table,
+ spinlock_t *lock);
+
+struct clk_hw *clk_hw_register_divider(struct device_d *dev, const char *name,
+ const char *parent_name, unsigned long flags,
+ void __iomem *reg, u8 shift, u8 width,
+ u8 clk_divider_flags, spinlock_t *lock);
+
struct clk_fixed_factor {
struct clk_hw hw;
int mult;
--
2.30.2
More information about the barebox
mailing list