mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thorsten Blum <thorsten.blum@linux.dev>
To: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: "David S. Miller" <davem@davemloft.net>,
	Andreas Larsson <andreas@gaisler.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Sam Ravnborg <sam@ravnborg.org>, Dawei Li <dawei.li@shingroup.cn>,
	sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sparc/irq: Remove unneeded if check in sun4v_cookie_only_virqs()
Date: Wed, 15 Jan 2025 17:11:05 +0100	[thread overview]
Message-ID: <D58E47DF-ADED-4FD0-9710-62FBA284093E@linux.dev> (raw)
In-Reply-To: <2b249bb11b3c08b21929b46f14bee808c9bbefe6.camel@physik.fu-berlin.de>

Hi Adrian,

On 14. Jan 2025, at 21:29, John Paul Adrian Glaubitz wrote:
> On Tue, 2025-01-14 at 21:25 +0100, Thorsten Blum wrote:
>> Remove the unnecessary if check and return the result directly.
>> 
>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>> ---
>> arch/sparc/kernel/irq_64.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>> 
>> diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
>> index aff0d24f8c6f..81fb49b089a8 100644
>> --- a/arch/sparc/kernel/irq_64.c
>> +++ b/arch/sparc/kernel/irq_64.c
>> @@ -146,9 +146,7 @@ static int hv_irq_version;
>>  */
>> static bool sun4v_cookie_only_virqs(void)
>> {
>> - if (hv_irq_version >= 3)
>> - return true;
>> - return false;
>> + return hv_irq_version >= 3;
>> }
>> 
>> static void __init irq_init_hv(void)
> 
> I'm not sure whether this change is really necessary nor will it improve
> the readability of the code. I think the compiler will optimize the code
> the same way, for both variants.

It's not strictly necessary, but it's shorter, less verbose, and imo
improves the code's readability. Personally, I'd even consider the
current version a code smell, but feel free to ignore the patch.

Thanks,
Thorsten

  reply	other threads:[~2025-01-15 16:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14 20:25 Thorsten Blum
2025-01-14 20:29 ` John Paul Adrian Glaubitz
2025-01-15 16:11   ` Thorsten Blum [this message]
2025-01-17 15:21     ` Andreas Larsson

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=D58E47DF-ADED-4FD0-9710-62FBA284093E@linux.dev \
    --to=thorsten.blum@linux.dev \
    --cc=andreas@gaisler.com \
    --cc=bhelgaas@google.com \
    --cc=davem@davemloft.net \
    --cc=dawei.li@shingroup.cn \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=sam@ravnborg.org \
    --cc=sparclinux@vger.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

all inboxes | Powered by JetHome®