[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210510125523.1271237-6-aardelean@deviqon.com>
Date: Mon, 10 May 2021 15:55:17 +0300
From: Alexandru Ardelean <aardelean@...iqon.com>
To: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: jic23@...nel.org, Jonathan.Cameron@...wei.com,
alexandru.tachici@...log.com, linux@...iqon.com,
Alexandru Ardelean <aardelean@...iqon.com>
Subject: [PATCH 05/11] iio: adc: ad7192: use devm_clk_get_optional() for mclk
The devm_clk_get_optional() helper returns NULL when devm_clk_get() returns
-ENOENT.
This makes things slightly cleaner. The added benefit is mostly cosmetic.
Also, a minor detail with this call, is that the reference for the parent
device is taken as `spi->dev` instead of `&st->sd.spi->dev` (which looks a
little crazy).
Signed-off-by: Alexandru Ardelean <aardelean@...iqon.com>
---
drivers/iio/adc/ad7192.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
index 2ed580521d81..2671581d761f 100644
--- a/drivers/iio/adc/ad7192.c
+++ b/drivers/iio/adc/ad7192.c
@@ -326,7 +326,7 @@ static int ad7192_of_clock_select(struct ad7192_state *st)
clock_sel = AD7192_CLK_INT;
/* use internal clock */
- if (PTR_ERR(st->mclk) == -ENOENT) {
+ if (st->mclk) {
if (of_property_read_bool(np, "adi,int-clock-output-enable"))
clock_sel = AD7192_CLK_INT_CO;
} else {
@@ -981,8 +981,8 @@ static int ad7192_probe(struct spi_device *spi)
st->fclk = AD7192_INT_FREQ_MHZ;
- st->mclk = devm_clk_get(&st->sd.spi->dev, "mclk");
- if (IS_ERR(st->mclk) && PTR_ERR(st->mclk) != -ENOENT) {
+ st->mclk = devm_clk_get_optional(&spi->dev, "mclk");
+ if (IS_ERR(st->mclk)) {
ret = PTR_ERR(st->mclk);
goto error_remove_trigger;
}
--
2.31.1
Powered by blists - more mailing lists