clk: fixed-rate: Convert to clk_hw based APIs

This code still uses struct clk to register clks from the probe path.
Migrate this to the clk_hw based APIs to modernize the code. Also, this
isn't a module and it can't be one because the driver is always builtin
so drop the module table.

Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lkml.kernel.org/r/20190830150923.259497-3-sboyd@kernel.org
This commit is contained in:
Stephen Boyd 2019-08-30 08:09:13 -07:00
parent 9a9b5a4af0
commit 34e018336f
1 changed files with 15 additions and 16 deletions

View File

@ -155,9 +155,9 @@ void clk_hw_unregister_fixed_rate(struct clk_hw *hw)
EXPORT_SYMBOL_GPL(clk_hw_unregister_fixed_rate); EXPORT_SYMBOL_GPL(clk_hw_unregister_fixed_rate);
#ifdef CONFIG_OF #ifdef CONFIG_OF
static struct clk *_of_fixed_clk_setup(struct device_node *node) static struct clk_hw *_of_fixed_clk_setup(struct device_node *node)
{ {
struct clk *clk; struct clk_hw *hw;
const char *clk_name = node->name; const char *clk_name = node->name;
u32 rate; u32 rate;
u32 accuracy = 0; u32 accuracy = 0;
@ -170,18 +170,18 @@ static struct clk *_of_fixed_clk_setup(struct device_node *node)
of_property_read_string(node, "clock-output-names", &clk_name); of_property_read_string(node, "clock-output-names", &clk_name);
clk = clk_register_fixed_rate_with_accuracy(NULL, clk_name, NULL, hw = clk_hw_register_fixed_rate_with_accuracy(NULL, clk_name, NULL,
0, rate, accuracy); 0, rate, accuracy);
if (IS_ERR(clk)) if (IS_ERR(hw))
return clk; return hw;
ret = of_clk_add_provider(node, of_clk_src_simple_get, clk); ret = of_clk_add_hw_provider(node, of_clk_hw_simple_get, hw);
if (ret) { if (ret) {
clk_unregister(clk); clk_hw_unregister_fixed_rate(hw);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
return clk; return hw;
} }
/** /**
@ -195,27 +195,27 @@ CLK_OF_DECLARE(fixed_clk, "fixed-clock", of_fixed_clk_setup);
static int of_fixed_clk_remove(struct platform_device *pdev) static int of_fixed_clk_remove(struct platform_device *pdev)
{ {
struct clk *clk = platform_get_drvdata(pdev); struct clk_hw *hw = platform_get_drvdata(pdev);
of_clk_del_provider(pdev->dev.of_node); of_clk_del_provider(pdev->dev.of_node);
clk_unregister_fixed_rate(clk); clk_hw_unregister_fixed_rate(hw);
return 0; return 0;
} }
static int of_fixed_clk_probe(struct platform_device *pdev) static int of_fixed_clk_probe(struct platform_device *pdev)
{ {
struct clk *clk; struct clk_hw *hw;
/* /*
* This function is not executed when of_fixed_clk_setup * This function is not executed when of_fixed_clk_setup
* succeeded. * succeeded.
*/ */
clk = _of_fixed_clk_setup(pdev->dev.of_node); hw = _of_fixed_clk_setup(pdev->dev.of_node);
if (IS_ERR(clk)) if (IS_ERR(hw))
return PTR_ERR(clk); return PTR_ERR(hw);
platform_set_drvdata(pdev, clk); platform_set_drvdata(pdev, hw);
return 0; return 0;
} }
@ -224,7 +224,6 @@ static const struct of_device_id of_fixed_clk_ids[] = {
{ .compatible = "fixed-clock" }, { .compatible = "fixed-clock" },
{ } { }
}; };
MODULE_DEVICE_TABLE(of, of_fixed_clk_ids);
static struct platform_driver of_fixed_clk_driver = { static struct platform_driver of_fixed_clk_driver = {
.driver = { .driver = {