mtd: rawnand: tegra: Simplify maximum determination in tegra_nand_setup_timing()
Subsystems (5)
PATCH 1/1 mtd: rawnand: tegra: Simplify maximum determination in tegra_nand_setup_timing()
From: Markus Elfring <[email protected]>
Date: Fri, 28 Feb 2025 19:19:45 +0100
Reduce nested max() calls by a single max3() call in this function implementation.
The source code was transformed by using the Coccinelle software.
--- drivers/mtd/nand/raw/tegra_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/tegra_nand.c +2 -2
@@ -793,8 +793,8 @@ static void tegra_nand_setup_timing(struct tegra_nand_controller *ctrl, timings->tRC_min), period); reg |=TIMING_TCR_TAR_TRR (OFFSET (val,3 )); - val =DIV_ROUND_UP (max (max (timings->tCS_min, timings->tCH_min), -max (timings->tALS_min, timings->tALH_min)), + val =DIV_ROUND_UP (max3 (timings->tCS_min, timings->tCH_min, +max (timings->tALS_min, timings->tALH_min)), period); reg |=TIMING_TCS (OFFSET (val,2 ));
--
2.48.1
Miquel Raynal
maintainerHi,
Quoted 9 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 28 Feb 2025 19:19:45 +0100Reduce nested
max()calls by a singlemax3()call in this function implementation.The source code was transformed by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
I am sorry, I do not see what gets simplified. max(max(a,b),max(c,d)) looks simpler than max3(a,b,max(c,d)). Does it bring something in terms of optimization?
Thanks,
Miquèl
Quoted 2 lines
I am sorry, I do not see what gets simplified. max(max(a,b),max(c,d)) looks simpler than max3(a,b,max(c,d)).
You would eventually like to express that a maximum should be determined from three (or even four?) values.
https://elixir.bootlin.com/linux/v6.14-rc4/source/include/linux/minmax.h#L147
Quoted 2 lines
Does it bring something in terms
of optimization?
Corresponding effects depend on various factors, don't they?
Regards,
Markus
Miquel Raynal
maintainerQuoted 5 lines · Markus Elfring
Quoted 2 lines
I am sorry, I do not see what gets simplified. max(max(a,b),max(c,d)) looks simpler than max3(a,b,max(c,d)).
You would eventually like to express that a maximum should be determined from three (or even four?) values.
If there was a max4(), why not, but in this case I don't see the point.
Quoted 6 lines
https://elixir.bootlin.com/linux/v6.14-rc4/source/include/linux/minmax.h#L147
Quoted 2 lines
Does it bring something in terms
of optimization?Corresponding effects depend on various factors, don't they?
Ok, so I'll assume the answer to my question is "no".
Thanks,
Miquèl
Quoted 4 lines
Quoted 2 lines
You would eventually like to express that a maximum should be determined from three (or even four?) values.
If there was a
max4(), why not, but in this case I don't see the point.
Do you miss such a programming interface so far? Would you be looking for corresponding software adjustments?
Regards,
Markus
Miquel Raynal
maintainerQuoted 5 lines · Markus Elfring
Quoted 4 lines
Quoted 2 lines
You would eventually like to express that a maximum should be determined from three (or even four?) values.
If there was a
max4(), why not, but in this case I don't see the point.Do you miss such a programming interface so far?
No I do not.
Quoted 1 line
Would you be looking for corresponding software adjustments?
Not necessarily, unless there is some performance improvement.
Thanks,
Miquèl
Miquel Raynal
maintainerSorry for not being clear.
Quoted 5 lines · Markus Elfring
Quoted 4 lines
Quoted 2 lines
You would eventually like to express that a maximum should be determined from three (or even four?) values.
If there was a
max4(), why not, but in this case I don't see the point.Do you miss such a programming interface so far?
No.
Quoted 1 line
Would you be looking for corresponding software adjustments?
No.
Thanks,
Miquèl