For the entire history of the devm_of_clk_del_provider) existence
(since 2017) it was never used. Remove it for good.
Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/clk/clk.c | 26 --------------------------
include/linux/clk-provider.h | 4 ++--
2 files changed, 2 insertions(+), 28 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 5cbf21acb1a8..1a9dd980f74a 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -4751,32 +4751,6 @@ void of_clk_del_provider(struct device_node *np)
}
EXPORT_SYMBOL_GPL(of_clk_del_provider);
-static int devm_clk_provider_match(struct device *dev, void *res, void *data)
-{
- struct device_node **np = res;
-
- if (WARN_ON(!np || !*np))
- return 0;
-
- return *np == data;
-}
-
-/**
- * devm_of_clk_del_provider() - Remove clock provider registered using devm
- * @dev: Device to whose lifetime the clock provider was bound
- */
-void devm_of_clk_del_provider(struct device *dev)
-{
- int ret;
- struct device_node *np = get_clk_provider_node(dev);
-
- ret = devres_release(dev, devm_of_clk_release_provider,
- devm_clk_provider_match, np);
-
- WARN_ON(ret);
-}
-EXPORT_SYMBOL(devm_of_clk_del_provider);
-
/**
* of_parse_clkspec() - Parse a DT clock specifier for a given device node
* @np: device node to parse clock specifier from
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 72d937c03a3e..8ad92a4a748f 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -1420,7 +1420,7 @@ int devm_of_clk_add_hw_provider(struct device *dev,
void *data),
void *data);
void of_clk_del_provider(struct device_node *np);
-void devm_of_clk_del_provider(struct device *dev);
+
struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
void *data);
struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec,
@@ -1457,7 +1457,7 @@ static inline int devm_of_clk_add_hw_provider(struct device *dev,
return 0;
}
static inline void of_clk_del_provider(struct device_node *np) {}
-static inline void devm_of_clk_del_provider(struct device *dev) {}
+
static inline struct clk *of_clk_src_simple_get(
struct of_phandle_args *clkspec, void *data)
{
--
2.35.1
Use devm_add_action_or_reset() instead of devres_alloc() and
devres_add(), which works the same. This will simplify the
code. There is no functional changes.
Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/clk/clkdev.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index 716bb1710b89..b5eed37dc71a 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -348,9 +348,9 @@ int clk_hw_register_clkdev(struct clk_hw *hw, const char *con_id,
}
EXPORT_SYMBOL(clk_hw_register_clkdev);
-static void devm_clkdev_release(struct device *dev, void *res)
+static void devm_clkdev_release(void *res)
{
- clkdev_drop(*(struct clk_lookup **)res);
+ clkdev_drop(res);
}
/**
@@ -371,17 +371,13 @@ static void devm_clkdev_release(struct device *dev, void *res)
int devm_clk_hw_register_clkdev(struct device *dev, struct clk_hw *hw,
const char *con_id, const char *dev_id)
{
- int rval = -ENOMEM;
- struct clk_lookup **cl;
-
- cl = devres_alloc(devm_clkdev_release, sizeof(*cl), GFP_KERNEL);
- if (cl) {
- rval = do_clk_register_clkdev(hw, cl, con_id, dev_id);
- if (!rval)
- devres_add(dev, cl);
- else
- devres_free(cl);
- }
- return rval;
+ struct clk_lookup *cl;
+ int rval;
+
+ rval = do_clk_register_clkdev(hw, &cl, con_id, dev_id);
+ if (rval)
+ return rval;
+
+ return devm_add_action_or_reset(dev, devm_clkdev_release, cl);
}
EXPORT_SYMBOL(devm_clk_hw_register_clkdev);
--
2.35.1
On Thu, Jun 23, 2022 at 02:57:17PM +0300, Andy Shevchenko wrote:
> For the entire history of the devm_of_clk_del_provider) existence
> (since 2017) it was never used. Remove it for good.
Any comments on this series?
--
With Best Regards,
Andy Shevchenko
Quoting Andy Shevchenko (2022-06-23 04:57:17)
> For the entire history of the devm_of_clk_del_provider) existence
> (since 2017) it was never used. Remove it for good.
>
> Signed-off-by: Andy Shevchenko <[email protected]>
> ---
Applied to clk-next
Quoting Andy Shevchenko (2022-06-23 04:57:19)
> Use devm_add_action_or_reset() instead of devres_alloc() and
> devres_add(), which works the same. This will simplify the
> code. There is no functional changes.
>
> Signed-off-by: Andy Shevchenko <[email protected]>
> ---
Applied to clk-next