Hi Pavel,
On Sat, Dec 19, 2020 at 10:51 PM Pavel Machek pavel@ucw.cz wrote: [...]
I can't say I like this one:
clk_configs->m250_mux.reg = dwmac->regs + PRG_ETH0;
clk_configs->m250_mux.shift = PRG_ETH0_CLK_M250_SEL_SHIFT;
clk_configs->m250_mux.mask = PRG_ETH0_CLK_M250_SEL_MASK;
clk_configs->m250_mux.shift = __ffs(PRG_ETH0_CLK_M250_SEL_MASK);
It replaces constant with computation done at runtime; compiler can't optimize it as __ffs is implemented with asm().
what do you suggest to use instead? personally I don't see a problem because this is only called once at driver probe time.
Best regards, Martin