* [PATCH] KVM: x86: enhance the readability of function pic_intack()
@ 2022-01-12 8:51 Wang Guangju
2022-01-15 0:46 ` Sean Christopherson
0 siblings, 1 reply; 2+ messages in thread
From: Wang Guangju @ 2022-01-12 8:51 UTC (permalink / raw)
To: pbonzini, sean.j.christopherson, vkuznets, wanpengli, jmattson,
joro, kvm
Cc: linux-kernel, wangguangju
From: wangguangju <wangguangju@baidu.com>
In function pic_intack(), use a varibale of "mask" to
record expression of "1 << irq", so we can enhance the
readability of this function.
Signed-off-by: wangguangju <wangguangju@baidu.com>
---
arch/x86/kvm/i8259.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 814064d06016..ad6b64b11adc 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -216,12 +216,14 @@ void kvm_pic_clear_all(struct kvm_pic *s, int irq_source_id)
*/
static inline void pic_intack(struct kvm_kpic_state *s, int irq)
{
- s->isr |= 1 << irq;
+ int mask;
+ mask = 1 << irq;
+ s->isr |= mask;
/*
* We don't clear a level sensitive interrupt here
*/
- if (!(s->elcr & (1 << irq)))
- s->irr &= ~(1 << irq);
+ if (!(s->elcr & mask))
+ s->irr &= ~mask;
if (s->auto_eoi) {
if (s->rotate_on_auto_eoi)
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: x86: enhance the readability of function pic_intack()
2022-01-12 8:51 [PATCH] KVM: x86: enhance the readability of function pic_intack() Wang Guangju
@ 2022-01-15 0:46 ` Sean Christopherson
0 siblings, 0 replies; 2+ messages in thread
From: Sean Christopherson @ 2022-01-15 0:46 UTC (permalink / raw)
To: Wang Guangju
Cc: pbonzini, sean.j.christopherson, vkuznets, wanpengli, jmattson,
joro, kvm, linux-kernel
On Wed, Jan 12, 2022, Wang Guangju wrote:
> From: wangguangju <wangguangju@baidu.com>
>
> In function pic_intack(), use a varibale of "mask" to
> record expression of "1 << irq", so we can enhance the
> readability of this function.
Please wrap at ~75 chars.
> Signed-off-by: wangguangju <wangguangju@baidu.com>
> ---
> arch/x86/kvm/i8259.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
> index 814064d06016..ad6b64b11adc 100644
> --- a/arch/x86/kvm/i8259.c
> +++ b/arch/x86/kvm/i8259.c
> @@ -216,12 +216,14 @@ void kvm_pic_clear_all(struct kvm_pic *s, int irq_source_id)
> */
> static inline void pic_intack(struct kvm_kpic_state *s, int irq)
> {
> - s->isr |= 1 << irq;
> + int mask;
Needs a newline, and could also be:
int mask = 1 << irq;
or even
int mask = BIT(irq);
That said, I oddly find the existing code more readable. Maybe "irq_mask" instead
of "mask"? Dunno. I guess I don't have a strong opinion :-)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-15 0:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-12 8:51 [PATCH] KVM: x86: enhance the readability of function pic_intack() Wang Guangju
2022-01-15 0:46 ` Sean Christopherson
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.