Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <wangjianzheng@vivo.com>
Link: https://lore.kernel.org/20240829064737.16169-1-wangjianzheng@vivo.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Wang Jianzheng and committed by
Linus Walleij
7dc92ece 5213518d

+4 -10
+4 -10
drivers/pinctrl/sunxi/pinctrl-sunxi.c
··· 1603 1603 } 1604 1604 1605 1605 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"); 1607 1607 if (IS_ERR(clk)) { 1608 1608 ret = PTR_ERR(clk); 1609 1609 goto gpiochip_error; 1610 1610 } 1611 - 1612 - ret = clk_prepare_enable(clk); 1613 - if (ret) 1614 - goto gpiochip_error; 1615 1611 1616 1612 pctl->irq = devm_kcalloc(&pdev->dev, 1617 1613 pctl->desc->irq_banks, ··· 1615 1619 GFP_KERNEL); 1616 1620 if (!pctl->irq) { 1617 1621 ret = -ENOMEM; 1618 - goto clk_error; 1622 + goto gpiochip_error; 1619 1623 } 1620 1624 1621 1625 for (i = 0; i < pctl->desc->irq_banks; i++) { 1622 1626 pctl->irq[i] = platform_get_irq(pdev, i); 1623 1627 if (pctl->irq[i] < 0) { 1624 1628 ret = pctl->irq[i]; 1625 - goto clk_error; 1629 + goto gpiochip_error; 1626 1630 } 1627 1631 } 1628 1632 ··· 1633 1637 if (!pctl->domain) { 1634 1638 dev_err(&pdev->dev, "Couldn't register IRQ domain\n"); 1635 1639 ret = -ENOMEM; 1636 - goto clk_error; 1640 + goto gpiochip_error; 1637 1641 } 1638 1642 1639 1643 for (i = 0; i < (pctl->desc->irq_banks * IRQ_PER_BANK); i++) { ··· 1665 1669 1666 1670 return 0; 1667 1671 1668 - clk_error: 1669 - clk_disable_unprepare(clk); 1670 1672 gpiochip_error: 1671 1673 gpiochip_remove(pctl->chip); 1672 1674 return ret;