Skip to content

Commit 7dc92ec

Browse files
Wang Jianzhenglinusw
Wang Jianzheng
authored andcommitted
pinctrl: sunxi: Use devm_clk_get_enabled() helpers
sunxi sunxi_pinctrl_init_with_variant get, enable clk and deinit_device disable and unprepare it. This simplifes the code and avoids the calls to clk_disable_unprepare(). Signed-off-by: Wang Jianzheng <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 5213518 commit 7dc92ec

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/pinctrl/sunxi/pinctrl-sunxi.c

+4-10
Original file line numberDiff line numberDiff line change
@@ -1603,30 +1603,26 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
16031603
}
16041604

16051605
ret = of_clk_get_parent_count(node);
1606-
clk = devm_clk_get(&pdev->dev, ret == 1 ? NULL : "apb");
1606+
clk = devm_clk_get_enabled(&pdev->dev, ret == 1 ? NULL : "apb");
16071607
if (IS_ERR(clk)) {
16081608
ret = PTR_ERR(clk);
16091609
goto gpiochip_error;
16101610
}
16111611

1612-
ret = clk_prepare_enable(clk);
1613-
if (ret)
1614-
goto gpiochip_error;
1615-
16161612
pctl->irq = devm_kcalloc(&pdev->dev,
16171613
pctl->desc->irq_banks,
16181614
sizeof(*pctl->irq),
16191615
GFP_KERNEL);
16201616
if (!pctl->irq) {
16211617
ret = -ENOMEM;
1622-
goto clk_error;
1618+
goto gpiochip_error;
16231619
}
16241620

16251621
for (i = 0; i < pctl->desc->irq_banks; i++) {
16261622
pctl->irq[i] = platform_get_irq(pdev, i);
16271623
if (pctl->irq[i] < 0) {
16281624
ret = pctl->irq[i];
1629-
goto clk_error;
1625+
goto gpiochip_error;
16301626
}
16311627
}
16321628

@@ -1637,7 +1633,7 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
16371633
if (!pctl->domain) {
16381634
dev_err(&pdev->dev, "Couldn't register IRQ domain\n");
16391635
ret = -ENOMEM;
1640-
goto clk_error;
1636+
goto gpiochip_error;
16411637
}
16421638

16431639
for (i = 0; i < (pctl->desc->irq_banks * IRQ_PER_BANK); i++) {
@@ -1669,8 +1665,6 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
16691665

16701666
return 0;
16711667

1672-
clk_error:
1673-
clk_disable_unprepare(clk);
16741668
gpiochip_error:
16751669
gpiochip_remove(pctl->chip);
16761670
return ret;

0 commit comments

Comments
 (0)