Hi Morimoto-san,
On Thu, May 27, 2021 at 12:06 AM Kuninori Morimoto kuninori.morimoto.gx@renesas.com wrote:
Oh right, I missed the static clk_hw pointer. What if you unload the snd-soc-rcar.ko module?
Hmm.. indeed. It needs something.. Thank you for poining it.
#define for_each_rsnd_clk(pos, adg, i) \ for (i = 0; (pos) = adg->clk[i], i < CLKMAX; i++) \ if (pos) { \ continue; \ } else
Wow!! I didn't know this technique. Indeed it can use NULL pointer.
But, I want to avoid "if (pos) else" code as much as possible, and keep simple code. It can handle all clk case without thinking it if it has null_clk.
Why you don't want null_clk ??
It adds a dummy object, which needs to be cleaned up. Basically you are trading a simple NULL pointer check for a zero clock rate check deeper inside the driver, with the additional burden of needing to take care of the dummy clock's life cycle.
Note that most clk_*() calls happily operate on a NULL pointer, and just return success. This includes clk_get_rate(), which returns a zero rate.
Mark might have a different view, though, due to his experience with dummy regulators?
Gr{oetje,eeting}s,
Geert