summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/sc16is7xx.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-07-06 00:08:24 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2021-07-06 00:08:24 +0300
commitc932ed0adb09a7fa6d6649ee04dd78c83ab07ada (patch)
tree02b055bd7b350e7aca9104a9c69330896bb6382b /drivers/tty/serial/sc16is7xx.c
parenta16d8644bad461bb073b92e812080ea6715ddf2b (diff)
parent15279ebe99d7c6142d9f1a6ae4ded66c0f168678 (diff)
downloadlinux-c932ed0adb09a7fa6d6649ee04dd78c83ab07ada.tar.xz
Merge tag 'tty-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty / serial updates from Greg KH: "Here is the big set of tty and serial driver patches for 5.14-rc1. A bit more than normal, but nothing major, lots of cleanups. Highlights are: - lots of tty api cleanups and mxser driver cleanups from Jiri - build warning fixes - various serial driver updates - coding style cleanups - various tty driver minor fixes and updates - removal of broken and disable r3964 line discipline (finally!) All of these have been in linux-next for a while with no reported issues" * tag 'tty-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (227 commits) serial: mvebu-uart: remove unused member nb from struct mvebu_uart arm64: dts: marvell: armada-37xx: Fix reg for standard variant of UART dt-bindings: mvebu-uart: fix documentation serial: mvebu-uart: correctly calculate minimal possible baudrate serial: mvebu-uart: do not allow changing baudrate when uartclk is not available serial: mvebu-uart: fix calculation of clock divisor tty: make linux/tty_flip.h self-contained serial: Prefer unsigned int to bare use of unsigned serial: 8250: 8250_omap: Fix possible interrupt storm on K3 SoCs serial: qcom_geni_serial: use DT aliases according to DT bindings Revert "tty: serial: Add UART driver for Cortina-Access platform" tty: serial: Add UART driver for Cortina-Access platform MAINTAINERS: add me back as mxser maintainer mxser: Documentation, fix typos mxser: Documentation, make the docs up-to-date mxser: Documentation, remove traces of callout device mxser: introduce mxser_16550A_or_MUST helper mxser: rename flags to old_speed in mxser_set_serial_info mxser: use port variable in mxser_set_serial_info mxser: access info->MCR under info->slock ...
Diffstat (limited to 'drivers/tty/serial/sc16is7xx.c')
-rw-r--r--drivers/tty/serial/sc16is7xx.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 9adb8362578c..acbb615dd28f 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1208,8 +1208,16 @@ static int sc16is7xx_probe(struct device *dev,
/* Always ask for fixed clock rate from a property. */
device_property_read_u32(dev, "clock-frequency", &uartclk);
- s->clk = devm_clk_get(dev, NULL);
- if (IS_ERR(s->clk)) {
+ s->clk = devm_clk_get_optional(dev, NULL);
+ if (IS_ERR(s->clk))
+ return PTR_ERR(s->clk);
+
+ ret = clk_prepare_enable(s->clk);
+ if (ret)
+ return ret;
+
+ freq = clk_get_rate(s->clk);
+ if (freq == 0) {
if (uartclk)
freq = uartclk;
if (pfreq)
@@ -1217,13 +1225,7 @@ static int sc16is7xx_probe(struct device *dev,
if (freq)
dev_dbg(dev, "Clock frequency: %luHz\n", freq);
else
- return PTR_ERR(s->clk);
- } else {
- ret = clk_prepare_enable(s->clk);
- if (ret)
- return ret;
-
- freq = clk_get_rate(s->clk);
+ return -EINVAL;
}
s->regmap = regmap;
@@ -1358,8 +1360,7 @@ out_thread:
kthread_stop(s->kworker_task);
out_clk:
- if (!IS_ERR(s->clk))
- clk_disable_unprepare(s->clk);
+ clk_disable_unprepare(s->clk);
return ret;
}
@@ -1383,8 +1384,7 @@ static int sc16is7xx_remove(struct device *dev)
kthread_flush_worker(&s->kworker);
kthread_stop(s->kworker_task);
- if (!IS_ERR(s->clk))
- clk_disable_unprepare(s->clk);
+ clk_disable_unprepare(s->clk);
return 0;
}