Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (nzxt-smart2) 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
25878 11329 128 37335 91d7 drivers/hwmon/nzxt-smart2.o

After:
=====
text data bss dec hex filename
25551 11257 128 36936 9048 drivers/hwmon/nzxt-smart2.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/f51fac0871ec7dbe4e28447ee4f774d028a53426.1757240403.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Christophe JAILLET and committed by
Guenter Roeck
552e369d 55cb8125

+1 -7
+1 -7
drivers/hwmon/nzxt-smart2.c
··· 721 721 return init_device(drvdata, drvdata->update_interval); 722 722 } 723 723 724 - static void mutex_fini(void *lock) 725 - { 726 - mutex_destroy(lock); 727 - } 728 - 729 724 static int nzxt_smart2_hid_probe(struct hid_device *hdev, 730 725 const struct hid_device_id *id) 731 726 { ··· 736 741 737 742 init_waitqueue_head(&drvdata->wq); 738 743 739 - mutex_init(&drvdata->mutex); 740 - ret = devm_add_action_or_reset(&hdev->dev, mutex_fini, &drvdata->mutex); 744 + ret = devm_mutex_init(&hdev->dev, &drvdata->mutex); 741 745 if (ret) 742 746 return ret; 743 747