diff options
Diffstat (limited to 'drivers/tty/serial/sccnxp.c')
-rw-r--r-- | drivers/tty/serial/sccnxp.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c index cdd2f942317c..d6ae3086c2a2 100644 --- a/drivers/tty/serial/sccnxp.c +++ b/drivers/tty/serial/sccnxp.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * NXP (Philips) SCC+++(SCN+++) serial driver * * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru> * * Based on sc26xx.c, by Thomas Bogendörfer (tsbogend@alpha.franken.de) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #if defined(CONFIG_SERIAL_SCCNXP_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) @@ -465,9 +461,9 @@ static void sccnxp_handle_events(struct sccnxp_port *s) } while (1); } -static void sccnxp_timer(unsigned long data) +static void sccnxp_timer(struct timer_list *t) { - struct sccnxp_port *s = (struct sccnxp_port *)data; + struct sccnxp_port *s = from_timer(s, t, timer); unsigned long flags; spin_lock_irqsave(&s->lock, flags); @@ -889,7 +885,16 @@ static int sccnxp_probe(struct platform_device *pdev) goto err_out; uartclk = 0; } else { - clk_prepare_enable(clk); + ret = clk_prepare_enable(clk); + if (ret) + goto err_out; + + ret = devm_add_action_or_reset(&pdev->dev, + (void(*)(void *))clk_disable_unprepare, + clk); + if (ret) + goto err_out; + uartclk = clk_get_rate(clk); } @@ -978,8 +983,7 @@ static int sccnxp_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Unable to reguest IRQ %i\n", s->irq); } else { - init_timer(&s->timer); - setup_timer(&s->timer, sccnxp_timer, (unsigned long)s); + timer_setup(&s->timer, sccnxp_timer, 0); mod_timer(&s->timer, jiffies + usecs_to_jiffies(s->pdata.poll_time_us)); return 0; @@ -988,7 +992,7 @@ static int sccnxp_probe(struct platform_device *pdev) uart_unregister_driver(&s->uart); err_out: if (!IS_ERR(s->regulator)) - return regulator_disable(s->regulator); + regulator_disable(s->regulator); return ret; } |