iio: adc: PAC1934: Use devm_mutex_init()

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>
This commit is contained in:
Christophe JAILLET 2025-09-07 12:04:48 +02:00 committed by Jonathan Cameron
parent 106511d280
commit f29b08cd0b

View 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;