The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Vincent Mailhol <mailhol@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Waiman Long <longman@redhat.com>,
	Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH v3] locking/local_lock: s/l/__l/ and s/tl/__tl/ to reduce risk of shadowing
Date: Thu, 9 Oct 2025 14:43:15 +0200	[thread overview]
Message-ID: <20251009124315.KS20u0OG@linutronix.de> (raw)
In-Reply-To: <86b3a4f4-18fd-40c6-9f96-825af52a0509@kernel.org>

On 2025-10-09 21:39:07 [+0900], Vincent Mailhol wrote:
> Hi Sebastian,
Hi Vincent,

> On 09/10/2025 at 19:39, Sebastian Andrzej Siewior wrote:
> 
> (...)
> 
> > @@ -223,12 +223,12 @@ typedef spinlock_t local_trylock_t;
> >  #define INIT_LOCAL_LOCK(lockname) __LOCAL_SPIN_LOCK_UNLOCKED((lockname))
> >  #define INIT_LOCAL_TRYLOCK(lockname) __LOCAL_SPIN_LOCK_UNLOCKED((lockname))
> >  
> > -#define __local_lock_init(l)					\
> > +#define __local_lock_init(__l)					\
> >  	do {							\
> > -		local_spin_lock_init((l));			\
> > +		local_spin_lock_init((__l));			\
> >  	} while (0)
> >  
> > -#define __local_trylock_init(l)			__local_lock_init(l)
> > +#define __local_trylock_init(__l)			__local_lock_init(__l)
> >  
> >  #define __local_lock(__lock)					\
> >  	do {							\
> 
> The parameters of a function like macro can not shadow existing
> symbols because, when invoked, these parameters would be substituted
> during the macro expansion by the actual arguments. Only the local
> variables declared in the macro would survive after the preprocessor
> and thus only those may cause shadowing.
> 
> So this last part of the patch is not needed.

Right, but then we have the same __l variable in the whole file. Isn't
this worth something?

> Yours sincerely,
> Vincent Mailhol

Sebastian

  reply	other threads:[~2025-10-09 12:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09 10:39 [PATCH v3] locking/local_lock: s/l/__l/ and s/tl/__tl/ to reduce risk of shadowing Sebastian Andrzej Siewior
2025-10-09 12:39 ` Vincent Mailhol
2025-10-09 12:43   ` Sebastian Andrzej Siewior [this message]
2025-10-09 13:08     ` Vincent Mailhol
2025-11-26 12:21       ` Vincent Mailhol
2025-11-26 19:19 ` Waiman Long

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=20251009124315.KS20u0OG@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mailhol@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=vbabka@suse.cz \
    --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