Re: [PATCH] mfd: asic3: One function call less in asic3_irq_probe()

From: Al Viro
Date: Sat Jul 06 2019 - 20:53:10 EST


On Fri, Jul 05, 2019 at 08:30:08PM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> Date: Fri, 5 Jul 2019 20:22:26 +0200
>
> Avoid an extra function call by using a ternary operator instead of
> a conditional statement.

Which is a good thing, because...?

> This issue was detected by using the Coccinelle software.

Oh, I see - that answers all questions. "Software has detected an issue",
so of course an issue it is.

> - 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. It's not more readable, it conveys _less_ information
to reader (the fact that calls differ only by the last argument
had been visually obvious already, and logics used to be easier
to see), it (obviously) does not generate better (or different)
code. What the hell is the point?

May I politely inquire what makes you so determined to avoid any
not-entirely-mechanical activity?