]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: adc: PAC1934: Use devm_mutex_init()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 7 Sep 2025 10:04:48 +0000 (12:04 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 10 Sep 2025 18:47:05 +0000 (19:47 +0100)
Use devm_mutex_init() instead of hand-writing it.

This saves some LoC, improves readability and saves some space in the
generated .o file.

Before:
======
   text    data     bss     dec     hex filename
  50985   23992     192   75169   125a1 drivers/iio/adc/pac1934.o

After:
=====
   text    data     bss     dec     hex filename
  50654   23920     192   74766   1240e drivers/iio/adc/pac1934.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/f92033415f43aa02fe862cb952e62b6ded949056.1757239464.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/pac1934.c

index 09fe88eb3fb04578137403a020d9befaa75610a6..575766a09782e0641847765409ffee58847164f5 100644 (file)
@@ -1455,13 +1455,6 @@ static int pac1934_prep_custom_attributes(struct pac1934_chip_info *info,
        return 0;
 }
 
-static void pac1934_mutex_destroy(void *data)
-{
-       struct mutex *lock = data;
-
-       mutex_destroy(lock);
-}
-
 static const struct iio_info pac1934_info = {
        .read_raw = pac1934_read_raw,
        .write_raw = pac1934_write_raw,
@@ -1520,9 +1513,7 @@ static int pac1934_probe(struct i2c_client *client)
                return dev_err_probe(dev, ret,
                                     "parameter parsing returned an error\n");
 
-       mutex_init(&info->lock);
-       ret = devm_add_action_or_reset(dev, pac1934_mutex_destroy,
-                                      &info->lock);
+       ret = devm_mutex_init(dev, &info->lock);
        if (ret < 0)
                return ret;