From: Markus Elfring <Markus.Elfring@web.de>
To: Al Viro <viro@zeniv.linux.org.uk>, kernel-janitors@vger.kernel.org
Cc: Lee Jones <lee.jones@linaro.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mfd: asic3: One function call less in asic3_irq_probe()
Date: Sun, 7 Jul 2019 09:56:11 +0200 [thread overview]
Message-ID: <4b06e2fb-a0ba-56e5-b46b-98e986e6f2fd@web.de> (raw)
In-Reply-To: <20190707005251.GQ17978@ZenIV.linux.org.uk>
>> Avoid an extra function call by using a ternary operator instead of
>> a conditional statement.
>
> Which is a good thing, because...?
I suggest to reduce a bit of duplicate source code also at this place.
>> This issue was detected by using the Coccinelle software.
>
> Oh, I see - that answers all questions.
Obviously not so far.
> "Software has detected an issue", so of course an issue it is.
The mentioned development tool can help to point refactoring
possibilities out.
>> - if (irq < asic->irq_base + ASIC3_NUM_GPIOS)
>> - irq_set_chip(irq, &asic3_gpio_irq_chip);
>> - else
>> - irq_set_chip(irq, &asic3_irq_chip);
>> -
>> + irq_set_chip(irq,
>> + (irq < asic->irq_base + ASIC3_NUM_GPIOS)
>> + ? &asic3_gpio_irq_chip
>> + : &asic3_irq_chip);
>
> ... except that the result is not objectively better by any real criteria.
We can have different opinions about the criteria which are relevant here.
> It's not more readable,
This is a possible view.
> it conveys _less_ information to reader
I guess that the interpretation of this feedback can become more interesting.
> (the fact that calls differ only by the last argument
> had been visually obvious already,
Can the repeated code specification make the recognition of this
implementation detail a bit harder actually?
> had been visually obvious already, and logics used to be easier
> to see), it (obviously) does not generate better (or different) code.
The functionality should be equivalent for the shown software refactoring.
> What the hell is the point?
I dare to point another change possibility out.
I am unsure if this adjustment will be picked up finally.
Regards,
Markus
next prev parent reply other threads:[~2019-07-07 7:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-05 18:30 [PATCH] mfd: asic3: One function call less in asic3_irq_probe() Markus Elfring
2019-07-07 0:52 ` Al Viro
2019-07-07 7:56 ` Markus Elfring [this message]
2019-07-08 10:18 ` Enrico Weigelt, metux IT consult
2019-07-08 11:50 ` Markus Elfring
2019-07-08 14:38 ` Enrico Weigelt, metux IT consult
2019-07-08 6:36 ` [PATCH] " Lee Jones
-- strict thread matches above, loose matches on Subject: below --
2019-07-05 18:30 Markus Elfring
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=4b06e2fb-a0ba-56e5-b46b-98e986e6f2fd@web.de \
--to=markus.elfring@web.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).