[PATCH v2 2/5] tty: 8250_tegra: Use devm_clk_get_enabled() helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The devm_clk_get_enabled() helpers:
    - call devm_clk_get()
    - call clk_prepare_enable() and register what is needed in order to
     call clk_disable_unprepare() when needed, as a managed resource.

This simplifies the code and avoids calls to clk_disable_unprepare().

---
v1->V2 changes
1.Remove redundant label err_clkdisable from 8250_tegra

Signed-off-by: Lei Liu <liulei.rjpt@xxxxxxxx>
---
 drivers/tty/serial/8250/8250_tegra.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_tegra.c b/drivers/tty/serial/8250/8250_tegra.c
index 60a80d00d251..79e5765a10f0 100644
--- a/drivers/tty/serial/8250/8250_tegra.c
+++ b/drivers/tty/serial/8250/8250_tegra.c
@@ -86,22 +86,18 @@ static int tegra_uart_probe(struct platform_device *pdev)
 		return PTR_ERR(uart->rst);
 
 	if (!port->uartclk) {
-		uart->clk = devm_clk_get(&pdev->dev, NULL);
+		uart->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 		if (IS_ERR(uart->clk)) {
 			dev_err(&pdev->dev, "failed to get clock!\n");
 			return -ENODEV;
 		}
 
-		ret = clk_prepare_enable(uart->clk);
-		if (ret < 0)
-			return ret;
-
 		port->uartclk = clk_get_rate(uart->clk);
 	}
 
 	ret = reset_control_deassert(uart->rst);
 	if (ret)
-		goto err_clkdisable;
+		return ret;
 
 	ret = serial8250_register_8250_port(&port8250);
 	if (ret < 0)
@@ -114,9 +110,6 @@ static int tegra_uart_probe(struct platform_device *pdev)
 
 err_ctrl_assert:
 	reset_control_assert(uart->rst);
-err_clkdisable:
-	clk_disable_unprepare(uart->clk);
-
 	return ret;
 }
 
@@ -126,7 +119,6 @@ static void tegra_uart_remove(struct platform_device *pdev)
 
 	serial8250_unregister_port(uart->line);
 	reset_control_assert(uart->rst);
-	clk_disable_unprepare(uart->clk);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.34.1





[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux