summaryrefslogtreecommitdiff
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-09-19 22:54:50 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-03 15:35:33 +0300
commit182fb83d596b69779a76b5f206f0b506aa889328 (patch)
treea393efa598777f0bf46e79913eb526548411399b /drivers/tty/serial
parent24f2cd019946fc2e88e632d2e24a34c2cc3f2be4 (diff)
downloadlinux-182fb83d596b69779a76b5f206f0b506aa889328.tar.xz
serial: 8250_aspeed_vuart: Use devm_clk_get_enabled()
Use devm_clk_get_enabled() to simplify the code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Link: https://lore.kernel.org/r/20230919195450.3197881-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/8250/8250_aspeed_vuart.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c
index 57a186810696..d7482ae33a1c 100644
--- a/drivers/tty/serial/8250/8250_aspeed_vuart.c
+++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c
@@ -34,7 +34,6 @@
struct aspeed_vuart {
struct device *dev;
- struct clk *clk;
int line;
struct timer_list unthrottle_timer;
struct uart_8250_port *port;
@@ -422,6 +421,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev)
struct resource *res;
u32 clk, prop, sirq[2];
int rc, sirq_polarity;
+ struct clk *vclk;
np = pdev->dev.of_node;
@@ -454,18 +454,13 @@ static int aspeed_vuart_probe(struct platform_device *pdev)
return rc;
if (of_property_read_u32(np, "clock-frequency", &clk)) {
- vuart->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(vuart->clk)) {
- rc = dev_err_probe(dev, PTR_ERR(vuart->clk),
- "clk or clock-frequency not defined\n");
+ vclk = devm_clk_get_enabled(dev, NULL);
+ if (IS_ERR(vclk)) {
+ rc = dev_err_probe(dev, PTR_ERR(vclk), "clk or clock-frequency not defined\n");
goto err_sysfs_remove;
}
- rc = clk_prepare_enable(vuart->clk);
- if (rc < 0)
- goto err_sysfs_remove;
-
- clk = clk_get_rate(vuart->clk);
+ clk = clk_get_rate(vclk);
}
/* If current-speed was set, then try not to change it. */
@@ -565,7 +560,6 @@ static int aspeed_vuart_probe(struct platform_device *pdev)
return 0;
err_clk_disable:
- clk_disable_unprepare(vuart->clk);
irq_dispose_mapping(port.port.irq);
err_sysfs_remove:
sysfs_remove_group(&vuart->dev->kobj, &aspeed_vuart_attr_group);
@@ -580,7 +574,6 @@ static int aspeed_vuart_remove(struct platform_device *pdev)
aspeed_vuart_set_enabled(vuart, false);
serial8250_unregister_port(vuart->line);
sysfs_remove_group(&vuart->dev->kobj, &aspeed_vuart_attr_group);
- clk_disable_unprepare(vuart->clk);
return 0;
}