public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Heiner Kallweit <hkallweit1@gmail.com>
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 09:28:26 +0200	[thread overview]
Message-ID: <20260504072826.GL3126523@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <e43440b0-c96c-4866-91fc-cc29eef4578e@gmail.com>

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?

  parent reply	other threads:[~2026-05-04  7:28 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 [this message]
2026-05-04 20:37   ` Heiner Kallweit

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=20260504072826.GL3126523@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=boqun@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.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