]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: adc: ad7606: use devm_mutex_init()
authorDavid Lechner <dlechner@baylibre.com>
Tue, 18 Mar 2025 22:52:12 +0000 (17:52 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 22 Apr 2025 18:09:54 +0000 (19:09 +0100)
Use devm_mutex_init() in ad7606_probe(). Mutexes should be cleaned up
on driver removal.

Also add missing include while we are touching this.

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250318-iio-adc-ad7606-improvements-v2-4-4b605427774c@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7606.c

index 36cc2b5ea7ad1b4cf1ec8cfbe21a603052f3753b..84f45d8a4b0ef2e60de1f030d310d20195626dc8 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/property.h>
 #include <linux/pwm.h>
 #include <linux/regulator/consumer.h>
@@ -1327,8 +1328,11 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
        st = iio_priv(indio_dev);
        dev_set_drvdata(dev, indio_dev);
 
+       ret = devm_mutex_init(dev, &st->lock);
+       if (ret)
+               return ret;
+
        st->dev = dev;
-       mutex_init(&st->lock);
        st->bops = bops;
        st->base_address = base_address;
        st->oversampling = 1;