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.

gpio: pisosr: 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
8431 1808 192 10431 28bf drivers/gpio/gpio-pisosr.o

After:
=====
text data bss dec hex filename
8112 1736 192 10040 2738 drivers/gpio/gpio-pisosr.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/01910ebdaba7d8d0cdc4ac60eb70da8e29cb85f1.1757251512.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Christophe JAILLET and committed by
Bartosz Golaszewski
474014cd 03c146cb

+1 -7
+1 -7
drivers/gpio/gpio-pisosr.c
··· 108 108 .can_sleep = true, 109 109 }; 110 110 111 - static void pisosr_mutex_destroy(void *lock) 112 - { 113 - mutex_destroy(lock); 114 - } 115 - 116 111 static int pisosr_gpio_probe(struct spi_device *spi) 117 112 { 118 113 struct device *dev = &spi->dev; ··· 134 139 return dev_err_probe(dev, PTR_ERR(gpio->load_gpio), 135 140 "Unable to allocate load GPIO\n"); 136 141 137 - mutex_init(&gpio->lock); 138 - ret = devm_add_action_or_reset(dev, pisosr_mutex_destroy, &gpio->lock); 142 + ret = devm_mutex_init(dev, &gpio->lock); 139 143 if (ret) 140 144 return ret; 141 145