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

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: xiaomi-wmi: 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
3520 1112 64 4696 1258 drivers/platform/x86/xiaomi-wmi.o

After:
=====
text data bss dec hex filename
3069 1040 64 4173 104d drivers/platform/x86/xiaomi-wmi.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/bb5d7a57e11eb580f610276a351a01a993341fb8.1757239732.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
b5a5a16e f4902538

+1 -9
+1 -9
drivers/platform/x86/xiaomi-wmi.c
··· 26 26 unsigned int key_code; 27 27 }; 28 28 29 - static void xiaomi_mutex_destroy(void *data) 30 - { 31 - struct mutex *lock = data; 32 - 33 - mutex_destroy(lock); 34 - } 35 - 36 29 static int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context) 37 30 { 38 31 struct xiaomi_wmi *data; ··· 39 46 return -ENOMEM; 40 47 dev_set_drvdata(&wdev->dev, data); 41 48 42 - mutex_init(&data->key_lock); 43 - ret = devm_add_action_or_reset(&wdev->dev, xiaomi_mutex_destroy, &data->key_lock); 49 + ret = devm_mutex_init(&wdev->dev, &data->key_lock); 44 50 if (ret < 0) 45 51 return ret; 46 52