]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
clk: meson: g12: use devm variant to register notifiers
authorJerome Brunet <jbrunet@baylibre.com>
Wed, 21 Oct 2020 16:38:47 +0000 (18:38 +0200)
committerStephen Boyd <sboyd@kernel.org>
Sat, 14 Nov 2020 20:58:31 +0000 (12:58 -0800)
Until now, nothing was done to unregister the dvfs clock notifiers of the
Amlogic g12 SoC family. This is not great but this driver was not really
expected to be unloaded. With the ongoing effort to build everything as
module for this platform, this needs to be cleanly handled.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20201021163847.595189-3-jbrunet@baylibre.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/meson/g12a.c
include/linux/clk.h

index 235dcf72e34a6fe8153fa64384f1b5d3f24f0f1c..108e4491b1e25deb429baeaf28a555ddf91e04ba 100644 (file)
@@ -5171,8 +5171,8 @@ static int meson_g12a_dvfs_setup_common(struct device *dev,
        g12a_cpu_clk_postmux0_nb_data.xtal = xtal;
        notifier_clk = devm_clk_hw_get_clk(dev, &g12a_cpu_clk_postmux0.hw,
                                           DVFS_CON_ID);
-       ret = clk_notifier_register(notifier_clk,
-                                   &g12a_cpu_clk_postmux0_nb_data.nb);
+       ret = devm_clk_notifier_register(dev, notifier_clk,
+                                        &g12a_cpu_clk_postmux0_nb_data.nb);
        if (ret) {
                dev_err(dev, "failed to register the cpu_clk_postmux0 notifier\n");
                return ret;
@@ -5181,7 +5181,8 @@ static int meson_g12a_dvfs_setup_common(struct device *dev,
        /* Setup clock notifier for cpu_clk_dyn mux */
        notifier_clk = devm_clk_hw_get_clk(dev, &g12a_cpu_clk_dyn.hw,
                                           DVFS_CON_ID);
-       ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb);
+       ret = devm_clk_notifier_register(dev, notifier_clk,
+                                        &g12a_cpu_clk_mux_nb);
        if (ret) {
                dev_err(dev, "failed to register the cpu_clk_dyn notifier\n");
                return ret;
@@ -5207,7 +5208,8 @@ static int meson_g12b_dvfs_setup(struct platform_device *pdev)
        /* Setup clock notifier for cpu_clk mux */
        notifier_clk = devm_clk_hw_get_clk(dev, &g12b_cpu_clk.hw,
                                           DVFS_CON_ID);
-       ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb);
+       ret = devm_clk_notifier_register(dev, notifier_clk,
+                                        &g12a_cpu_clk_mux_nb);
        if (ret) {
                dev_err(dev, "failed to register the cpu_clk notifier\n");
                return ret;
@@ -5216,8 +5218,8 @@ static int meson_g12b_dvfs_setup(struct platform_device *pdev)
        /* Setup clock notifier for sys1_pll */
        notifier_clk = devm_clk_hw_get_clk(dev, &g12b_sys1_pll.hw,
                                           DVFS_CON_ID);
-       ret = clk_notifier_register(notifier_clk,
-                                   &g12b_cpu_clk_sys1_pll_nb_data.nb);
+       ret = devm_clk_notifier_register(dev, notifier_clk,
+                                        &g12b_cpu_clk_sys1_pll_nb_data.nb);
        if (ret) {
                dev_err(dev, "failed to register the sys1_pll notifier\n");
                return ret;
@@ -5229,8 +5231,8 @@ static int meson_g12b_dvfs_setup(struct platform_device *pdev)
        g12b_cpub_clk_postmux0_nb_data.xtal = xtal;
        notifier_clk = devm_clk_hw_get_clk(dev, &g12b_cpub_clk_postmux0.hw,
                                           DVFS_CON_ID);
-       ret = clk_notifier_register(notifier_clk,
-                                   &g12b_cpub_clk_postmux0_nb_data.nb);
+       ret = devm_clk_notifier_register(dev, notifier_clk,
+                                        &g12b_cpub_clk_postmux0_nb_data.nb);
        if (ret) {
                dev_err(dev, "failed to register the cpub_clk_postmux0 notifier\n");
                return ret;
@@ -5238,7 +5240,8 @@ static int meson_g12b_dvfs_setup(struct platform_device *pdev)
 
        /* Setup clock notifier for cpub_clk_dyn mux */
        notifier_clk = devm_clk_hw_get_clk(dev, &g12b_cpub_clk_dyn.hw, "dvfs");
-       ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb);
+       ret = devm_clk_notifier_register(dev, notifier_clk,
+                                        &g12a_cpu_clk_mux_nb);
        if (ret) {
                dev_err(dev, "failed to register the cpub_clk_dyn notifier\n");
                return ret;
@@ -5246,7 +5249,8 @@ static int meson_g12b_dvfs_setup(struct platform_device *pdev)
 
        /* Setup clock notifier for cpub_clk mux */
        notifier_clk = devm_clk_hw_get_clk(dev, &g12b_cpub_clk.hw, DVFS_CON_ID);
-       ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb);
+       ret = devm_clk_notifier_register(dev, notifier_clk,
+                                        &g12a_cpu_clk_mux_nb);
        if (ret) {
                dev_err(dev, "failed to register the cpub_clk notifier\n");
                return ret;
@@ -5254,8 +5258,8 @@ static int meson_g12b_dvfs_setup(struct platform_device *pdev)
 
        /* Setup clock notifier for sys_pll */
        notifier_clk = devm_clk_hw_get_clk(dev, &g12a_sys_pll.hw, DVFS_CON_ID);
-       ret = clk_notifier_register(notifier_clk,
-                                   &g12b_cpub_clk_sys_pll_nb_data.nb);
+       ret = devm_clk_notifier_register(dev, notifier_clk,
+                                        &g12b_cpub_clk_sys_pll_nb_data.nb);
        if (ret) {
                dev_err(dev, "failed to register the sys_pll notifier\n");
                return ret;
@@ -5277,7 +5281,8 @@ static int meson_g12a_dvfs_setup(struct platform_device *pdev)
 
        /* Setup clock notifier for cpu_clk mux */
        notifier_clk = devm_clk_hw_get_clk(dev, &g12a_cpu_clk.hw, DVFS_CON_ID);
-       ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb);
+       ret = devm_clk_notifier_register(dev, notifier_clk,
+                                   &g12a_cpu_clk_mux_nb);
        if (ret) {
                dev_err(dev, "failed to register the cpu_clk notifier\n");
                return ret;
@@ -5285,7 +5290,8 @@ static int meson_g12a_dvfs_setup(struct platform_device *pdev)
 
        /* Setup clock notifier for sys_pll */
        notifier_clk = devm_clk_hw_get_clk(dev, &g12a_sys_pll.hw, DVFS_CON_ID);
-       ret = clk_notifier_register(notifier_clk, &g12a_sys_pll_nb_data.nb);
+       ret = devm_clk_notifier_register(dev, notifier_clk,
+                                        &g12a_sys_pll_nb_data.nb);
        if (ret) {
                dev_err(dev, "failed to register the sys_pll notifier\n");
                return ret;
index f53afdf8198bc01573c0050a96b8d4af6e248f72..4ac766dc3dafc827974f64cc1e9445efa315237b 100644 (file)
@@ -117,7 +117,8 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
  *
  * Returns 0 on success, -EERROR otherwise
  */
-int devm_clk_notifier_register(struct device *dev, struct clk *clk, struct notifier_block *nb);
+int devm_clk_notifier_register(struct device *dev, struct clk *clk,
+                              struct notifier_block *nb);
 
 /**
  * clk_get_accuracy - obtain the clock accuracy in ppb (parts per billion)
@@ -196,6 +197,13 @@ static inline int clk_notifier_unregister(struct clk *clk,
        return -ENOTSUPP;
 }
 
+static inline int devm_clk_notifier_register(struct device *dev,
+                                            struct clk *clk,
+                                            struct notifier_block *nb)
+{
+       return -ENOTSUPP;
+}
+
 static inline long clk_get_accuracy(struct clk *clk)
 {
        return -ENOTSUPP;