All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Enze Li <lienze@kylinos.cn>
Cc: rppt@kernel.org, akpm@linux-foundation.org, nathan@kernel.org,
	linux-mips@vger.kernel.org, enze.li@gmx.com
Subject: Re: [PATCH] MIPS: tlbex: undefine pr_define macro when appropriate
Date: Wed, 5 Apr 2023 10:33:21 +0200	[thread overview]
Message-ID: <20230405083321.GD6145@alpha.franken.de> (raw)
In-Reply-To: <dda8afc67055372f1322750e851ab4001300ea65.camel@kylinos.cn>

On Sat, Apr 01, 2023 at 05:14:28PM +0800, Enze Li wrote:
> On Sat, 2023-04-01 at 09:17 +0200, Thomas Bogendoerfer wrote:
> > On Sat, Apr 01, 2023 at 02:10:25PM +0800, Enze Li wrote:
> > > The pr_define macro is used only within the
> > > output_pgtable_bits_defines
> > > function, and it hasn't been used anywhere else so far.  Therefore,
> > > it
> > > should be undefined when appropriate.
> > > 
> > > Signed-off-by: Enze Li <lienze@kylinos.cn>
> > > ---
> > >  arch/mips/mm/tlbex.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
> > > index 80e05ee98d62..510a7e316eb6 100644
> > > --- a/arch/mips/mm/tlbex.c
> > > +++ b/arch/mips/mm/tlbex.c
> > > @@ -255,6 +255,8 @@ static void output_pgtable_bits_defines(void)
> > >         pr_define("_PAGE_DIRTY_SHIFT %d\n", _PAGE_DIRTY_SHIFT);
> > >         pr_define("_PFN_SHIFT %d\n", _PFN_SHIFT);
> > >         pr_debug("\n");
> > > +
> > > +#undef pr_define
> > 
> > I'm probably missing something... what problem are you fixing here ?
> > 
> > Thomas.
> > 
> 
> Hi Thomas,
> 
> Thanks for your review.  🙂
> 
> I'm trying to make the code more readable.  When I first looked at this
> function, I was wondering why the pr_define macro was defined here.  It
> looks more like a temporary definition, and I was also curious if it
> might be used elsewhere.  After searching, I couldn't find any other
> instances of it being used, which left me feeling confused.
> 
> To enhance readability, it would be good to undefine it at the end of

why is it more readable ?

> What do you think of these modifications?  Will they make it more
> convenient for others who read this code?

for me the missing undef doesn't hurt as there is no rule that local
#defines need to be undefined. And less lines distracting me is a plus

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

      reply	other threads:[~2023-04-05  8:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-01  6:10 [PATCH] MIPS: tlbex: undefine pr_define macro when appropriate Enze Li
2023-04-01  7:17 ` Thomas Bogendoerfer
2023-04-01  9:14   ` Enze Li
2023-04-05  8:33     ` Thomas Bogendoerfer [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=20230405083321.GD6145@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=akpm@linux-foundation.org \
    --cc=enze.li@gmx.com \
    --cc=lienze@kylinos.cn \
    --cc=linux-mips@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=rppt@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.