Hi Markus, On Sat, Jul 6, 2019 at 1:57 AM Finn Thain <fthain@xxxxxxxxxxxxxxxxxxx> wrote: > On Fri, 5 Jul 2019, Markus Elfring wrote: > > From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> > > Date: Fri, 5 Jul 2019 17:11:37 +0200 > > > > Avoid an extra function call > > by using a ternary operator instead of a conditional statement for a > > setting selection. Have you looked at the actual assembler output generated by the compiler? > > This issue was detected by using the Coccinelle software. > > > > Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> > > --- > > arch/m68k/mm/mcfmmu.c | 10 ++++------ > > 1 file changed, 4 insertions(+), 6 deletions(-) > > > > diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c > > index 6cb1e41d58d0..02fc0778028e 100644 > > --- a/arch/m68k/mm/mcfmmu.c > > +++ b/arch/m68k/mm/mcfmmu.c > > @@ -146,12 +146,10 @@ int cf_tlb_miss(struct pt_regs *regs, int write, int dtlb, int extension_word) > > > > mmu_write(MMUDR, (pte_val(*pte) & PAGE_MASK) | > > ((pte->pte) & CF_PAGE_MMUDR_MASK) | MMUDR_SZ_8KB | MMUDR_X); > > - > > - if (dtlb) > > - mmu_write(MMUOR, MMUOR_ACC | MMUOR_UAA); > > - else > > - mmu_write(MMUOR, MMUOR_ITLB | MMUOR_ACC | MMUOR_UAA); > > - > > + mmu_write(MMUOR, > > + dtlb > > + ? MMUOR_ACC | MMUOR_UAA > > + : MMUOR_ITLB | MMUOR_ACC | MMUOR_UAA); While the ternary operator can be useful for short expressions, it can also lead to hard-to-read code. IMHO the latter is the case here (hint: the expression needs 3 lines). > If you are trying to avoid redundancy, why not finish the job? > > + mmu_write(MMUOR, (dtlb ? 0 : MMUOR_ITLB) | MMUOR_ACC | MMUOR_UAA); Thanks Finn, much better! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds