mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Larsson <andreas@gaisler.com>
To: Thorsten Blum <thorsten.blum@linux.dev>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: "David S. Miller" <davem@davemloft.net>,
	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: Fri, 17 Jan 2025 16:21:17 +0100	[thread overview]
Message-ID: <b100da95-ff1c-43fe-8b63-c9830d2db5e9@gaisler.com> (raw)
In-Reply-To: <D58E47DF-ADED-4FD0-9710-62FBA284093E@linux.dev>

On 2025-01-15 17:11, Thorsten Blum wrote:
> 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.

I could see it both ways, but personally agree about it being slightly
more readable. As I'll pick up the other sun4v_cookie_only_virqs()
related patch I might as well take this one as well.

Reviewed-by: Andreas Larsson <andreas@gaisler.com>

Picking this up to my for-next.

Thanks,
Andreas

      reply	other threads:[~2025-01-17 15:21 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
2025-01-17 15:21     ` Andreas Larsson [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=b100da95-ff1c-43fe-8b63-c9830d2db5e9@gaisler.com \
    --to=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 \
    --cc=thorsten.blum@linux.dev \
    /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®