From: Peter Zijlstra <peterz@infradead.org>
To: Youling Tang <tangyouling@loongson.cn>
Cc: WANG Xuerui <kernel@xen0n.name>,
Huacai Chen <chenhuacai@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Jason Baron <jbaron@akamai.com>, Zhangjin Wu <falcon@tinylab.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
loongarch@lists.linux.dev
Subject: Re: [PATCH v2] LoongArch: Add jump-label implementation
Date: Thu, 11 May 2023 09:43:59 +0200 [thread overview]
Message-ID: <20230511074359.GQ4253@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <72b6c81a-d4ee-575a-ff48-6be7e034ac96@loongson.cn>
On Thu, May 11, 2023 at 09:33:37AM +0800, Youling Tang wrote:
> > > +void arch_jump_label_transform(struct jump_entry *entry,
> > > + enum jump_label_type type)
> > > +{
> > > + void *addr = (void *)jump_entry_code(entry);
> > > + u32 insn;
> > > +
> > > + if (type == JUMP_LABEL_JMP)
> >
> > Please use a switch for dealing with enum-typed values.
>
> Because the current type only has JUMP_LABEL_NOP and JUMP_LABEL_JMP,
> using if may be simpler than switch.
IIRC we used an enum with descriptive names instead of a boolean because
true/false just doesn't tell you much.
The whole thing fundamentally is a boolean descision though, either
you write a JMP or a NOP, jump-labels don't have more options.
next prev parent reply other threads:[~2023-05-11 7:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 9:16 [PATCH v2] LoongArch: Add jump-label implementation Youling Tang
2023-05-10 9:27 ` Peter Zijlstra
2023-05-10 9:34 ` WANG Xuerui
2023-05-10 11:23 ` Peter Zijlstra
2023-05-11 1:32 ` Youling Tang
2023-05-10 9:28 ` WANG Xuerui
2023-05-11 1:33 ` Youling Tang
2023-05-11 7:43 ` Peter Zijlstra [this message]
2023-05-11 10:07 ` WANG Xuerui
2023-05-11 10:21 ` David Laight
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=20230511074359.GQ4253@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=chenhuacai@kernel.org \
--cc=corbet@lwn.net \
--cc=falcon@tinylab.org \
--cc=jbaron@akamai.com \
--cc=jpoimboe@kernel.org \
--cc=kernel@xen0n.name \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=tangyouling@loongson.cn \
/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