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

platform/x86: quickstart: 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
7607 2616 64 10287 282f drivers/platform/x86/quickstart.o

After:
=====
text data bss dec hex filename
7301 2544 64 9909 26b5 drivers/platform/x86/quickstart.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/530b930c981c436c172c0308b348d4ae4ef72800.1757251867.git.christophe.jaillet@wanadoo.fr
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Christophe JAILLET and committed by
Ilpo Järvinen
c4f8b11b b5a5a16e

+1 -9
+1 -9
drivers/platform/x86/quickstart.c
··· 154 154 acpi_remove_notify_handler(handle, ACPI_DEVICE_NOTIFY, quickstart_notify); 155 155 } 156 156 157 - static void quickstart_mutex_destroy(void *data) 158 - { 159 - struct mutex *lock = data; 160 - 161 - mutex_destroy(lock); 162 - } 163 - 164 157 static int quickstart_probe(struct platform_device *pdev) 165 158 { 166 159 struct quickstart_data *data; ··· 172 179 data->dev = &pdev->dev; 173 180 dev_set_drvdata(&pdev->dev, data); 174 181 175 - mutex_init(&data->input_lock); 176 - ret = devm_add_action_or_reset(&pdev->dev, quickstart_mutex_destroy, &data->input_lock); 182 + ret = devm_mutex_init(&pdev->dev, &data->input_lock); 177 183 if (ret < 0) 178 184 return ret; 179 185