Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: kernel-team@android.com, kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] KVM: arm64: Remove spurious semicolon in reg_to_encoding()
Date: Tue, 05 Jan 2021 14:04:35 +0000	[thread overview]
Message-ID: <a65b85fc0531f37263d16b3d67d1b2c4@kernel.org> (raw)
In-Reply-To: <7a5b86e3-a470-a2e0-71b9-177c6c15ecfd@arm.com>

On 2021-01-05 13:54, Alexandru Elisei wrote:
> Hi Marc,
> 
> On 12/31/20 3:09 PM, Marc Zyngier wrote:
>> Although not a problem right now, it flared up while working
>> on some other aspects of the code-base. Remove the useless
>> semicolon.
>> 
>> Signed-off-by: Marc Zyngier <maz@kernel.org>
>> ---
>>  arch/arm64/kvm/sys_regs.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
>> index d46e7f706cb0..42ccc27fb684 100644
>> --- a/arch/arm64/kvm/sys_regs.c
>> +++ b/arch/arm64/kvm/sys_regs.c
>> @@ -923,7 +923,7 @@ static bool access_pmuserenr(struct kvm_vcpu 
>> *vcpu, struct sys_reg_params *p,
>> 
>>  #define reg_to_encoding(x)						\
>>  	sys_reg((u32)(x)->Op0, (u32)(x)->Op1,				\
>> -		(u32)(x)->CRn, (u32)(x)->CRm, (u32)(x)->Op2);
>> +		(u32)(x)->CRn, (u32)(x)->CRm, (u32)(x)->Op2)
> 
> Macro's shouldn't really end with a semicolon, otherwise code might 
> break
> unexpectedly:
> 
> Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
> 
> I skimmed over the code and the macro is used like a function. Do you 
> think it's
> worth turning it into a function to gain type checking for the
> argument (which is
> expected to be sys_reg_desc) and for the return value?

Not quite.

This macro takes indifferently a sys_reg_desc or a sys_reg_params,
making it impossible to turn into a function. Is it disgusting and
makes you want to pull your eyes out? Yes.

The whole params/desc duality dates back to the early 32bit code,
and I blame Rusty Russell for it. Just saying... ;-)

That's one of things I always wanted to refactor...

Thanks,

         M.
-- 
Jazz is not dead. It just smells funny...
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

  reply	other threads:[~2021-01-05 14:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-31 15:09 [PATCH] KVM: arm64: Remove spurious semicolon in reg_to_encoding() Marc Zyngier
2021-01-05 13:54 ` Alexandru Elisei
2021-01-05 14:04   ` Marc Zyngier [this message]
2021-01-05 14:46     ` Alexandru Elisei

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=a65b85fc0531f37263d16b3d67d1b2c4@kernel.org \
    --to=maz@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=kernel-team@android.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.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