Re: [PATCH 3/3] ASoC: rsnd: add null CLOCKIN support
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2021-05-27 07:30:54
Also in:
alsa-devel
Hi Morimoto-san, On Thu, May 27, 2021 at 12:06 AM Kuninori Morimoto [off-list ref] wrote:
quoted
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.quoted
#define for_each_rsnd_clk(pos, adg, i) \ for (i = 0; (pos) = adg->clk[i], i < CLKMAX; i++) \ if (pos) { \ continue; \ } elseWow!! 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
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
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