mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 22:24:09 +08:00
clk: samsung: exynos-audss: Use local variable for controller's device
Store pointer to the controller's device in local variable to avoid extracting it from platform device in each call. This will also simplify code in the future, when runtime PM support is added. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Michael Turquette <mturquette@baylibre.com> Link: lkml.kernel.org/r/1503302703-13801-5-git-send-email-m.szyprowski@samsung.com
This commit is contained in:
parent
523d3de41f
commit
232d7e4792
@ -135,6 +135,7 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
|
|||||||
const struct exynos_audss_clk_drvdata *variant;
|
const struct exynos_audss_clk_drvdata *variant;
|
||||||
struct clk_hw **clk_table;
|
struct clk_hw **clk_table;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
struct device *dev = &pdev->dev;
|
||||||
int i, ret = 0;
|
int i, ret = 0;
|
||||||
|
|
||||||
variant = of_device_get_match_data(&pdev->dev);
|
variant = of_device_get_match_data(&pdev->dev);
|
||||||
@ -142,15 +143,15 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
reg_base = devm_ioremap_resource(&pdev->dev, res);
|
reg_base = devm_ioremap_resource(dev, res);
|
||||||
if (IS_ERR(reg_base)) {
|
if (IS_ERR(reg_base)) {
|
||||||
dev_err(&pdev->dev, "failed to map audss registers\n");
|
dev_err(dev, "failed to map audss registers\n");
|
||||||
return PTR_ERR(reg_base);
|
return PTR_ERR(reg_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
epll = ERR_PTR(-ENODEV);
|
epll = ERR_PTR(-ENODEV);
|
||||||
|
|
||||||
clk_data = devm_kzalloc(&pdev->dev,
|
clk_data = devm_kzalloc(dev,
|
||||||
sizeof(*clk_data) +
|
sizeof(*clk_data) +
|
||||||
sizeof(*clk_data->hws) * EXYNOS_AUDSS_MAX_CLKS,
|
sizeof(*clk_data->hws) * EXYNOS_AUDSS_MAX_CLKS,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
@ -160,8 +161,8 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
|
|||||||
clk_data->num = variant->num_clks;
|
clk_data->num = variant->num_clks;
|
||||||
clk_table = clk_data->hws;
|
clk_table = clk_data->hws;
|
||||||
|
|
||||||
pll_ref = devm_clk_get(&pdev->dev, "pll_ref");
|
pll_ref = devm_clk_get(dev, "pll_ref");
|
||||||
pll_in = devm_clk_get(&pdev->dev, "pll_in");
|
pll_in = devm_clk_get(dev, "pll_in");
|
||||||
if (!IS_ERR(pll_ref))
|
if (!IS_ERR(pll_ref))
|
||||||
mout_audss_p[0] = __clk_get_name(pll_ref);
|
mout_audss_p[0] = __clk_get_name(pll_ref);
|
||||||
if (!IS_ERR(pll_in)) {
|
if (!IS_ERR(pll_in)) {
|
||||||
@ -172,7 +173,7 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
ret = clk_prepare_enable(epll);
|
ret = clk_prepare_enable(epll);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev,
|
dev_err(dev,
|
||||||
"failed to prepare the epll clock\n");
|
"failed to prepare the epll clock\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -183,8 +184,8 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
|
|||||||
CLK_SET_RATE_NO_REPARENT,
|
CLK_SET_RATE_NO_REPARENT,
|
||||||
reg_base + ASS_CLK_SRC, 0, 1, 0, &lock);
|
reg_base + ASS_CLK_SRC, 0, 1, 0, &lock);
|
||||||
|
|
||||||
cdclk = devm_clk_get(&pdev->dev, "cdclk");
|
cdclk = devm_clk_get(dev, "cdclk");
|
||||||
sclk_audio = devm_clk_get(&pdev->dev, "sclk_audio");
|
sclk_audio = devm_clk_get(dev, "sclk_audio");
|
||||||
if (!IS_ERR(cdclk))
|
if (!IS_ERR(cdclk))
|
||||||
mout_i2s_p[1] = __clk_get_name(cdclk);
|
mout_i2s_p[1] = __clk_get_name(cdclk);
|
||||||
if (!IS_ERR(sclk_audio))
|
if (!IS_ERR(sclk_audio))
|
||||||
@ -222,7 +223,7 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
|
|||||||
"sclk_pcm", CLK_SET_RATE_PARENT,
|
"sclk_pcm", CLK_SET_RATE_PARENT,
|
||||||
reg_base + ASS_CLK_GATE, 4, 0, &lock);
|
reg_base + ASS_CLK_GATE, 4, 0, &lock);
|
||||||
|
|
||||||
sclk_pcm_in = devm_clk_get(&pdev->dev, "sclk_pcm_in");
|
sclk_pcm_in = devm_clk_get(dev, "sclk_pcm_in");
|
||||||
if (!IS_ERR(sclk_pcm_in))
|
if (!IS_ERR(sclk_pcm_in))
|
||||||
sclk_pcm_p = __clk_get_name(sclk_pcm_in);
|
sclk_pcm_p = __clk_get_name(sclk_pcm_in);
|
||||||
clk_table[EXYNOS_SCLK_PCM] = clk_hw_register_gate(NULL, "sclk_pcm",
|
clk_table[EXYNOS_SCLK_PCM] = clk_hw_register_gate(NULL, "sclk_pcm",
|
||||||
@ -237,16 +238,16 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
for (i = 0; i < clk_data->num; i++) {
|
for (i = 0; i < clk_data->num; i++) {
|
||||||
if (IS_ERR(clk_table[i])) {
|
if (IS_ERR(clk_table[i])) {
|
||||||
dev_err(&pdev->dev, "failed to register clock %d\n", i);
|
dev_err(dev, "failed to register clock %d\n", i);
|
||||||
ret = PTR_ERR(clk_table[i]);
|
ret = PTR_ERR(clk_table[i]);
|
||||||
goto unregister;
|
goto unregister;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = of_clk_add_hw_provider(pdev->dev.of_node, of_clk_hw_onecell_get,
|
ret = of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
|
||||||
clk_data);
|
clk_data);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "failed to add clock provider\n");
|
dev_err(dev, "failed to add clock provider\n");
|
||||||
goto unregister;
|
goto unregister;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user