drivers/platform/x86/quickstart.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
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>
---
drivers/platform/x86/quickstart.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/platform/x86/quickstart.c b/drivers/platform/x86/quickstart.c
index c332c7cdaff5..acb58518be37 100644
--- a/drivers/platform/x86/quickstart.c
+++ b/drivers/platform/x86/quickstart.c
@@ -154,13 +154,6 @@ static void quickstart_notify_remove(void *context)
acpi_remove_notify_handler(handle, ACPI_DEVICE_NOTIFY, quickstart_notify);
}
-static void quickstart_mutex_destroy(void *data)
-{
- struct mutex *lock = data;
-
- mutex_destroy(lock);
-}
-
static int quickstart_probe(struct platform_device *pdev)
{
struct quickstart_data *data;
@@ -179,8 +172,7 @@ static int quickstart_probe(struct platform_device *pdev)
data->dev = &pdev->dev;
dev_set_drvdata(&pdev->dev, data);
- mutex_init(&data->input_lock);
- ret = devm_add_action_or_reset(&pdev->dev, quickstart_mutex_destroy, &data->input_lock);
+ ret = devm_mutex_init(&pdev->dev, &data->input_lock);
if (ret < 0)
return ret;
--
2.51.0
On Sun, 07 Sep 2025 15:32:26 +0200, Christophe JAILLET wrote: > 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 > > [...] Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while. The list of commits applied: [1/1] platform/x86: quickstart: Use devm_mutex_init() commit: c4f8b11bacd562f38c85f4f81a0a4426b267df70 -- i.
© 2016 - 2025 Red Hat, Inc.