From f7f04fbfc6413ef9e71b2d512459f807ace00734 Mon Sep 17 00:00:00 2001 From: Mike Tipton Date: Wed, 4 Nov 2020 16:40:10 -0800 Subject: [PATCH] clk: qcom: Add qcom_clk_hw_get_name() The existing clk_hw_get_name() only works after the clock has been registered with the framework since it relies on hw->core->name and hw->core is NULL pre-registration. hw->init->name can be used pre-registration, but this doesn't work post-registration since the framework sets hw->init to NULL. Provide qcom_clk_hw_get_name(), which can be called in both pre and post-registration contexts. Change-Id: I334e545f5112961b7ab6879daca55c70236338d6 Signed-off-by: Mike Tipton --- drivers/clk/qcom/common.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/qcom/common.h b/drivers/clk/qcom/common.h index 6a2a85f3eab1..0c8f5a0dd7d1 100644 --- a/drivers/clk/qcom/common.h +++ b/drivers/clk/qcom/common.h @@ -84,4 +84,9 @@ int qcom_cc_runtime_init(struct platform_device *pdev, int qcom_cc_runtime_suspend(struct device *dev); int qcom_cc_runtime_resume(struct device *dev); +static inline const char *qcom_clk_hw_get_name(const struct clk_hw *hw) +{ + return hw->init ? hw->init->name : clk_hw_get_name(hw); +} + #endif