summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorAlexandru Ardelean <aardelean@deviqon.com>2021-05-13 14:07:49 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2021-06-13 18:00:16 +0200
commitc9ec2cb328e3273327efad09f99f3744a778108a (patch)
treea735253b8f25c6d40df618d64b70055be3f88e4e /drivers/iio
parentiio: adc: ad7780: convert to device-managed functions (diff)
downloadlinux-c9ec2cb328e3273327efad09f99f3744a778108a.tar.xz
linux-c9ec2cb328e3273327efad09f99f3744a778108a.zip
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 quirky). Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> Link: https://lore.kernel.org/r/20210513120752.90074-10-aardelean@deviqon.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/adc/ad7192.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
index 1141cc13a124..523cf3bc955b 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 {
@@ -978,8 +978,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;
}