From: George Stark <gnstark@salutedevices.com>
To: <andy.shevchenko@gmail.com>, <pavel@ucw.cz>, <lee@kernel.org>,
<vadimp@nvidia.com>, <mpe@ellerman.id.au>, <npiggin@gmail.com>,
<christophe.leroy@csgroup.eu>, <hdegoede@redhat.com>,
<mazziesaccount@gmail.com>, <peterz@infradead.org>,
<mingo@redhat.com>, <will@kernel.org>, <longman@redhat.com>,
<boqun.feng@gmail.com>, <nikitos.tr@gmail.com>
Cc: <linux-leds@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linuxppc-dev@lists.ozlabs.org>, <kernel@salutedevices.com>,
George Stark <gnstark@salutedevices.com>
Subject: [PATCH v3 02/11] locking: add define if mutex_destroy() is not an empty function
Date: Thu, 14 Dec 2023 01:30:11 +0300 [thread overview]
Message-ID: <20231213223020.2713164-3-gnstark@salutedevices.com> (raw)
In-Reply-To: <20231213223020.2713164-1-gnstark@salutedevices.com>
mutex_destroy() is only a debug helper and an empty function on non-debug
configurations still we can't legally ignore it because it's the
established API call and it can be extended theoretically in the future.
Sometimes it could be useful to know e.g. in the higher-level API if
mutex_destroy() really does something in the current configuration
and it's should be called or skipped otherwise for the sake of
optimization so add dedicated define to recognize these cases.
Signed-off-by: George Stark <gnstark@salutedevices.com>
---
include/linux/mutex.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index a33aa9eb9fc3..2395ce4fcaf6 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -83,6 +83,9 @@ struct mutex {
extern void mutex_destroy(struct mutex *lock);
+/* mutex_destroy() is a real function, not a NOP */
+#define mutex_destroy mutex_destroy
+
#else
# define __DEBUG_MUTEX_INITIALIZER(lockname)
--
2.25.1
next prev parent reply other threads:[~2023-12-13 22:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 22:30 [PATCH v3 00/11] devm_led_classdev_register() usage problem George Stark
2023-12-13 22:30 ` [PATCH v3 01/11] leds: aw2013: unlock mutex before destroying it George Stark
2023-12-13 22:30 ` George Stark [this message]
2023-12-14 1:52 ` [PATCH v3 02/11] locking: add define if mutex_destroy() is not an empty function Waiman Long
2023-12-13 22:30 ` [PATCH v3 03/11] devm-helpers: introduce devm_mutex_init George Stark
2023-12-13 22:36 ` Andy Shevchenko
2023-12-13 22:38 ` Andy Shevchenko
2023-12-14 9:16 ` Hans de Goede
2023-12-14 10:06 ` Christophe Leroy
2023-12-14 11:51 ` Hans de Goede
2023-12-14 12:48 ` George Stark
2023-12-14 13:00 ` Christophe Leroy
2023-12-14 13:42 ` Andy Shevchenko
2023-12-13 22:30 ` [PATCH v3 04/11] leds: aw2013: use devm API to cleanup module's resources George Stark
2023-12-14 5:42 ` Nikita Travkin
2023-12-14 12:58 ` George Stark
2023-12-14 13:47 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231213223020.2713164-3-gnstark@salutedevices.com \
--to=gnstark@salutedevices.com \
--cc=andy.shevchenko@gmail.com \
--cc=boqun.feng@gmail.com \
--cc=christophe.leroy@csgroup.eu \
--cc=hdegoede@redhat.com \
--cc=kernel@salutedevices.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=longman@redhat.com \
--cc=mazziesaccount@gmail.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=nikitos.tr@gmail.com \
--cc=npiggin@gmail.com \
--cc=pavel@ucw.cz \
--cc=peterz@infradead.org \
--cc=vadimp@nvidia.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox