public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Boqun Feng <boqun@kernel.org>, Waiman Long <longman@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lockdep: constify usage of struct lock_class_key where possible
Date: Mon, 4 May 2026 22:37:42 +0200	[thread overview]
Message-ID: <ec0a4762-55d4-4d93-8318-a175fefb99c8@gmail.com> (raw)
In-Reply-To: <20260504072826.GL3126523@noisy.programming.kicks-ass.net>

On 04.05.2026 09:28, Peter Zijlstra wrote:
> On Tue, Apr 28, 2026 at 11:05:25PM +0200, Heiner Kallweit wrote:
>> Constify usage of struct lock_class_key where possible. This requires
>> to constify also usage of struct lockdep_subclass_key in two places.
>>
>> Especially relevant is constification of lockdep_map.key, as it makes
>> clear that the key isn't changed during lifetime of struct lockdep_map.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>  include/linux/lockdep.h       | 18 ++++++++++--------
>>  include/linux/lockdep_types.h |  2 +-
>>  kernel/locking/lockdep.c      | 12 ++++++------
>>  3 files changed, 17 insertions(+), 15 deletions(-)
>>
>> diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
>> index 621566345..3fa2b62f2 100644
>> --- a/include/linux/lockdep.h
>> +++ b/include/linux/lockdep.h
>> @@ -125,25 +125,27 @@ extern void lockdep_unregister_key(struct lock_class_key *key);
>>   * to lockdep:
>>   */
>>  
>> -extern void lockdep_init_map_type(struct lockdep_map *lock, const char *name,
>> -	struct lock_class_key *key, int subclass, u8 inner, u8 outer, u8 lock_type);
>> +void lockdep_init_map_type(struct lockdep_map *lock, const char *name,
>> +			   const struct lock_class_key *key, int subclass,
>> +			   u8 inner, u8 outer, u8 lock_type);
> 
>> @@ -252,9 +254,9 @@ static inline int lock_is_held(const struct lockdep_map *lock)
>>  #define lockdep_is_held(lock)		lock_is_held(&(lock)->dep_map)
>>  #define lockdep_is_held_type(lock, r)	lock_is_held_type(&(lock)->dep_map, (r))
>>  
>> -extern void lock_set_class(struct lockdep_map *lock, const char *name,
>> -			   struct lock_class_key *key, unsigned int subclass,
>> -			   unsigned long ip);
>> +void lock_set_class(struct lockdep_map *lock, const char *name,
>> +		    const struct lock_class_key *key, unsigned int subclass,
>> +		    unsigned long ip);
>>  
> 
> It is also silently removing extern, why?

When touching this function prototype anyway, make it compliant with coding standard.
See https://www.kernel.org/doc/html/v7.0/process/coding-style.html, section 6.1.
"Do not use the extern keyword with function declarations as this makes lines longer
and isn’t strictly necessary."


      reply	other threads:[~2026-05-04 20:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 21:05 [PATCH] lockdep: constify usage of struct lock_class_key where possible Heiner Kallweit
2026-04-29 17:04 ` Waiman Long
2026-04-29 19:40   ` Heiner Kallweit
2026-04-29 20:34     ` Waiman Long
2026-05-04  7:28 ` Peter Zijlstra
2026-05-04 20:37   ` Heiner Kallweit [this message]

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=ec0a4762-55d4-4d93-8318-a175fefb99c8@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=boqun@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --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